Initialization

Open plugin editor settings at:

Window → Stan's Assets -> Google Mobile Ad → Edit Settings

And fill ad Unity id for each platform you going to use.

Test Ads Settings

You can register the test devices, by pressing "Register New Device" button. 

Adding the device to this list causes a device to receive test ads. You need to provide name and device id for each registered device. 

  • Device Name - it's just for you to help manage test devices in the editor settings.
  • Device ID - can be obtained by viewing the device log output after creating a new ad.

For example, if you building for IOS you should see Xcode log similar to this:

For Android:

I/Ads: Use AdRequest.Builder.addTestDevice("33BE2250B43518CCDA7DE426D04EE232")
to get test ads on this device.

Initialization

After setting is filled you can start scripting. Before using any of SDK API, you need to init it. Just use methods bellow

GoogleMobileAd.Init();

 

In case you want to specify ad unity ids via code, instead of doing this in inspector, you may use following code:

GoogleMobileAd.SetBannersUnitID(android_unit_id, ios_unit_id, wp8_unit_id);
GoogleMobileAd.SetInterstisialsUnitID(android_unit_id, ios_unit_id, wp8_unit_id);

 

If your app already knows a user's gender, it can provide that information in the ad request for targeting purposes. The information is also forwarded to ad network mediation adapters if mediation is enabled.

GoogleMobileAd.SetGender(GoogleGenger.Male);

 

Add a keyword for targeting purposes.

GoogleMobileAd.AddKeyword("game");

 

If your app already knows a user's birthday, it can provide that information in the ad request for targeting purposes. This information is also forwarded to ad network mediation adapters if mediation is enabled.

GoogleMobileAd.SetBirthday(1989, AndroidMonth.MARCH, 18);

        

For purposes of the Children's Online Privacy Protection Act (COPPA), there is a setting called "tag for child directed treatment".

As an app developer, you can indicate whether you want Google to treat your content as child-directed when you make an ad request. If you indicate that you want Google to treat your content as child-directed, we will take steps to disable IBA and remarketing ads on that ad request. The setting can be used with all versions of the Google Play services SDK, viaAdRequest.Builder.tagForChildDirectedTreatment(boolean):

  • If you set tagForChildDirectedTreatment to true, you will indicate that your content should be treated as child-directed for purposes of COPPA.
  • If you set tagForChildDirectedTreatment to false, you will indicate that your content should not be treated as child-directed for purposes of COPPA.
  • If you do not set tagForChildDirectedTreatment, ad requests will include no indication of how you would like your content treated with respect to COPPA.

    AdRequest request = new AdRequest.Builder() .tagForChildDirectedTreatment(true) .build();

By setting this tag, you certify that this notification is accurate and you are authorized to act on behalf of the owner of the app. You understand that abuse of this setting may result in termination of your Google account.

GoogleMobileAd.TagForChildDirectedTreatment(false);