AdMob Native Ads Advanced Unified field descriptions, click and impression event questions

1,297 views
Skip to first unread message

Denis Chernitsyn

unread,
Oct 13, 2019, 10:44:06 AM10/13/19
to Google Mobile Ads SDK Developers

Hello,

I'm implementing native ads unified plugin in our Unity project.
We're using Unity 2019.1.12f1
GoogleMobileAds v4.0.0
Also downloaded NativeAds-native Unity package. I couldn't find the version there.

I would like to ask you some questions about the Native Ads Advanced (Unified) for Unity as I have some questions and some things are not clear in the docs for me. https://developers.google.com/admob/unity/native-advanced-unified?hl=en-US


I could successfully set everything up, ran an example project and applied the logic in our app.

1. What I mentioned, the plug-in sends a native test ad with fields "Image1", "Image2", "MainText". But I couldn't find these field names in the description docs like here: https://support.google.com/admob/answer/6240809. Is there any other doc, where I can see the values for Unity? Will these field names be changed when we switch to production?

2. When I applied the logic to show the images, I got this screen. below you can see a Native Ads banner and on the top there is a regular banner from Admob. What I don't understand here is what Image1 (DoubleClick icon), Image2(Admob icon) and MainText are responsible for? Like is Image1 icon is responsible for the main icon of the project? Is image2 always an admob icon as an ads provider? Will main text always have the title and main text divided by "-" sign? Will the images have the same aspect ration and resolution all the time or will it be changed?



3. How should the Native banner Unified click and impression logic be implemented? I see that there are methods in your plug-in that can be used. I implemented click and it redirects to a sample ads page. WIll it be enough? How should we implement impression logic? Should I call RecordImpression() method after 30-60 seconds when the banner is shown? Should I call RequestBanner() again after it to get a new one?

4. When I tried to see how the native banner unified looks like with Production keys in my build without uploading it to the google play, I got Internal Error in the logs in the method HandleNativeAdFailedToLoad(object sender, AdFailedToLoadEventArgs args). Is it a normal behavior? Do you have a specific check not to allow these production keys for dev builds? I just worry that if we upload the build into google play Prod environment, we'll have the same issue.

We need to use native ads unified as we want to have a banner with margins, so it fits better in our UI. I could add margins inside of your plug-ins, but you're using Proguard now) Maybe you could add margins as an additional variable in future for regular banners? As we're using such a banner on a gameplay screen.

5. Also what I'd like to mention that it's not so good to have ads showing in an update method.

Right now you have an update method where you set the ads to all of the possible elements:

public void Update()
{
    if (this.nativeAdLoaded)
    {
        if (this.errorMessage1 != null)
        {
            MonoBehaviour.Destroy(this.errorMessage1);
        }

        if (this.errorMessage2 != null)
        {
            MonoBehaviour.Destroy(this.errorMessage1);
        }

        Texture2D billboardTexture1 = this.nativeAd.GetTexture2D("Image1");
        Texture2D billboardTexture2 = this.nativeAd.GetTexture2D("Image2");

        for (int i = 1; i <= 6; i++)
        {
            if (i % 2 == 0)
            {
                GameObject.Find("Billboard" + i.ToString())
                        .GetComponent<Renderer>()
                        .material
                        .mainTexture = billboardTexture1;
            }
            else
            {
                GameObject.Find("Billboard" + i.ToString())
                        .GetComponent<Renderer>()
                        .material
                        .mainTexture = billboardTexture2;
            }
        }

        GameObject textObject = new GameObject("GroundText");
        GameObject ground = GameObject.Find("Ground");
        textObject.transform.parent = ground.transform;
        textObject.transform.position = new Vector3(0, 0.1f, 0);
        textObject.AddComponent<TextMesh>();

        TextMesh textMeshComponent = textObject.GetComponent<TextMesh>();
        MeshRenderer meshRendererComponent = textObject.GetComponent<MeshRenderer>();

        string adText = this.nativeAd.GetText("MainText").Replace('-', '\n');

        textMeshComponent.text = adText;
        textMeshComponent.fontSize = 8;
        textMeshComponent.anchor = TextAnchor.MiddleCenter;
        textMeshComponent.transform.Rotate(new Vector3(90, 0, 0));
        textMeshComponent.font = this.TextFont;
        meshRendererComponent.material = this.GroundTextMaterial;

        this.nativeAdLoaded = false;
    }
}


