AdMob Consent & Privacy Options
Google's EU User Consent Policy requires a certified Consent Management Platform to gather consent before any ad is requested from users in the EEA and the UK. Appilix ships Google's own solution — the User Messaging Platform (UMP) — so this is handled automatically: the consent form is presented when the app starts, and ads are only requested once consent allows it.
Because the app handles gathering consent on its own, you do not need these bridge actions to collect consent. They exist for the one thing the app cannot do by itself: letting users review or withdraw their choice later from inside your website. Under TCF v2.2, withdrawing consent must be as easy as giving it, and in a webview app that entry point has to live on your pages.
For a general introduction to the JavaScript Bridge, see the Overview article.
How Consent Works Automatically
When the app launches, before any ad is loaded:
- The app refreshes the current consent information from Google.
- If a form is required, it is shown — the user cannot miss it.
- Ads initialize only when Google reports that ads may be requested.
Outside the EEA and UK no form ever appears, ads may be requested immediately, and none of this costs your users an extra tap. If the refresh fails — the device is offline, or the AdMob App ID is misconfigured — a decision stored on a previous run may still permit ads, so the app asks Google rather than assuming either way.
Checking the Consent Status
Use this to decide whether to render a "Privacy options" or "Manage consent" link on your page.
appilix.onmessage = function(event) {
const data = JSON.parse(event.data);
if (data.type !== "admob_consent_status") return;
appilix.onmessage = null; // Remove listener after handling
console.log(data.response);
// { consent_status, can_request_ads, privacy_options_required }
};
appilix.postMessage(JSON.stringify({
type: "admob_consent_status"
}));Response fields:
| Field | Description |
|---|---|
consent_status | notRequired, required, obtained or unknown — whether the consent flow still has to run. |
can_request_ads | true when ads may currently be requested. This is the field that reflects what the user actually chose. |
privacy_options_required | true when the user must be offered a way to change their choice. false outside the EEA/UK. |
Consent status values:
| Value | Meaning |
|---|---|
notRequired | The user is outside the EEA/UK, so no consent form is needed. |
required | Consent is required and has not been gathered yet. |
obtained | The flow has run and a choice is stored on the device. |
unknown | The status could not be determined — usually because the refresh failed. |
consent_status reports whether the flow still has to run — not what the user chose. Tapping "Do not consent" also leaves the status as obtained. Always read can_request_ads to find out whether ads are actually permitted.Showing the Privacy Options Form
This reopens Google's form so the user can change or withdraw their earlier choice.
appilix.postMessage(JSON.stringify({
type: "admob_show_privacy_options"
}));Response:
{
"type": "admob_show_privacy_options",
"response": "Privacy Options Form Displayed"
}The response confirms that the form was presented — it does not carry the user's new decision. Send admob_consent_status again afterwards if your page needs the updated state. Ads restart on their own if the user switches to consenting; no reload is required.
Complete Example
Render the link only when it is actually needed, so users outside the EEA/UK never see a dead option:
function setupPrivacyLink() {
if (typeof appilix === 'undefined') return; // only runs inside the app
appilix.onmessage = function(event) {
const data = JSON.parse(event.data);
if (data.type !== "admob_consent_status") return;
appilix.onmessage = null;
if (!data.response.privacy_options_required) return; // nothing to offer
const link = document.getElementById("privacy-options-link");
link.style.display = "block";
link.addEventListener("click", function () {
appilix.postMessage(JSON.stringify({
type: "admob_show_privacy_options"
}));
});
};
appilix.postMessage(JSON.stringify({
type: "admob_consent_status"
}));
}
document.addEventListener("DOMContentLoaded", setupPrivacyLink);Place the link wherever your users would look for it — a privacy or settings page, or your site footer.
Why Ads May Not Appear
If banner and interstitial ads never show for a user in the EEA or UK, check the consent state before suspecting your Ad Unit IDs. When a user declines, can_request_ads is false and the app deliberately requests no ads at all — this is correct behaviour, not a misconfiguration.
For Ad Unit and App ID setup, see the AdMob Ads article.