Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How Can I Set Up The Type Of The Admob Ads: Personal Or Non Personal?

Discussion in 'Scripting' started by pagan_poetry, Apr 11, 2019.

  1. pagan_poetry

    pagan_poetry

    Joined:
    Feb 15, 2017
    Posts:
    101
    I need to provide to user the type of the ads that will be shown in the game: personal (with Android Advertising ID) or non personal.

    I use:
    Unity official admob plugin https://github.com/googleads/googleads-mobile-unity

    As far as I know, it shows the personal Ads by default.

    How can I set up the type of the ads during the game launch? And how can I make user be able to change his choice during runtime?
     
    Last edited: Mar 15, 2020
  2. Devology

    Devology

    Joined:
    Feb 27, 2019
    Posts:
    2
    Found a solution for you and everyone who comes to this thread in the future.

    Put the following code in an if statement and you're good to go.

    // Show non personal ad
    request = new AdRequest.Builder()
    .AddExtra("npa", "1")
    .Build();

    // Show personal add
    request = new AdRequest.Builder().Build();
     
    pagan_poetry likes this.
  3. pagan_poetry

    pagan_poetry

    Joined:
    Feb 15, 2017
    Posts:
    101
    Sorry for the wrong link in the first post. I use this Unity admob plugin: https://github.com/googleads/googleads-mobile-unity
    This is another plugin, i don't use it: https://github.com/unity-plugins/Unity-Admob

    I've changed the wrong link in the first post.

    Thank you, mate. Can you provide a link where you found it?
    I think your solution is for this plugin yes? https://github.com/googleads/googleads-mobile-unity
    I ask this because i've provided the wrong unity plugin link at first (https://github.com/googleads/googleads-mobile-unity), but it looks that you ignored it anyway:)