Skip to main content
added new code
Source Link

EDIT

I have added the following code to the mainmenu script which loads up when the game starts.

public GameObject GDPR_Popup; 
void Start()
{
    Invoke("CheckForGDPR",.25f);
}

void CheckForGDPR()
{
    if (PlayerPrefs.GetInt("npa", -1) == -1)
    {
        GDPR_Popup.SetActive(true);             
    }
}


public void OnUserClickAccept()
{
    PlayerPrefs.SetInt("npa", 0); //this is for google admob
    AdColonyAppOptions.SetGDPRConsentString("1");
    AppLovin.SetHasUserConsent(true);       
    GDPR_Popup.SetActive(false);
}

public void OnUserClickCancel()
{
    PlayerPrefs.SetInt("npa", 1);//this is for google admob
    AdColonyAppOptions.SetGDPRConsentString("0");
    AppLovin.SetHasUserConsent(false);  
    GDPR_Popup.SetActive(false);        
}

Would something like this work as I'm not sure how to test this?

Also, how to initialize the ad networks only when the user has accepted or canceled GDPR option(this I believe was mentioned in the google admob mediation documents but there was no code sample given).

Can someone please help?

EDIT

I have added the following code to the mainmenu script which loads up when the game starts.

public GameObject GDPR_Popup; 
void Start()
{
    Invoke("CheckForGDPR",.25f);
}

void CheckForGDPR()
{
    if (PlayerPrefs.GetInt("npa", -1) == -1)
    {
        GDPR_Popup.SetActive(true);             
    }
}


public void OnUserClickAccept()
{
    PlayerPrefs.SetInt("npa", 0); //this is for google admob
    AdColonyAppOptions.SetGDPRConsentString("1");
    AppLovin.SetHasUserConsent(true);       
    GDPR_Popup.SetActive(false);
}

public void OnUserClickCancel()
{
    PlayerPrefs.SetInt("npa", 1);//this is for google admob
    AdColonyAppOptions.SetGDPRConsentString("0");
    AppLovin.SetHasUserConsent(false);  
    GDPR_Popup.SetActive(false);        
}

Would something like this work as I'm not sure how to test this?

Also, how to initialize the ad networks only when the user has accepted or canceled GDPR option(this I believe was mentioned in the google admob mediation documents but there was no code sample given).

Can someone please help?

Making title descriptive, streamlining
Source Link
DMGregory
  • 136.3k
  • 22
  • 247
  • 373

Implementing GDPR complaince unitycompliance for multiple different ad networks

I'm creating a unityUnity game that uses admob mediation to show rewarded ads. I'm using about 5-10 different ad networks. 

How do I implement GDPR complaincecompliance for EU users.?

I tried following some online tutorials, but none of them had content showing getting GDPR consent for multiple networks. Can someone please guide me on how to do so? Maybe a simple

How can I modify this script on how to get the user consent. Also is it mandatory to correctly get the consentcompliance where needed for all of my ad networks?

EDIT

public class Mediation : MonoBehaviour
{
 string Video_Ad_Id = "ca-app-pub-3940256099942544/5224354917";
 private RewardedAd rewardedAd;
 public Button reviveBtn;

 void Start()
 {
    MobileAds.Initialize((initStatus) =>
    {
        Dictionary<string, AdapterStatus> map = initStatus.getAdapterStatusMap();
        foreach (KeyValuePair<string, AdapterStatus> keyValuePair in map)
        {
            string className = keyValuePair.Key;
            AdapterStatus status = keyValuePair.Value;
            switch (status.InitializationState)
            {
                case AdapterState.NotReady:
                    // The adapter initialization did not complete.
                    MonoBehaviour.print("Adapter: " + className + " not ready.");
                    break;
                case AdapterState.Ready:
                    // The adapter was successfully initialized.
                    MonoBehaviour.print("Adapter: " + className + " is initialized.");
                    break;
            }
        }
    });

    RequestRewardBasedVideo();
}

void Update()
{
    if (rewardedAd.IsLoaded())
    {
        reviveBtn.interactable = true;
    }
}

I'm not sure where to ask for consent as I'm using multiple adnetworksad networks and not just admob. In the documentation, there is this line of code:

AdRequest request = new AdRequest.Builder() .AddExtra("npa", "1") .Build();

Where do I add this in the script above and how do I ask for consent for multiple networks, like Chartboost, Adcolony, ironSource etc?

GDPR complaince unity

I'm creating a unity game that uses admob mediation to show rewarded ads. I'm using about 5-10 different ad networks. How do I implement GDPR complaince for EU users. I tried following some online tutorials but none of them had content showing getting GDPR consent for multiple networks. Can someone please guide me on how to do so? Maybe a simple script on how to get the user consent. Also is it mandatory to get the consent?

EDIT

public class Mediation : MonoBehaviour
{
 string Video_Ad_Id = "ca-app-pub-3940256099942544/5224354917";
 private RewardedAd rewardedAd;
 public Button reviveBtn;