And on Qualcomm 835 instead of 60 FPS that we had, we have 20. Partially it happens because you call Find() Method, which is expensive, but also it could be moved into a coroutine with repeating the same logic at least each 0.1 second. But ideally it would be great if you could modified the code on using events. So, the objects would be updated only when it's needed. It would safe a lot of resources.


Best Regards,

Denis Chernitsyn

Mobile Ads SDK Forum Advisor Prod

unread,
Oct 14, 2019, 3:45:30 AM10/14/19
to denis.ch...@gmail.com, google-adm...@googlegroups.com

Hi Denis,

Thank you for reaching out to us, and for giving us a very extensive write-up of your concerns. I will be addressing each of your concerns in turn:



1. What I mentioned, the plug-in sends a native test ad with fields "Image1", "Image2", "MainText". But I couldn't find these field names in the description docs like here: https://support.google.com/admob/answer/6240809. Is there any other doc, where I can see the values for Unity? Will these field names be changed when we switch to production?

  • First off, for clarification, there are two types of native ads for Unity: Unified and Custom. It's the Unified native ads that contain the fields in the link you gave. On the other hand, Custom native ads do not have fields by default; its fields will have to be manually created from the Ad Manager.
  • To then tie the above with your question: the sample project uses a Custom native ad, and thus, its fields (Image1Image2 and MainText) were created specifically only for that test ad. Note that field names for both Unified and Custom native ads will not change when you switch to production, unless you intentionally edit your Custom native ads from the Ad Manager.


2. When I applied the logic to show the images, I got this screen. below you can see a Native Ads banner and on the top there is a regular banner from Admob. What I don't understand here is what Image1 (DoubleClick icon), Image2(Admob icon) and MainText are responsible for? Like is Image1 icon is responsible for the main icon of the project? Is image2 always an admob icon as an ads provider? Will main text always have the title and main text divided by "-" sign? Will the images have the same aspect ration and resolution all the time or will it be changed?

  • As with the above question, it should not matter whatever Image1Image2 and MainText represents, because they are specific only to the test ad involved. Custom native ads will retain the same aspect ratio and resolution all the time, disregarding the dimensions of the GameObject they inhabit.


3. How should the Native banner Unified click and impression logic be implemented? I see that there are methods in your plug-in that can be used. I implemented click and it redirects to a sample ads page. WIll it be enough? How should we implement impression logic? Should I call RecordImpression() method after 30-60 seconds when the banner is shown? Should I call RequestBanner() again after it to get a new one?

  • Unified native ads will automatically record impressions and clicks as long as they're registered with the AdMob SDK. On the other hand, you will have to manually handle the same for Custom native ads.
  • You must call RecordImpression() as soon as the ads start showing. You may use callbacks to help with this. As for the rate of requesting another ad: there's no set standard for this, although the most common rates are found in between 30 - 120 seconds.


4. When I tried to see how the native banner unified looks like with Production keys in my build without uploading it to the google play, I got Internal Error in the logs in the method HandleNativeAdFailedToLoad(object sender, AdFailedToLoadEventArgs args). Is it a normal behavior? Do you have a specific check not to allow these production keys for dev builds? I just worry that if we upload the build into google play Prod environment, we'll have the same issue. We need to use native ads unified as we want to have a banner with margins, so it fits better in our UI. I could add margins inside of your plug-ins, but you're using Proguard now) Maybe you could add margins as an additional variable in future for regular banners? As we're using such a banner on a gameplay screen.

  • I can better assist on the concerns on this specific part if you will be able to provide me with a sample project reproducing the issue. Kindly send one via Reply privately to author so that I can provide assistance on this one. That being said, production credentials are usable on development builds (within reason), and your setup may simply be missing something before it could display ads.


