Skip to content

Advertisement

yenmoc edited this page Jan 17, 2023 · 24 revisions

Enable Advertising module via menu Tools > Pancake > Wizard

Screenshot_3

Settings

1

BASIC

  1. Auto Init :

    1. true if you want Adverstising to automatically initialize setting at Start()
    2. false you need to call Advertising.Initialize() manually where you want
    3. Advertising.Initialize() is required to use other Adverstising APIs
  2. GDPR : General Data Protection Regulation

    • Under the Google EU User Consent Policy, you must make certain disclosures to your users in the European Economic Area (EEA) and obtain their consent to use cookies or other local storage, where legally required, and to use personal data (such as AdID) to serve ads. This policy reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR)
    1. true the consent popup will be displayed automatically as soon as GoogleMobileAds Initialize is successful if you use Admob for show ad, or MaxSdk.InitializeSdk() initalize completed when you use max for show ad
    2. false nothing happened
    3. you can call manual consent form by
        if (!GDPRHelper.CheckStatusGDPR())
        {
            Advertising.ShowConsentFrom();
        }
  • Note:
    • You can also call manually by calling through Advertising.ShowConsentForm()
    • On android it will show consent form popup,
    • On ios it will show ATT popup
  1. Multi Dex:

    • enable multi dex to fix build gradle error
  2. Current Network:

    • the ad network currently used to display ads
  3. Privacy & Policy : displayed to edit when GDPR enabled

    • the link to the website containing your privacy policy information

AUTO AD-LOADING

  1. Auto Ad-Loading Mode
    1. All : auto load interstitial ad, rewarded ad, rewarded interstitial ad, app open ad
  2. Ad Checking Interval
    1. ad availability check time. ex: Ad Checking Interval = 8 checking load ad after each 8 second
  3. Ad Loading Interval
    1. time between 2 ad loads. ex: Ad Loading Interval = 15 the next call to load the ad must be 15 seconds after the previous one

ADMOB

2

  1. BannerAd:
    1. when size banner is SmartBanner you can choose option use Apdaptive Banner

MAX

3

  1. Age Restrictd User

    • To ensure COPPA, GDPR, and Google Play policy compliance, you should indicate when a user is a child. If you know that the user is in an age-restricted category (i.e., under the age of 16), set the age-restricted user flag to true

    • If you know that the user is not in an age-restricted category (i.e., age 16 or older), set the age-restricted user flag to false

Adverstising

Advertising.ShowBannerAd()
Advertising.HideBannerAd()
Advertising.DestroyBannerAd()
Advertising.GetAdaptiveBannerHeight()


Advertising.LoadInsterstitialAd()
Advertising.IsInterstitialAdReady()
Advertising.ShowInterstitialAd()


Advertising.LoadRewardedAd()
Advertising.IsRewardedAdReady()
Advertising.ShowRewardedAd()


Advertising.LoadRewardedInterstitialAd()
Advertising.IsRewardedInterstitialAdReady()
Advertising.ShowRewardedInterstitialAd()


Advertising.LoadAppOpenAd()
Advertising.IsAppOpenAdReady()
Advertising.ShowAppOpenAd()


Advertising.ShowConsentFrom()
  • you can attach your custom event callback by
Action<EInterstitialAdNetwork> InterstitialAdCompletedEvent; // call when user completed watch interstitialAd


Action<ERewardedAdNetwork> RewardedAdCompletedEvent; // call when user completed receive reward form rewardedAd
Action<ERewardedAdNetwork> RewardedAdSkippedEvent; // call when user skip watching rewardedAd


Action<ERewardedInterstitialAdNetwork> RewardedInterstitialAdCompletedEvent; // call when user completed receive reward form rewardedInterstitialAd
Action<ERewardedInterstitialAdNetwork> RewardedInterstitialAdSkippedEvent; // call when user skip watching rewardedInterstitialAd


Action<EAppOpenAdNetwork> AppOpenAdCompletedEvent; // call when user completed watch appOpenAd

Update current use network

  • by default admob will be used to show ad, you can use the following syntax
Advertising.SetCurrentNetwork("name network");

ex: Advertising.SetCurrentNetwork("applovin");
or: Advertising.SetCurrentNetwork(EAdNetwork.AppLovin);
  1. "admob"
  2. "applovin"
  3. "ironsource"
    public void UseAdmob()
    {
        Advertising.SetCurrentNetwork(EAdNetwork.Admob);
    }

    public void UseApplovin()
    {
        Advertising.SetCurrentNetwork(EAdNetwork.Applovin);
    }

Chain method for interestitial and reward

Advertising.ShowRewardedAd()
  .OnCompleted(() => Debug.Log("[REWARED] COMPLETE"))
  .OnSkipped(() => Debug.Log("[REWARED] SKIP"))
  .OnClosed(() => Debug.Log("[REWARED] CLOSE"))
  .OnDisplayed(() => Debug.Log("[REWARDED] DISPLAY"));
Advertising.ShowInterstitialAd()
  .OnCompleted(() => Debug.Log("[INTER] COMPLETE"))
  .OnDisplayed(() => Debug.Log("[INTER] DISPLAYED"));

There is a problem with applovin according to their docs

  • Interstitial

Fired when an interstitial ad is displayed (may not be received by Unity until the interstitial ad closes). Admob still work correctly

  • Rewarded

For Applovin : Fired when a rewarded ad is displayed (may not be received by Unity until the rewarded ad closes). Admob still work correctly

Notes

  1. Setting scripting symbols for Editor script compilation
If you need to define scripting symbols via scripts in the Editor so that your Editor scripts are affected by the change, you must use PlayerSettings.SetScriptingDefineSymbolsForGroup. However, there are some important details to note about how this operates.

Important: this method does not take immediate effect. Calling this method from script does not immediately apply and recompile your scripts. For your directives to take effect based on a change in scripting symbols, you must allow control to be returned to the Editor, where it then asynchronously reloads the scripts and recompiles them based on your new symbols and the directives which act on them.

So, for example, if you use this method in an Editor script, then immediately call BuildPipeline.BuildPlayer on the following line in the same script, at that point Unity is still running your Editor scripts with the old set of scripting symbols, because they have not yet been recompiled with the new symbols. This means if you have Editor scripts which run as part of your BuildPlayer execution, they run with the old scripting symbols and your player might not build as you expected.
Clone this wiki locally