 void Start()
 {
    MobileAds.Initialize((initStatus) =>
    {
        Dictionary<string, AdapterStatus> map = initStatus.getAdapterStatusMap();
        foreach (KeyValuePair<string, AdapterStatus> keyValuePair in map)
        {
            string className = keyValuePair.Key;
            AdapterStatus status = keyValuePair.Value;
            switch (status.InitializationState)
            {
                case AdapterState.NotReady:
                    // The adapter initialization did not complete.
                    MonoBehaviour.print("Adapter: " + className + " not ready.");
                    break;
                case AdapterState.Ready:
                    // The adapter was successfully initialized.
                    MonoBehaviour.print("Adapter: " + className + " is initialized.");
                    break;
            }
        }
    });

    RequestRewardBasedVideo();
}

void Update()
{
    if (rewardedAd.IsLoaded())
    {
        reviveBtn.interactable = true;
    }
}

I'm not sure where to ask for consent as I'm using multiple adnetworks and not just admob. In the documentation, there is this line of code

AdRequest request = new AdRequest.Builder() .AddExtra("npa", "1") .Build();

Where do I add this in the script above and how do I ask for consent for multiple networks like Chartboost, Adcolony, ironSource etc?

Implementing GDPR compliance for multiple different ad networks

I'm creating a Unity game that uses admob mediation to show rewarded ads. I'm using about 5-10 different ad networks. 

How do I implement GDPR compliance for EU users?

I tried following some online tutorials, but none of them had content showing getting GDPR consent for multiple networks.

How can I modify this script to correctly get compliance where needed for all of my ad networks?

public class Mediation : MonoBehaviour
{
 string Video_Ad_Id = "ca-app-pub-3940256099942544/5224354917";
 private RewardedAd rewardedAd;
 public Button reviveBtn;

 void Start()
 {
    MobileAds.Initialize((initStatus) =>
    {
        Dictionary<string, AdapterStatus> map = initStatus.getAdapterStatusMap();
        foreach (KeyValuePair<string, AdapterStatus> keyValuePair in map)
        {
            string className = keyValuePair.Key;
            AdapterStatus status = keyValuePair.Value;
            switch (status.InitializationState)
            {
                case AdapterState.NotReady:
                    // The adapter initialization did not complete.
                    MonoBehaviour.print("Adapter: " + className + " not ready.");
                    break;
                case AdapterState.Ready:
                    // The adapter was successfully initialized.
                    MonoBehaviour.print("Adapter: " + className + " is initialized.");
                    break;
            }
        }
    });

    RequestRewardBasedVideo();
}

void Update()
{
    if (rewardedAd.IsLoaded())
    {
        reviveBtn.interactable = true;
    }
}

I'm not sure where to ask for consent as I'm using multiple ad networks and not just admob. In the documentation, there is this line of code:

AdRequest request = new AdRequest.Builder().AddExtra("npa", "1") .Build();

Where do I add this in the script above and how do I ask for consent for multiple networks, like Chartboost, Adcolony, ironSource etc?

added question
Source Link

I'm creating a unity game that uses admob mediation to show rewarded ads. I'm using about 5-10 different ad networks. How do I implement GDPR complaince for EU users. I tried following some online tutorials but none of them had content showing getting GDPR consent for multiple networks. Can someone please guide me on how to do so? Maybe a simple script on how to get the user consent. Also is it mandatory to get the consent?

EDIT

public class Mediation : MonoBehaviour
{
 string Video_Ad_Id = "ca-app-pub-3940256099942544/5224354917";
 private RewardedAd rewardedAd;
 public Button reviveBtn;

