New Requirements from Google to show ads - CMP

I was asking you. Was wondering why your consent rate was so low. Its legal to select those options, if Google is providing them

So for those who donā€™t approve the consent, do you give them an alert with the option to show the dialog again to accept consent to continue using the app or do you force os.exit() directly ?

I made my own mediation system to show unity ads to those not getting admob ads loaded but since Admob pay is better than UnityAds, I may try your method too.

The consent doesnā€™t go away. I have disabled the close and the ā€œdo not consent buttonā€ from the UPM control panel. I am using Ironsource, and as I wrote above, I canā€™t even initialize Ironsource before consent. I plan to introduce the remove consent button, and I think in that case, I will let them know that they need to close the game and delete it. If they decide to relaunch it without deleting it, then they will get the consent again.

oh btw my consent rate is more accurate after days now, 2000 forms shown and %69 approval rate now.

1 Like

With the same settings?

yeah never changed, close button off, do not consent button on.

Iā€™m finally taking another crack at getting the CMP up and running, and Iā€™m hitting a weird snag when I test on an Android device, installed via adb.

Iā€™m calling admob.updateConsentForm( { underage = false } ) in my AdMob listener on event.phase == "init".

Then, ten seconds later, I call local formStatus, consentStatus = admob.getConsentFormStatus(), and I get a Runtime error: attempt to call field 'getConsentFormStatus' (a nil value)

The commands are all copy/pasted straight out of the docs, so spelling shouldnā€™t be an issue, and the rest of AdMob is working fine- loading and displaying ads, no problem. I also confirmed in my plugins folder that Iā€™ve got the latest version of the AdMob plugin downloaded onto my computer.

Any thoughts?

This had completely skipped my mind. I just made a PR to the docs with more complete code examples and gotchas.

Hereā€™s a complete code example on how to show the consent form (this will be added to the showConsentForm documentation page once the PR goes through):

local admob = require( "plugin.admob" )

local function adListener( event )

    if ( event.phase == "init" ) then
        -- Wait until "init" phase to update the Consent Form.
        admob.updateConsentForm({ underage=false })

        -- Add a slight delay to allow the plugin to finish initializing and updating the Consent Form before trying to get the form.
        timer.performWithDelay( 1000, function()
            local formStatus, consentStatus = admob.getConsentFormStatus()
            print( "formStatus: " .. tostring( formStatus ) .. ", consentStatus: " .. tostring( consentStatus ) )

            if (formStatus == "available") then
                admob.loadConsentForm()
            end
        end )
    end

	-- Successfully loading the Consent Form will trigger a "ump" type event.
	if (event.phase == "loaded" and event.type == "ump") then
		-- The Consent Form is available, loaded and ready to be shown.
		admob.showConsentForm()
	end
end

-- Initialize the AdMob plugin.
admob.init( adListener, { testMode=true } )

One of the many upcoming gotchas is:

You must wait after running admob.updateConsentForm() before admob.getConsentFormStatus() returns non-nil values.

1 Like

Hmmā€¦ Iā€™m waiting 10 seconds before calling admob.getConsentFormStatus, so I think Iā€™m having a different problem.

Also, I really think itā€™s time to retire appId="YOUR_ADMOB_APP_ID" as a param for admob.init in the docs. It always returns WARNING: admob.init(listener, options), AppId is ignored and should be in build.settings.

Yeah, thatā€™s a good point. I just copied the existing example code, which uses that. My own projects or client projects have those IDs in build.settings like you mentioned.

Have you set up the message in the AdMob portal?

Edit: Iā€™ve just amended my PR to remove mentions of appId in admob.init(). Iā€™ll edit my post above as well to remove it.

Yeah- I created a GDPR message back in June. I just went through it and confirmed that its status is ā€œPublishedā€ and that the app Iā€™m testing with is linked to the message.

According to some light Googling the error message attempt to call field 'foo' (a nil value) typically indicates that the function being called hasnā€™t been defined, which is what led me to do things like check my version of the AdMob plugin.

I guess Iā€™ll try sending this up to Internal Testing on Play and see if installing it from there makes any difference. Iā€™ve had trouble in the past with AdMob when Iā€™d side loaded an .apk using ADB instead of downloading the .aab from Play. Using registered test devices fixed those problems, but maybe the CMP is particular about that.

That sounds to me like youā€™re running a different version of the plugin. One that doesnā€™t have the new API yet.

First, make sure youā€™re not requesting a specific version of AdMob in your build.settings. If youā€™re not, then empty any cached plugins you may have.

