Hi HamsterSY,
Thank you for getting back to us.
To collect user consent you will have to create the GDPR message in the AdMob UI, which is a prerequisite to collect the user consent. Kindly refer to this article for more information on How to create GDPR message.
![]() |
Mobile Ads SDK Team |
Hi,
Thank you for getting back to us.
Can you please paste the below code in your script and let us know whether you are facing any issue while loading the consent form and kindly share app ID for further investigation.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Ump;
using GoogleMobileAds.Ump.Api;
public class GDPRScript : MonoBehaviour
{
ConsentForm _consentForm;
// Start is called before the first frame update
void Start()
{
var debugSettings = new ConsentDebugSettings
{
// Geography appears as in EEA for debug devices.
DebugGeography = DebugGeography.EEA,
TestDeviceHashedIds = new List<string>
{
"TEST - DEVICE- ID"
}
};
// Here false means users are not under age.
ConsentRequestParameters request = new ConsentRequestParameters
{
TagForUnderAgeOfConsent = false,
ConsentDebugSettings = debugSettings,
};
// Check the current consent information status.
ConsentInformation.Update(request, OnConsentInfoUpdated);
}
void OnConsentInfoUpdated(FormError error)
{
if (error != null)
{
// Handle the error.
UnityEngine.Debug.LogError(error);
return;
}
if (ConsentInformation.IsConsentFormAvailable())
{
LoadConsentForm();
}
// If the error is null, the consent information state was updated.
// You are now ready to check if a form is available.
}
void LoadConsentForm()
{
// Loads a consent form.
ConsentForm.Load(OnLoadConsentForm);
}
void OnLoadConsentForm(ConsentForm consentForm, FormError error)
{
if (error != null)
{
// Handle the error.
UnityEngine.Debug.LogError(error);
return;
}
// The consent form was loaded.
// Save the consent form for future requests.
_consentForm = consentForm;
// You are now ready to show the form.
if (ConsentInformation.ConsentStatus == ConsentStatus.Required)
{
_consentForm.Show(OnShowForm);
}
}
void OnShowForm(FormError error)
{
if (error != null)
{
// Handle the error.
UnityEngine.Debug.LogError(error);
return;
}
// Handle dismissal by reloading form.
LoadConsentForm();
}
// Update is called once per frame
void Update()
{
Hi HamsterSY,
Hi HamsterSY,
Thank you for getting back to us.
I will check with our team regarding your query and one of my team members will reach out to you once we have an update on this. Meanwhile, your patience is highly appreciated.
Hi there,
Hi there,
Hey HamsterSY,
Hello,
The gdpr is set to 1 because GDPR applies. The value will be 1 whether you consent or do not consent. gdpr_consent is the GDPR consent parameter. It appears to be working as intended. Ad Inspector also appears to be working as intended.
To answer your original questions:
1.) I believe the reason you aren't seeing any ads, though, is that in addition to providing purposes consent (the first screen that you see when clicking "Manage Options") you also need to provide vendor consent (scroll to bottom of purposes page -> click "Vendor preferences"). Both purposes consent and vendor consent are required for any vendor (for example, Google) to work properly/show ads.
2.) You can re-show consent again by using the privacy options APIs. See our Privacy options section for information.
Thanks,
Justin