 void Start()
 {
    MobileAds.Initialize((initStatus) =>
    {
        Dictionary<string, AdapterStatus> map = initStatus.getAdapterStatusMap();
        foreach (KeyValuePair<string, AdapterStatus> keyValuePair in map)
        {
            string className = keyValuePair.Key;
            AdapterStatus status = keyValuePair.Value;
            switch (status.InitializationState)
            {
                case AdapterState.NotReady:
                    // The adapter initialization did not complete.
                    MonoBehaviour.print("Adapter: " + className + " not ready.");
                    break;
                case AdapterState.Ready:
                    // The adapter was successfully initialized.
                    MonoBehaviour.print("Adapter: " + className + " is initialized.");
                    break;
            }
        }
    });

    RequestRewardBasedVideo();
}

void Update()
{
    if (rewardedAd.IsLoaded())
    {
        reviveBtn.interactable = true;
    }
}

I'm not sure where to ask for consent as I'm using multiple adnetworks and not just admob. In the documentation, there is this line of code

AdRequest request = new AdRequest.Builder() .AddExtra("npa", "1") .Build();

Where do I add this in the script above and how do I ask for consent for multiple networks like Chartboost, Adcolony, ironSource etc?

I'm creating a unity game that uses admob mediation to show rewarded ads. I'm using about 5-10 different ad networks. How do I implement GDPR complaince for EU users. I tried following some online tutorials but none of them had content showing getting GDPR consent for multiple networks. Can someone please guide me on how to do so? Maybe a simple script on how to get the user consent. Also is it mandatory to get the consent?

EDIT

public class Mediation : MonoBehaviour
{
 string Video_Ad_Id = "ca-app-pub-3940256099942544/5224354917";
 private RewardedAd rewardedAd;
 public Button reviveBtn;

 void Start()
 {
    MobileAds.Initialize((initStatus) =>
    {
        Dictionary<string, AdapterStatus> map = initStatus.getAdapterStatusMap();
        foreach (KeyValuePair<string, AdapterStatus> keyValuePair in map)
        {
            string className = keyValuePair.Key;
            AdapterStatus status = keyValuePair.Value;
            switch (status.InitializationState)
            {
                case AdapterState.NotReady:
                    // The adapter initialization did not complete.
                    MonoBehaviour.print("Adapter: " + className + " not ready.");
                    break;
                case AdapterState.Ready:
                    // The adapter was successfully initialized.
                    MonoBehaviour.print("Adapter: " + className + " is initialized.");
                    break;
            }
        }
    });

    RequestRewardBasedVideo();
}

void Update()
{
    if (rewardedAd.IsLoaded())
    {
        reviveBtn.interactable = true;
    }
}

I'm creating a unity game that uses admob mediation to show rewarded ads. I'm using about 5-10 different ad networks. How do I implement GDPR complaince for EU users. I tried following some online tutorials but none of them had content showing getting GDPR consent for multiple networks. Can someone please guide me on how to do so? Maybe a simple script on how to get the user consent. Also is it mandatory to get the consent?

EDIT

public class Mediation : MonoBehaviour
{
 string Video_Ad_Id = "ca-app-pub-3940256099942544/5224354917";
 private RewardedAd rewardedAd;
 public Button reviveBtn;

 void Start()
 {
    MobileAds.Initialize((initStatus) =>
    {
        Dictionary<string, AdapterStatus> map = initStatus.getAdapterStatusMap();
        foreach (KeyValuePair<string, AdapterStatus> keyValuePair in map)
        {
            string className = keyValuePair.Key;
            AdapterStatus status = keyValuePair.Value;
            switch (status.InitializationState)
            {
                case AdapterState.NotReady:
                    // The adapter initialization did not complete.
                    MonoBehaviour.print("Adapter: " + className + " not ready.");
                    break;
                case AdapterState.Ready:
                    // The adapter was successfully initialized.
                    MonoBehaviour.print("Adapter: " + className + " is initialized.");
                    break;
            }
        }
    });

    RequestRewardBasedVideo();
}

void Update()
{
    if (rewardedAd.IsLoaded())
    {
        reviveBtn.interactable = true;
    }
}

I'm not sure where to ask for consent as I'm using multiple adnetworks and not just admob. In the documentation, there is this line of code

AdRequest request = new AdRequest.Builder() .AddExtra("npa", "1") .Build();

Where do I add this in the script above and how do I ask for consent for multiple networks like Chartboost, Adcolony, ironSource etc?

added admob script
Source Link
Loading
Source Link
Loading