Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Bug Test ads works perfectly but when I try to put real ads nothing appears

Discussion in 'Unity Ads & User Acquisition' started by Furumione, Jun 11, 2023.

  1. Furumione

    Furumione

    Joined:
    Jan 18, 2023
    Posts:
    9
    I made a mobile game in which i am able to display the test ads without any problem or difficulty.

    But when I tried to show real ads nothing appeared. I made sure that the test ads were disabled both on the dashboard, in the project settings and in the script doing the initialization.
    The ids are correct and the project is correctly tied to unity ads, and is indeed monetized.
    I tried it after building the app into an apk file and using it on my phone and after I tried it by making an internal test on google play console.

    I am writing here because i don't see what to do to solve the problem and found nothing on the internet.

    here is the code I use to initialize the ads:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Advertisements;
    3.  
    4. public class AdsInitializer : MonoBehaviour, IUnityAdsInitializationListener
    5. {
    6.     [SerializeField] string _androidGameId = "5267275";
    7.     [SerializeField] string _iOSGameId = "5267274";
    8.     [SerializeField] bool _testMode = false;
    9.     private string _gameId;
    10.  
    11.     void Awake()
    12.     {
    13.         InitializeAds();
    14.     }
    15.  
    16.     public void InitializeAds()
    17.     {
    18.        
    19.         _gameId = _androidGameId;
    20.         Advertisement.Initialize(_gameId, _testMode, this);
    21.     }
    22.  
    23.     public void OnInitializationComplete()
    24.     {
    25.         Debug.Log("Unity Ads initialization complete.");
    26.     }
    27.  
    28.     public void OnInitializationFailed(UnityAdsInitializationError error, string message)
    29.     {
    30.         Debug.Log($"Unity Ads Initialization Failed: {error.ToString()} - {message}");
    31.     }
    32. }

    Then this is the code i use to display the ads

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using UnityEngine.Advertisements;
    4.  
    5.  
    6. public class BannerAd : MonoBehaviour
    7. {
    8.  
    9.     [SerializeField] BannerPosition _bannerPosition = BannerPosition.BOTTOM_CENTER;
    10.  
    11.     [SerializeField] string _androidAdUnitId = "Banner_Android";
    12.     [SerializeField] string _iOSAdUnitId = "Banner_iOS";
    13.     string _adUnitId = null;
    14.  
    15.     void Start()
    16.     {
    17.        
    18.         _adUnitId = _androidAdUnitId;
    19.         Advertisement.Banner.SetPosition(_bannerPosition);
    20.  
    21.         LoadBanner();
    22.     }
    23.     void Update()
    24.     {
    25.         ShowBannerAd();
    26.     }
    27.  
    28.     public void LoadBanner()
    29.     {
    30.         BannerLoadOptions options = new BannerLoadOptions
    31.         {
    32.             loadCallback = OnBannerLoaded,
    33.             errorCallback = OnBannerError
    34.         };
    35.  
    36.         Advertisement.Banner.Load(_adUnitId, options);
    37.     }
    38.  
    39.     void OnBannerLoaded()
    40.     {
    41.         Debug.Log("Banner loaded");
    42.         ShowBannerAd();
    43.     }
    44.  
    45.     void OnBannerError(string message)
    46.     {
    47.         Debug.Log($"Banner Error: {message}");
    48.     }
    49.  
    50.     void ShowBannerAd()
    51.     {
    52.         BannerOptions options = new BannerOptions
    53.         {
    54.             clickCallback = OnBannerClicked,
    55.             hideCallback = OnBannerHidden,
    56.             showCallback = OnBannerShown
    57.         };
    58.  
    59.         Advertisement.Banner.Show(_adUnitId, options);
    60.     }
    61.  
    62.     void HideBannerAd()
    63.     {
    64.         Advertisement.Banner.Hide();
    65.     }
    66.  
    67.  
    68.  
    69.     void OnBannerClicked() { }
    70.     void OnBannerShown() { }
    71.     void OnBannerHidden() { }
    72.  
    73.     void OnDestroy() { }
    74. }
     
  2. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    626
    If you see the test banners in Test Mode, then your integration is likely correct. The most common cause of not getting banner ads is lack of available banner demand. This would be expressed as "No fill for placement" errors.

    Many of our banner advertisers will only bid into games that have implemented the app-ads.txt file correctly. This file is a standard that has been developed over the last few years to combat fraud and create transparency in the advertising market. More info can be found in our documentation:
    https://unityads.unity3d.com/help/resources/app-ads-txt-support

    However, even with app-ads.txt implemented, the availability of banners will vary greatly by region. We continue to ramp up banner demand, but a lot of that improvement has been focused in specific regions, so not all countries are seeing banners available.

    If banners represent a major issue for you, I would recommend investigating other options. Unity Ads is supported in all of the top mediation platforms, and many do have support for our banner ads:
    https://unityads.unity3d.com/help/resources/mediation
     
  3. Furumione

    Furumione

    Joined:
    Jan 18, 2023
    Posts:
    9




    upload_2023-6-12_21-53-8.png
    this is a screeshot of the app-ads-txt-support.

    I am not sure I understand what it means by the root of the developer's website. For example, I want to put my game on the app store, for that i am using the google play console. What link do I put, is it just the one of the app when it is released for the public?
     
  4. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    626
    The developer's website is the website address you filled in the play store console.
     
  5. Furumione

    Furumione

    Joined:
    Jan 18, 2023
    Posts:
    9




    Sorry again.

    I made a small site to put in here:
    upload_2023-6-13_23-43-46.png
    since the url is not accepted it appears i am missing on some requirements.
    Do you know why my link is not accepted, and could you tell me what kind of links are accepted by unity ads?
     
  6. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    626
    Looks like the URL you filled in has a space, could you remove it and try again?
     
  7. Furumione

    Furumione

    Joined:
    Jan 18, 2023
    Posts:
    9


    Sorry about that, now here is what it says
    upload_2023-6-14_23-46-59.png
     
  8. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    626
  9. Furumione

    Furumione

    Joined:
    Jan 18, 2023
    Posts:
    9
    Is it not a problem that i am using a website creation tools?
    because the root does not link to my website and does not belong to me.