בכפוף להסכמת משתמשים של Google באיחוד האירופי מדיניות, עליך להציג הודעות גילוי נאות מסוימות למשתמשים באזור הכלכלי האירופי (EEA) בנוסף עם בריטניה ולקבל את הסכמתם לשימוש בקובצי Cookie או באמצעים אחרים לאחסון מקומי, במקומות שבהם הדבר נדרש על פי חוק, וכן להשתמש במידע אישי (כגון מזהה פרסום) לצורך הצגת מודעות. המדיניות הזו משקפת את הדרישות שמפורטות ב-ePrivacy Directive (ההנחיה בנושא פרטיות ותקשורת אלקטרונית) של האיחוד האירופי General Data Protection Regulation (התקנות הכלליות להגנה על מידע, GDPR).
כדי לעזור לבעלי תוכן דיגיטלי למלא את החובות שלהם במסגרת המדיניות הזו, Google מציעה User Messaging Platform (UMP) SDK. UMP SDK עודכן כדי לתמוך בהתאם לתקנים העדכניים ביותר של IAB. כל ההגדרות האישיות האלה יכולות עכשיו מטופל Ad Manager בפרטיות העברת הודעות.
דרישות מוקדמות
- מבצעים את ההוראות במדריך לתחילת העבודה.
- אם אתם פועלים בהתאם לדרישות שקשורות ל-GDPR, מומלץ לקרוא את המאמר איך הדרישות של IAB משפיעות על הסכמה באיחוד האירופי הודעות
איך יוצרים את סוג ההודעה
ליצור הודעות למשתמשים באמצעות אחד סוגים זמינים של הודעות למשתמשים בקטע פרטיות העברת הודעות מנהל הפרסום חשבון. UMP SDK מנסה להציג הודעת המשתמש נוצרה מ- Ad Manager מזהה האפליקציה שמוגדרים בפרויקט. אם לא הוגדרה הודעה לאפליקציה, ה-SDK מחזירה שגיאה.
פרטים נוספים זמינים במאמר מידע על הכלי 'פרטיות והודעות'.
מוסיפים את מזהה האפליקציה
ניתן למצוא את מזהה האפליקציה בקטע ממשק המשתמש של Ad Manager. מוסיפים את התעודה המזהה עם קטע הקוד הבא:
בקשה למידע על הסכמה
צריך לבקש עדכון של פרטי ההסכמה של המשתמשים בכל אפליקציה
בהפעלה באמצעות requestConsentInfoUpdate()
. ההגדרה הזו קובעת
אם המשתמש שלך צריך להביע הסכמה אם הוא עדיין לא עשה זאת, או
אם פג תוקף ההסכמה שלהם.
דוגמה לבדיקת הסטטוס בזמן הפעלת האפליקציה:
@override
void initState() {
super.initState();
// Create a ConsentRequestParameters object.
final params = ConsentRequestParameters();
// Request an update for the consent information.
ConsentInformation.instance.requestConsentInfoUpdate(
params,
() async {
// TODO: Load and present the consent form.
},
(FormError error) {
// Handle the error.
},
);
}
טעינה והצגה של טופס הסכמה, לפי הצורך
אחרי קבלת סטטוס ההסכמה העדכני ביותר, צריך להתקשר
loadAndShowConsentFormIfRequired()
ב-
ConsentForm
המחלקה כדי לטעון טופס הסכמה. אם
נדרש סטטוס הסכמה, ערכת ה-SDK טוענת טופס ומציגה אותו מיד
מתוך שסופקו. callback
נקרא אחרי סגירה של הטופס. אם לא נדרשת הסכמה, callback
נקראת באופן מיידי.
@override
void initState() {
super.initState();
// Create a ConsentRequestParameters object.
final params = ConsentRequestParameters();
// Request an update for the consent information.
ConsentInformation.instance.requestConsentInfoUpdate(
params,
() async {
ConsentForm.loadAndShowConsentFormIfRequired((loadAndShowError) {
if (loadAndShowError != null) {
// Consent gathering failed.
}
// Consent has been gathered.
});
},
(FormError error) {
// Handle the error.
},
);
}
אם אתם צריכים לבצע פעולות כלשהן אחרי שהמשתמש ביצע החלטה או סגר בטופס, מוסיפים את הלוגיקה הזו callback עבור הטופס שלך.
בקשה להצגת מודעות
לפני ששולחים בקשה להצגת מודעות באפליקציה, צריך לבדוק אם קיבלת הסכמה
מהמשתמש באמצעות canRequestAds()
. יש שתי פלטפורמות
מקומות שצריך לבדוק במהלך קבלת ההסכמה:
- אחרי שהתקבלה הסכמה בסשן הנוכחי.
- מיד לאחר שהתקשרת אל
requestConsentInfoUpdate()
. ייתכן שהתקבלה הסכמה בסשן הקודם. כזמן אחזור מומלץ לא להמתין עד לסיום הקריאה החוזרת כדי שתוכלו להתחיל לטעון מודעות בהקדם האפשרי אחרי השקת האפליקציה.
גם אם תתרחש שגיאה בתהליך קבלת ההסכמה, עדיין עליך מנסים לבקש מודעות. סטטוס ההסכמה מה-UMP SDK הקודם היה סשן.
class AppExampleState extends State<AppExample> {
// Use a bool to initialize the Mobile Ads SDK and load ads once.
var _isMobileAdsInitializeCalled = false;
@override
void initState() {
super.initState();
// Create a ConsentRequestParameters object.
final params = ConsentRequestParameters();
// Request an update for the consent information.
ConsentInformation.instance.requestConsentInfoUpdate(
params,
() async {
ConsentForm.loadAndShowConsentFormIfRequired((loadAndShowError) {
if (loadAndShowError != null) {
// Consent gathering failed.
}
// Consent has been gathered.
_initializeMobileAdsSDK();
});
},
(FormError error) {
// Handle the error.
},
);
// Check if you can initialize the Mobile Ads SDK in parallel while
// checking for new consent information. Consent obtained in the
// previous session can be used to request ads.
_initializeMobileAdsSDK();
}
void _initializeMobileAdsSDK() async {
if (_isMobileAdsInitializeCalled) {
return;
}
// Initialize the Mobile Ads SDK if the SDK has gathered consent aligned with
// the app's configured messages.
var canRequestAds = await ConsentInformation.instance.canRequestAds();
if (canRequestAds) {
setState(() {
_isMobileAdsInitializeCalled = true;
});
// Initialize the Mobile Ads SDK.
MobileAds.instance.initialize();
// TODO: Request an ad.
}
}
}
אפשרויות פרטיות
חלק מטופסי ההסכמה מחייבים את המשתמשים לשנות את ההסכמה שלהם בכל שלב. לפעול בהתאם לבצע את השלבים הבאים כדי להטמיע לחצן של אפשרויות פרטיות, אם יש צורך.
לשם כך:
- מטמיעים רכיב בממשק המשתמש, כמו לחצן בדף ההגדרות של האפליקציה, שיכול להפעיל טופס של אפשרויות פרטיות.
- אחרי
loadAndShowConsentFormIfRequired()
שמסיימים, בודקיםgetPrivacyOptionsRequirementStatus()
כדי לקבוע אם להציג רכיב ממשק המשתמש שיכול להציג את הטופס של אפשרויות הפרטיות. - כשמשתמש יוצר אינטראקציה עם רכיב בממשק המשתמש שלך, מתבצעת קריאה
showPrivacyOptionsForm()
כדי להציג את הטופס כך שהמשתמש יוכל לעדכן את אפשרויות הפרטיות שלהם בכל שלב.
class AppExampleState extends State<AppExample> {
static const _privacySettingsText = 'Privacy Settings';
// Use a bool to initialize the Mobile Ads SDK and load ads once.
var _isMobileAdsInitializeCalled = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'App Example',
home: Scaffold(
appBar: AppBar(
title: const Text('App Example'),
actions: _isMobileAdsSDKInitialized
// Regenerate the options menu to include a privacy setting.
? _privacySettingsAppBarAction()
: null
),
body: // ...
),
);
}
List<Widget> _privacySettingsAppBarAction() {
return <Widget>[
FutureBuilder(
future: ConsentInformation.instance.isPrivacyOptionsRequired(),
builder: (context, snapshot) {
final bool visibility = snapshot.data ?? false;
return Visibility(
visible: visibility,
child: PopupMenuButton<String>(
onSelected: (String result) {
if (result == _privacySettingsText) {
ConsentForm.showPrivacyOptionsForm((formError) {
if (formError != null) {
debugPrint(
"${formError.errorCode}: ${formError.message}");
}
});
}
},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
const PopupMenuItem<String>(
value: _privacySettingsText,
child: Text(_privacySettingsText))
],
));
})
];
}
}
בדיקה
כדי לבדוק את השילוב באפליקציה במהלך הפיתוח, צריך לפעול לפי השלבים הבאים: כדי לרשום את מכשיר הבדיקה באופן פרוגרמטי. חשוב להסיר את שמגדיר את מזהי מכשירי הבדיקה האלה לפני השקת האפליקציה.
- התקשרות אל
requestConsentInfoUpdate()
. בודקים את פלט היומן להודעה שדומה לדוגמה הבאה: מציג את מזהה המכשיר ואיך להוסיף אותו כמכשיר בדיקה:
Android
Use new ConsentDebugSettings.Builder().addTestDeviceHashedId("33BE2250B43518CCDA7DE426D04EE231") to set this as a debug device.
iOS
<UMP SDK>To enable debug mode for this device, set: UMPDebugSettings.testDeviceIdentifiers = @[2077ef9a63d2b398840261c8221a0c9b]
מעתיקים את מזהה מכשיר הבדיקה ללוח.
יש לשנות את הקוד כדי התקשרות
ConsentDebugSettings.testIdentifiers
ומעבירים רשימה של המזהים של מכשירי הבדיקה.ConsentDebugSettings debugSettings = ConsentDebugSettings( testIdentifiers: ["TEST-DEVICE-HASHED-ID"], ); ConsentRequestParameters params = ConsentRequestParameters(consentDebugSettings: debugSettings); ConsentInformation.instance.requestConsentInfoUpdate(params, () async { // ... };
אילוץ מיקום גיאוגרפי
UMP SDK מאפשר לבדוק את התנהגות האפליקציה כאילו המכשיר
שנמצאים ב-EEA או בבריטניה דרך the DebugGeography
field on ConsentDebugSettings
. שימו לב
הגדרות ניפוי הבאגים פועלות רק במכשירי בדיקה.
ConsentDebugSettings debugSettings = ConsentDebugSettings(
debugGeography: DebugGeography.debugGeographyEea,
testIdentifiers: ["TEST-DEVICE-HASHED-ID"],
);
ConsentRequestParameters params =
ConsentRequestParameters(consentDebugSettings: debugSettings);
ConsentInformation.instance.requestConsentInfoUpdate(params, () async {
// ...
};
איפוס מצב ההסכמה
כשבודקים את האפליקציה באמצעות UMP SDK, מומלץ לאפס את ה-
של ה-SDK כדי שיהיה אפשר לדמות את חוויית ההתקנה הראשונה של המשתמש.
ה-SDK מספק את reset()
השיטה לעשות זאת.
ConsentInformation.instance.reset();