Search code examples
iosunity-game-engineunityads

Stop the UnityAds Cookie permission seeking


I've just added UnityAds to my app and whilst testing production I noticed instead of an ad, it popped up a request to place cookies on the users device.

The SDK integration was fine but is an absolute deal breaker for me. Is there any way to turn on a setting where it doesn't do this? I turned off the seek personalised ads request in the iOS app, I don't want my users interrupted like this. I'd like to reject all on their behalf before they see it.

cookie request


Solution

  • Yes, you can do that. Use my following code to pass the consent flag to Unity Ads SDK. And make the Unity Ads SDK not request cookie permissions for your users by setting this flag to false

    MetaData gdprMetaData = new MetaData("gdpr");
    gdprMetaData.Set("consent", "false");
    Advertisement.SetMetaData(gdprMetaData); 
    // then Setup Unity ads 
    

    For people who is using Ironsource Mediation and have Unity Ads in waterfall but having the same problem.

    IronSource.Agent.setConsent(false);
    

    Warrning: but if you do that, all ads will not be personalized. The best way I recommend to you is: On first opening, You need to show ATT (Application Tracking Transparency) popup. Then if the user clicks Allow then you set the consent to true if the user clicks Don't allow (Require apps not to track) then you set the consent false.

    by the way:

    If you don't want to show ATT in the first time. You need to set consent as false until ATT shows

    *** Edit *** Ok found it in Swift, posting the code for posterity - Magoo

    let meta = UADSMetaData()
    meta.setRaw("gdpr.consent", value: false)
    meta.commit()