If you run the following code, then the new API should appear in the console output, even when running on the simulator:

local admob = require( "plugin.admob" )

for k, v in pairs( admob ) do
	print( k, v )
end

If you donā€™t see getConsentFormStatus listed there, then you have an outdated version of the plugin.

I knew this problem smelled weird, and I solved it in the most unsatisfactory way. I rebooted my computer, did a new build and now everything works as expected.
:man_facepalming:

I have gotten some question about existing apis that exist and if they are still necessary/need with CMP
for admob.load()

ā€œhasUserConsentā€ is no longer needed (source: ā€œhttps://groups.google.com/g/google-admob-ads-sdk/c/I6j0Pr-_ziY/m/VOH06zsWAQAJā€) and is been replaced by CMP, this will be removed from docs and deprecated

ā€œchildSafeā€ and ā€œdesignedForFamiliesā€ are still necessary for serving child safe ads and ads for apps designed for families

1 Like

Iā€™m currently implementing Admobā€™s GDPR requirements.

In the XeduR source code, the calling condition part of admob.showConsentForm() needs to be placed outside event.phase == ā€œinitā€, right?

  • It was written correctly in the admob documentation.

One question: The condition for calling admob.loadConsentForm() is formStatus=ā€availableā€, but in this case, the form will be displayed to the user every time. Is this the intended design?
Do I also need to include consentStatus=ā€³requiredā€ in the condition if I donā€™t want it to appear every time?

Granted, I didnā€™t do much testing without consentStatus=ā€³requiredā€ as part of the decision for when to show the message, but in theory, it would not only show it over and over again (far from an ideal user experience), but it would also show the message to people outside the EU.

OK, I finally managed to successfully get the consent form showing up in my Android app! Here are some observations which I think are worth mentioning again:

(1) a) For Android I had to use ā€˜adb logcatā€™ to find the debug test device ID to use for testDeviceIdentifiers:

e.g.

12-14 18:01:18.314 13306 13448 I UserMessagingPlatform: Use new ConsentDebugSettings.Builder().addTestDeviceHashedId("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") to set this as a debug device.

Originally I thought it was the value shown in the ā€˜adb devicesā€™ command but thatā€™s a different value.

b) For iOS, I need to check the console for this line:

[Device] <UMP SDK> To enable debug mode for this device, set: UMPDebugSettings.testDeviceIdentifiers = @[ @"<xxxxxxxxxxxxxx" ];

This is not the Apple UDID for your device.

(2) If you have an ad blocker enabled on your router such as Pi Hole, turn it off, because it will also block the consent form! I know this sounds obvious, but Iā€™m dumb and I kept getting ā€œformStatus = unavailableā€ and got no consent form until I disabled my Pi Hole.

I also have a couple of questions:

  1. Whatā€™s a good example message to use in the consent form, other than the default "YOUR_APP asks for your consent to use your private data to:", which sounds a little shady.

  2. Can I keep the ā€˜debugā€™ parameters for geography=ā€˜EEAā€™ and testDeviceIdentifiers in my updateConsentForm() call when I upload the final version to the store? Just want to make sure.

1 Like

This is the consent state I had initially:
consentStatus: unknown

After I set the test device ID and EEA region, I got:
consentStatus: required (form shows up)

Upon subsequent launches of the app, the form still showed up, and:
consentStatus: obtained

I think as @umalemon said, we should add an additional condition with consentStatus so that the form only shows up once:

if (formStatus == "available" and consentStatus == "required") then
    admob.loadConsentForm()
end
1 Like

Finally, I implemented this on a different game. Thank you for your code, this is what my code looks like now.

if event.phase == "hidden" and event.type == "ump" then
        local formStatus, consentStatus = admob.getConsentFormStatus()

        if (formStatus == "available" and consentStatus == "obtained") then
            adProvider.loadAds()

        end

    elseif event.phase == "refreshed" and event.type == "ump" then
        local formStatus, consentStatus = admob.getConsentFormStatus()
        if (formStatus == "available" and consentStatus == "required") then
            admob.loadConsentForm()

        else 

            adProvider.loadAds()

        end

Thank you.
I have succeeded in displaying the consent form.
However, when the form is closed by tapping the button, the adListener does not return event.type==ā€œumpā€,event.phase==ā€œhiddenā€.

This symptom only occurs on android device.
ios device have no problems.
Does anyone else have the same symptoms?

[development environment]
solar2d ver : 2023.3699
device : Xperia 10 iii lite
android os ver : 12

1 Like