Search Unity

Unity Ads work unreliable?

Discussion in 'Unity Ads & User Acquisition' started by jep7, Sep 6, 2015.

  1. jep7

    jep7

    Joined:
    May 20, 2015
    Posts:
    4
    Hello community,

    My problem is the following: I have implemented unity video ads, Initializing, asking for isReady and showing.
    At first, everything worked fine, but when some friends tested my application, unity ads seemed to work unreliable. Sometimes it worked, sometimes not (even with perfect internet connection).
    Now I have some questions:
    1. What exactly does the Application.Initialize(..) ? Do I have to call it again after loosing internet connection and reconnect? Can it cause errors, when I call it twice or more?
    2. What is the difference between Advertisement.isInitialized() and Advertisement.isReady()? I mean, I don't call any function of the Advertisement class between Advertisement.Initialize() and Advertisement.Show() except for the if(Advertisement.isReady) .
    3. Is there mabye something in the unity ads algorithm which does not allow more than n ads per hour (My friends weren't watching ads all the time, but often while playing)?

    The last tests I made, the following happened (does not really fit to my questions above):
    The first two videos were played fine, after that I always got the information, that Advertisement.isReady == false and Advertisement.isInitialized == true, message was shown by this code snippet:

    Code (CSharp):
    1. if (Advertisement.isReady (zone)) {
    2.             //First two ads/tests here
    3.             Advertisement.Show (zone, options);
    4. } else {
    5.    if(Advertisement.isInitialized){
    6.         //All the following ads here
    7.         gui.GetComponent<MenüGuiController>().ShowUserInformation("Sorry, ad could not be played");
    8.     }else{
    9.         //never (at least not in my latest tests) here
    10.         gui.GetComponent<MenüGuiController>().ShowUserInformation("Sorry, ad could not be initialized");
    11.     }
    12.     Speicher.spielzustand = Speicher.enSpielzustand.hauptmenü;
    13. }
    It would be really nice, if you could answer my questions, or if you even know the reason for my problem,

    jep7

    PS: If you need more information I can send more of course.

    Btw: How do I post code in a more readable way? At the moment the empty characters before line 2, 3, 5, ... are not written, so it is really hard to read...
     
    Last edited by a moderator: Sep 6, 2015
  2. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    I have formatted your post to use the code block, which you can also use yourself when posting/editing messages here.

    Yes, we do have an upper limit on ads shown per day for an individual user, and general guidelines described in e.g. http://blogs.unity3d.com/2015/04/15/a-designers-guide-to-using-video-ads/ is not to "annoy" your users with ads.

    Given you are calling IsReady() before showing an ad, you have implemented ads correcly. We're aware of issues where the ad hasn't been fully cached on the device yet (and are working a way to solve this for a future version of the SDK), e.g. if there for some reason is a bad network connection, so if you are showing ads often in your game, it could be that the next video hasn't been downloaded yet. In that case, I would recommend you to increase the time between showing an ad to your users.

    Hope this helps.

    /Rasmus
     
    jep7 likes this.
  3. jep7

    jep7

    Joined:
    May 20, 2015
    Posts:
    4
    Thanks for your quick answer! So, I need to avoid that the user can watch more than 25 ads per day?
    But the other thing is, that I now (after going on testing) got also the 'not initialized' error.
    So, I would really like to know what the Advertisement.Initialize() does exactly. Is everything fine when I do something like that:
    Code (CSharp):
    1. IEnumerator InitializeAdvertisement(){
    2.     //Wait for internet connection
    3.      while(Application.internetReachability == NetworkReachability.NotReachable)
    4.          yield return null;
    5.      Advertisement.Initialize(<MyGameId>, false);
    6. }
    OR do I have to check continuously, if the initialization has been 'destroyed' (is that possible??? e g because of loosing internet connection?) and Initialize again with something like this:
    Code (CSharp):
    1. IEnumerator InitializeAdvertisementContiuously(){
    2.     while(true){
    3.         if(!Advertisement.isInitialized &&
    4.            Application.internetReachability != NetworkReachability.NotReachable){
    5.            Advertisement.Initialize(<gameId>, false);
    6.          
    7.             //lets hope, that it does not take more than 5 seconds
    8.             yield return new WaitForSeconds(5f);
    9.         }else{
    10.             yield return null;
    11.         }
    12.     }
    13. }
    OR are both options wrong and I have to do something completely different?

    Answers would be great,

    jep7

    PS: Now I got how to write readable code, but is there a way to use the tab key? I don't want to hit space always 12 times at once, just to get neat code...
     
  4. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Hi,

    The max depends on factors like country, game genre etc, so cannot say what the actual max is.

    You only need to call Advertisement.Initialize() once in your game. To me your first suggestion looks fine, i.e. waiting until internet connection is available. What kind of game is it, since you expect people to switch between being offline/online while playing the game?

    I usually copy/paste code samples from a editor, where I can use Tab key for indentation. And then having spaces, to make sure the format is as expected.

    /Rasmus