5. Also what I'd like to mention that it's not so good to have ads showing in an update method. Right now you have an update method where you set the ads to all of the possible elements: <snip> And on Qualcomm 835 instead of 60 FPS that we had, we have 20. Partially it happens because you call Find() Method, which is expensive, but also it could be moved into a coroutine with repeating the same logic at least each 0.1 second. But ideally it would be great if you could modified the code on using events. So, the objects would be updated only when it's needed. It would safe a lot of resources.

  • Thank you for bringing this up to us. I will forward your suggestion to the rest of the team. In the meantime, you may optimize your implementation of the native ads as you see fit. Having the entire code be running inside Update() is indeed a costly operation, especially considering that it runs every frame.


Regards,
Ziv Yves Sanchez
Mobile Ads SDK Team



ref:_00D1U1174p._5001UKN8dL:ref

Denis Chernitsyn

unread,
Oct 14, 2019, 6:31:08 AM10/14/19
to Google Mobile Ads SDK Developers
Hello Ziv,

Thank you very much for your reply. Now it's much clearer for me what to do. I'll try to implement native ads unified and will remove custom ads logic. Will see how it goes. I'll check the production ads unit id with this new logic and will send you a sample project in the PM if I face the same issue. THank you for your quick answer.

Best Regards,
Denis Chernitsyn

Denis Chernitsyn

unread,
Oct 18, 2019, 3:15:28 AM10/18/19
to Google Mobile Ads SDK Developers
Hello Ziv,

I've sent you a private message with a test project. I have successfully implemented the Unified advances native ads and it works fine, but I can't make click working. I'd be happy to receive any feedback about what's wrong. More details in the PM.

Best Regards,
Denis Chernitsyn

Mobile Ads SDK Forum Advisor Prod

unread,
Oct 18, 2019, 5:02:53 AM10/18/19
to denis.ch...@gmail.com, google-adm...@googlegroups.com

Hi Denis,

Thank you for providing an extensive rundown of your new concern with the Unified Native Ads of AdMob Unity.

I was able to make the provided sample project work by changing the Canvas' Render Mode to Screen Space - Camera, and assigning the Main Camera as the target Render Camera. Kindly see attached screenshot. Could you try the same on your end and confirm if it'll work?



Regards,
Ziv Yves Sanchez
Mobile Ads SDK Team



ref:_00D1U1174p._5001UKN8dL:ref
screen_space_camera.png

Denis Chernitsyn

unread,
Oct 18, 2019, 1:17:37 PM10/18/19
to Google Mobile Ads SDK Developers
Hello Ziv,

Thank you very much. I could make it work on the test project. But unfortunately it still doesn't work in the real project. The canvas mode is the same. I thought it's because we load the scene async, use animator on the object, but no. I turned everything off. I'm starting to think that's it's related to some other 3rd party libs that we use like Branch, Firebase, Facebook, IronSource. They add their activities into manifest file. Can it be the reason?

Best Regards,
Denis Chernitsyn

Denis Chernitsyn

unread,
Oct 18, 2019, 6:24:41 PM10/18/19
to Google Mobile Ads SDK Developers
Hello Ziv,

I've found a reason, why it wasn't working. It was because of a Camera that had a Depth value Higher, than the camera, on which the UI was. Just create a new camera in the scene ans set Depth value higher that the camera, set for the canvas (0 by default). And Now the clicks won't respond. If you set the value to 0 on this new camera, the clicks will work again. I'll have to make a workaround for this situation, but I believe that this can be a bug that needs to be fixed as it's pretty common to use multiple cameras, which can overlay on each other in the UI.

Best Regards,
Denis Chernitsyn

shawn revels

unread,
Oct 20, 2019, 10:04:53 AM10/20/19
to google-adm...@googlegroups.com
I'm just wondering how you got ForUnifiedNativeAd() to work... it is literally no where in the AdLoader script and I've searched the entire internet for a fox and it seems it's been an issue since 2016..

Gag Labs

unread,
Oct 20, 2019, 12:52:42 PM10/20/19
to Google Mobile Ads SDK Developers
What AdLoader.cs script did you use?? Ive been stuck on this for ever. It doesnt have ForUnifiedNativeAd() in the adloader script with googlead sdk.. So im stumped and been this way for days and days. Google doesnt seem to care much and hasnt been a help at all. Any help would be appreciated. 


