c15t has no Google Maps helper. This guide puts a Google Maps iframe inside each
framework's ConsentGate, or uses data-category with the HTML script tag. The
example uses the functionality category, but you can choose a different
category. Until that category has consent, the page has no iframe that loads a
Google Maps URL, so the browser does not connect to Google. If the visitor
withdraws consent, ConsentGate removes the iframe. With data-category, c15t
moves the URL from src to data-src.
Configure the map
Copy the map's iframe embed URL. Choose the category matching its use in your
application; this example uses functionality permission.
Replace the example URL with the complete embed URL for your map. Keep the
address and a directions link outside the consent-gated embed.
Add the embed to your framework
Create src/embed-config.ts using the configuration on this page, then select
your framework. Keep the existing consent setup, its policy
and preferences UI. These examples do not create a second consent provider.
Render this component inside your existing consent boundary or provider.
ConsentGate keeps the iframe absent while permission is denied and removes it
on revocation. Keep your existing consent styles and preferences dialog.
Browser helper for Astro and JavaScript
Only the Astro and JavaScript examples need this helper. It creates the iframe
when permission allows it, keeps an existing player mounted across unrelated
snapshot updates, and removes it on revocation.
Keep a transcript, address or other useful alternative outside the embed.
loading="lazy" is a performance hint; the consent condition controls whether
the iframe exists at all. A denied category may be fixed by policy, so opening
preferences does not guarantee that the visitor can grant it.
Gate existing iframe markup
For markup that uses data-category and data-src, the
createIframeBlocker module from c15t/modules/iframe-blocker promotes
data-src only when the category has consent and the URL resolves to HTTP or
HTTPS. Relative URLs resolve against the iframe document's base URL.
Malformed URLs and other schemes, including javascript:, data: and blob:,
remain in data-src without loading. Correct the URL and call
processAllIframes() to retry.
Keep the initial URL in data-src, without src, so the browser cannot load
it before the blocker runs. The module does not sanitize arbitrary HTML or
modify iframes without data-category.
Verify before and after permission
On a fresh opt-in session, inspect Network and confirm the iframe has not
requested the map. Grant the category and confirm the map mounts. Revoke it and
check the frame returns to its blocked state. Keep useful fallback information,
such as the address and directions link, available outside the map.
For a JavaScript Maps SDK instead of an iframe, register a category-gated script
and manage the widget's cleanup. Do not use this iframe recipe as evidence that
an independently loaded Maps SDK is blocked.
Type a c15t docs term like Next.js, CookieBanner, or Google Tag Manager.Type a c15t docs term like Next.js, CookieBanner, or Google Tag Manager.Type a c15t docs term like Next.js, CookieBanner, or Google Tag Manager.
Render this component inside your existing consent boundary or provider.
The first mount waits for the page's module scripts, including c15t's boot
script. Later ClientRouter mounts reuse the existing runtime. Removing the
component unsubscribes and removes the iframe. Do not create another consent
runtime for this embed.
Render this component inside the existing ConsentProvider.
The provider from your quickstart supplies its consent state.
The Svelte ConsentGate waits until the browser is mounted and the category is
allowed. Its default placeholder opens preferences. Revocation removes the
iframe.
Render this component inside the existing ConsentRoot.
Keep the SvelteKit root and its server-resolved state unchanged.
The Svelte ConsentGate waits until the browser is mounted and the category is
allowed. Its default placeholder opens preferences. Revocation removes the
iframe.
The c15t script tag gates iframes that name a category. Put the embed's URL
in data-src instead of src. Replace EMBED_URL, EMBED_CATEGORY and
EMBED_TITLE with embedURL, embedCategory and embedTitle from the
configuration on this page:
c15t sets src once the category is allowed and removes it on revocation.
Without src the iframe loads nothing, so hide it with CSS and show a link
to #c15t-preferences in its place. See
HTML embeds.
Use the shared browser helper below with your existing client. Put an
empty container where the embed should appear:
consent is the client from init() in your quickstart. With
createConsentRuntime, pass runtime.kernel and your own function that
opens preferences. Call disposeEmbed() when the page or component is
destroyed. Iframe markup with data-src and data-category also works
without the helper, because both setups gate iframes by default.