-
Notifications
You must be signed in to change notification settings - Fork 4
User Consent Flow
⚡ Before you start
Make sure you have correctly Privacy Regulations.
- Overview flow
- Automatic consent flow
- Manual consent flow
- Privacy options button
- Debug geography
- Inspector implementation
- Custom Consent Logic
In order for CAS and our ad providers to deliver ads that are more relevant to your users, as a mobile app publisher, you need to collect explicit user consent.
Note
If you implement a CMP that is compliant with IAB TCF v2 (Transparency & Consent Framework) for your user consent flow, the CAS SDK supports sending the TCF v2 consent to networks. In this case, the CAS Consent Flow will not be shown to the user.
Warning
If you integrate your own CMP flow, make sure the flow completes before you initialize the CAS SDK.
1. Opt-in consent for the collection and use of personal data in the regions covered by GDPR, CCPA, LGPD, PIPEDA.
Any businesses established are required to comply with GDPR in Europe, CCPA in California, LGPD in Brazil, PIPEDA in Canada or risk facing heavy fines.
Note
Keep in mind that it’s best to contact qualified legal professionals, if you haven’t done so already, to get more information and be well-prepared for compliance.
Read more about:
With iOS 14.5 and later, you need to receive the user’s permission through the AppTrackingTransparency
framework in order to track them or access their device’s advertising identifier. Read more about Asking Permission to Track and AppTrackingTransparency Framework on Apple developer page
Warning
If an iOS App does not present this request, the IDFA will automatically be zeroed out, which may lead to a significant loss in ad revenue.
- Users located in regions that are not covered by information protection
- Users who are subject to COPPA restrictions.
- Users using iOS versions below 14.5
- Users who have indicated that they do not allow apps to ask to track them, by setting Settings > Privacy, Allow Apps to Request to Track
- Users with child accounts, or who are under age 18, who are signed in via their Apple ID
- Users who have already answered so far
- The app does not have a usage tracking description in Info.plist under
NSUserTrackingUsageDescription
key
To get consent for collecting personal data of your users, we suggest you use a built-in Consent Flow, comes with a pre-made consent form that you can easily present to your users. That means you no longer need to create your own consent window.
First, create a utility static property wherever convenient in your application to check if a Consent Flow is obtained for the user.
public static bool isConsentObtained = true;
The user will see the consent flow when your app create CAS Manager. When the user completes the flow, the SDK calls your initialization-completion handler.
var builder = CAS.MobileAds.BuildManager();
builder.WithConsentFlow(
new ConsentFlow()
.WithCompletionListener((status) =>
{
isConsentObtained = status == ConsentFlow.Status.Obtained;
})
);
builder.WithCompletionListener((config) =>
{
// The user completes the flow here
// Initialize other 3rd-party SDKs
});
CAS consent flow is enabled by default. You can disable the consent flow by building CAS Manager WithConsentFlow()
:
builder.WithConsentFlow(
new ConsentFlow(isEnabled: false)
);
Don't forget to apply the configuration.
builder.Build();
Important
You must wait until the user finishes the consent flow before you initialize third-party SDKs (such as MMPs or analytics SDKs). For this reason, initialize such SDKs from within your initialization-completion callback. If you were to initialize these third-party SDKs before the user completes the consent flow, these third-party SDKs would not be able to access relevant identifiers and you would suffer a material impact on measurement, reporting, and ad revenue.
Call ShowIfRequired()
on the ConsentFlow
class. If the consent is required, the SDK loads a form and immediately presents it .
The WithCompletionListener
is called after the form is dismissed. If consent is not required, the WithCompletionListener
is called immediately. The ConsentFlow.Status
with which the form is dismissed will be passed to the event argument.
void Start()
{
new ConsentFlow()
.WithCompletionListener((status) =>
{
isConsentObtained = status == ConsentFlow.Status.Obtained;
})
.ShowIfRequired();
}
ConsentFlow.Status | Description |
---|---|
Obtained | User consent obtained. Personalized vs non-personalized undefined. |
NotRequired | User consent not required. |
Unavailable | User consent unavailable. |
InternalError | There was an internal error. |
InternetError | There was an error loading data from the network |
FlowStillShowing | There was an error with another form is still being displayed |
Warning
The cache consent status on your app or a previously saved consent string, could lead to a TCF 3.3 error if consent is expired.
Some consent forms require the user to modify their consent at any time. Adhere to the following steps to implement a privacy options button if required.
- Implement a UI element, such as a button in your app's settings page, that can trigger a privacy options form.
- Once
ShowIfRequired()
completes, checkisConsentObtained
to determine whether to display the UI element that can present the privacy options form. - When a user interacts with your UI element, call
Show()
to show the form so the user can update their privacy options at any time.
public Button privacyButton;
private void Start()
{
privacyButton.onClick.AddListener(ShowPrivacyOptionsForm);
privacyButton.interactable = isConsentObtained;
}
public void ShowPrivacyOptionsForm()
{
new ConsentFlow()
.WithCompletionListener((status) =>
{
isConsentObtained = status == ConsentFlow.Status.Obtained;
privacyButton.interactable = isConsentObtained;
})
.Show();
}
The SDK provides a way to test your app's behavior as though the device was located in the EEA or UK using the WithDebugGeography
option.
new ConsentFlow()
.WithDebugGeography(ConsentFlow.DebugGeography.EEA)
.ShowIfRequired();
Note
Note that debug geography only work if:
- Active test device defined in
CAS.settings.SetTestDeviceIds()
. - Active Test Ad Mode in CAS Settings window.
- Active Unity Development build.
Add an GameObject to your scene using GameObject > Create Empty
in the Unity Editor. Add Component CleverAdsSolutions/Consent Flow Ad Object
in the inspector.
-
OnCompleted
The Unity event will be invoked when the Consent Flow is dismissed with one of the statuses:Obtained
,NotRequired
,Unavailable
. -
OnFailed (String)
The Unity event will be invoked when the Consent Flow is failed with error message. -
EnableOptionsButton (Boolean)
The Unity event will be invoked to change the interactivity of the Options button for the user. Note that the real status will only be determined after calling theshowIfRequired
or initialize mobile ads.
The CAS does not support your handling of CCPA opt-out values for Meta Audience Network, you must work directly with the network to purposes of your obligations for CCPA compliance.
To learn how to implement Meta Audience Network’s “Limited Data Use” flag, read the Additional Meta AudienceNetwork steps.
The following instructions apply if you are using your own or a third-party party consent mechanism.
Important
If you access Google demand through CAS, it’s critical that you review the Google CMP requirements before you start the integration process.
Warning
You must set the privacy options before creating the CAS Manager to disable the automatic CAS consent flow and advertising SDKs are initialized respecting the user's consent.
Call CAS.ATTrackingStatus.Request()
to present the app-tracking authorization request to the end user.
We recommend waiting for the completion callback prior to initialize CAS SDK so that if the user grants the App Tracking Transparency permission, the CAS mediation can use the IDFA in ad requests.
CAS.ATTrackingStatus.Request( ( status ) =>
{
// Tracking authorization completed. Start initialize here.
CAS.MobileAds.BuildManager().Initialize();
// Initialize other third-party SDKs such as MMPs or analytic
// Do not initialize mediated advertising SDKs (CAS does that for you).
} );
For a better user experience, we recommend adding a Pre permission pop-up preceding the call to CAS.ATTrackingStatus.Request()
to clarify the permission and data usage to users.
CAS shares these set consent values via adapters to supported mediation partners.
If the user consents to interest-based advertising, set the user consent Accepted
flag:
CAS.MobileAds.settings.userConsent = ConsentStatus.Accepted;
If the user does NOT consent to interest-based advertising, set the user consent Denied
flag:
CAS.MobileAds.settings.userConsent = ConsentStatus.Denied;
Once you set the consent value, CAS will continue to respect that value for the lifetime of your application or until the user consents to interest-based advertising.
California and Virginia laws may require you to display a “Do Not Sell or Share My Personal Information” link or provide other options to users located in those states to opt out of interest-based advertising. You must set a flag that indicates whether users in those states opt out of interest-based advertising or the sale or share of personal information for interest-based advertising.
If a user does NOT opt out of interest-based advertising, set the OptInSale
flag:
CAS.MobileAds.settings.userCCPAStatus = CCPAStatus.OptInSale;
If a user does opt out of interest-based advertising, set the OptOutSale
flag:
CAS.MobileAds.settings.userCCPAStatus = CCPAStatus.OptOutSale;
You do not need to set this flag for users who are outside California. If you do set this flag for such users, this will not impact how ads are served to them.
🔗 Done! What’s Next?
- Improve ads targeting with Targeting options
- Project Setup
- Configuring SDK
- Include Android
- Include iOS
- Additional mediation steps
- App-ads.txt🔗