Mobile Ads SDK Forum Advisor Prod

unread,
Oct 21, 2019, 2:25:21 AM10/21/19
to denis.ch...@gmail.com, google-adm...@googlegroups.com

Hi Denis,

Glad to hear that you've got it working!

As for the question of where to find the ForUnifiedNativeAd() function in the AdLoader object: kindly refer to this guide for Unified Native Ads for AdMob Unity, specifically this section. You will need the AdMob build specifically for native ads in order to make this work.

Let me know if you have any other questions.



Regards,
Ziv Yves Sanchez
Mobile Ads SDK Team



ref:_00D1U1174p._5001UKN8dL:ref

shawn revels

unread,
Oct 21, 2019, 8:58:27 AM10/21/19
to Mobile Ads SDK Forum Advisor Prod, denis.ch...@gmail.com, google-adm...@googlegroups.com
The AdLoader.cs script that is provided within Google SDK does not have ForUnifiedNativeAd.. is there something im not understating? I import google mobile ads sdk and then the native ads sdk. I then try to call unified ads from adloader.build and there is no reference.


From: google-adm...@googlegroups.com <google-adm...@googlegroups.com> on behalf of Mobile Ads SDK Forum Advisor Prod <mobileadssdk...@gmail.com>
Sent: Monday, October 21, 2019 2:24:46 AM
To: denis.ch...@gmail.com <denis.ch...@gmail.com>
Cc: google-adm...@googlegroups.com <google-adm...@googlegroups.com>
Subject: Re: [google-admob-ads-sdk] AdMob Native Ads Advanced Unified field descriptions, click and impression event questions
 
--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/NfdLH000000000000000000000000000000000000000000000PZPOHA00Sm4pAaS_Qb-DzjdqaCwyOA%40sfdc.net.

shawn revels

unread,
Oct 21, 2019, 9:00:18 AM10/21/19
to Mobile Ads SDK Forum Advisor Prod, denis.ch...@gmail.com, google-adm...@googlegroups.com
There is only a reference for ForCustomNativeAds inside of adloader.cs

From: google-adm...@googlegroups.com <google-adm...@googlegroups.com> on behalf of shawn revels <sre...@gaglabs.com>
Sent: Monday, October 21, 2019 8:58:11 AM
To: Mobile Ads SDK Forum Advisor Prod <mobileadssdk...@gmail.com>; denis.ch...@gmail.com <denis.ch...@gmail.com>

Mobile Ads SDK Forum Advisor Prod

unread,
Oct 21, 2019, 11:16:19 PM10/21/19
to sre...@gaglabs.com, denis.ch...@gmail.com, google-adm...@googlegroups.com

Hi Shawn,

You only need to import the AdMob SDK that includes the native ad. Do not import the generic AdMob SDK, as that would break the SDK's file structure due to overlaps in files. You may also refer to this page to learn more about calling the ForUnifiedNativeAd() function.

If the situation persists despite the above, could you kindly provide a copy of your sample project (via Reply privately to author) so that I can further investigate the issue?



Regards,
Ziv Yves Sanchez
Mobile Ads SDK Team



ref:_00D1U1174p._5001UKN8dL:ref

ahsan khan

unread,
Jan 17, 2020, 1:25:42 AM1/17/20
to Google Mobile Ads SDK Developers
any one can help me by sharing the adloader methods because i am trying to implement but shows m text of duck adventure app and google play nothing else is showing except these two 

Mobile Ads SDK Forum Advisor Prod

unread,
Jan 17, 2020, 3:05:39 AM1/17/20
to ahsanfu...@gmail.com, google-adm...@googlegroups.com

Hi Ahsan,

 

Thank you for reaching out to us.

 

You may check out the documentation for the AdLoader and AdLoader.Builder classes in order to learn more about them. You may see these classes in practice in this guide for the Unified Native Ads for AdMob Unity. Do note that you will need the AdMob build specifically for native ads in order to make this work.

 

Regards,

Ziv Yves Sanchez

Mobile Ads SDK Team



ref:_00D1U1174p._5001USwi6X:ref
Reply all
Reply to author
Forward
0 new messages