@c15t/react 2.0.4 → 2.2.0-canary-20260727202135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +155 -0
- package/README.md +29 -14
- package/client/components/integrations.js +3 -0
- package/dist/components/consent-banner/atoms/overlay.cjs +1 -1
- package/dist/components/consent-banner/atoms/root.cjs +1 -1
- package/dist/components/consent-banner/components.cjs +1 -1
- package/dist/components/consent-banner/consent-banner.cjs +1 -1
- package/dist/components/consent-banner/error-boundary.cjs +1 -1
- package/dist/components/consent-banner/index.cjs +1 -1
- package/dist/components/consent-banner/policy-actions.cjs +1 -1
- package/dist/components/consent-dialog/atoms/card.cjs +1 -1
- package/dist/components/consent-dialog/atoms/overlay.cjs +1 -1
- package/dist/components/consent-dialog/atoms/root.cjs +1 -1
- package/dist/components/consent-dialog/consent-dialog.cjs +1 -1
- package/dist/components/consent-dialog/index.cjs +1 -1
- package/dist/components/consent-dialog-link/index.cjs +1 -1
- package/dist/components/consent-dialog-trigger/atoms/button.cjs +1 -1
- package/dist/components/consent-dialog-trigger/atoms/button.js +1 -1
- package/dist/components/consent-dialog-trigger/atoms/icon.cjs +1 -1
- package/dist/components/consent-dialog-trigger/atoms/root.cjs +1 -1
- package/dist/components/consent-dialog-trigger/atoms/text.cjs +1 -1
- package/dist/components/consent-dialog-trigger/atoms/toolbar.cjs +1 -0
- package/dist/components/consent-dialog-trigger/atoms/toolbar.js +1 -0
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger-toolbar.cjs +1 -0
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger-toolbar.js +1 -0
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger.cjs +1 -1
- package/dist/components/consent-dialog-trigger/index.cjs +1 -1
- package/dist/components/consent-dialog-trigger/index.js +1 -1
- package/dist/components/consent-dialog-trigger/use-draggable.cjs +1 -1
- package/dist/components/consent-preferences-link/consent-preferences-link.cjs +1 -1
- package/dist/components/consent-preferences-link/index.cjs +1 -1
- package/dist/components/consent-widget/atoms/accordion.cjs +1 -1
- package/dist/components/consent-widget/atoms/button.cjs +1 -1
- package/dist/components/consent-widget/atoms/footer.cjs +1 -1
- package/dist/components/consent-widget/atoms/root.cjs +1 -1
- package/dist/components/consent-widget/consent-widget.cjs +1 -1
- package/dist/components/consent-widget/index.cjs +1 -1
- package/dist/components/consent-widget/policy-actions.cjs +1 -1
- package/dist/components/frame/atoms.cjs +1 -1
- package/dist/components/frame/atoms.js +1 -1
- package/dist/components/frame/frame.cjs +1 -1
- package/dist/components/frame/index.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/button-group.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/card.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/description.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/footer.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/header.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/overlay.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/root.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/title.cjs +1 -1
- package/dist/components/iab-consent-banner/iab-consent-banner.cjs +1 -1
- package/dist/components/iab-consent-banner/iab-consent-banner.js +1 -1
- package/dist/components/iab-consent-banner/index.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/card.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/content.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/footer.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/header.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/overlay.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/purpose-item.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/root.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/stack-item.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/tabs.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/vendor-list.cjs +1 -1
- package/dist/components/iab-consent-dialog/hooks/use-gvl-data.cjs +1 -1
- package/dist/components/iab-consent-dialog/iab-consent-dialog.cjs +1 -1
- package/dist/components/iab-consent-dialog/index.cjs +1 -1
- package/dist/components/iab-consent-dialog/use-iab-translations.cjs +1 -1
- package/dist/components/integrations/google-map.cjs +1 -0
- package/dist/components/integrations/google-map.js +1 -0
- package/dist/components/integrations/index.cjs +1 -0
- package/dist/components/integrations/index.js +1 -0
- package/dist/components/integrations/shared.cjs +1 -0
- package/dist/components/integrations/shared.js +1 -0
- package/dist/components/integrations/youtube-embed.cjs +1 -0
- package/dist/components/integrations/youtube-embed.js +1 -0
- package/dist/components/shared/libs/recursive-clone-children.cjs +1 -1
- package/dist/components/shared/libs/slot.cjs +1 -1
- package/dist/components/shared/libs/use-controllable-state.cjs +1 -1
- package/dist/components/shared/policy-actions.cjs +1 -1
- package/dist/components/shared/primitives/box.cjs +1 -1
- package/dist/components/shared/primitives/button.cjs +1 -1
- package/dist/components/shared/primitives/button.js +1 -1
- package/dist/components/shared/primitives/legal-links/index.cjs +1 -1
- package/dist/components/shared/primitives/legal-links/index.js +1 -1
- package/dist/components/shared/ui/accordion/accordion.cjs +1 -1
- package/dist/components/shared/ui/accordion/index.cjs +1 -1
- package/dist/components/shared/ui/animated-collapse/animated-collapse.cjs +1 -1
- package/dist/components/shared/ui/animated-collapse/index.cjs +1 -1
- package/dist/components/shared/ui/branding.cjs +1 -1
- package/dist/components/shared/ui/button/button.cjs +1 -1
- package/dist/components/shared/ui/button/index.cjs +1 -1
- package/dist/components/shared/ui/collapsible/collapsible.cjs +1 -1
- package/dist/components/shared/ui/collapsible/index.cjs +1 -1
- package/dist/components/shared/ui/dialog/dialog.cjs +1 -1
- package/dist/components/shared/ui/dialog/index.cjs +1 -1
- package/dist/components/shared/ui/icon.cjs +1 -1
- package/dist/components/shared/ui/logo.cjs +1 -1
- package/dist/components/shared/ui/preference-item/index.cjs +1 -1
- package/dist/components/shared/ui/preference-item/preference-item.cjs +1 -1
- package/dist/components/shared/ui/switch/index.cjs +1 -1
- package/dist/components/shared/ui/switch/switch.cjs +1 -1
- package/dist/components/shared/ui/tabs/index.cjs +1 -1
- package/dist/components/shared/ui/tabs/tabs.cjs +1 -1
- package/dist/context/consent-manager-context.cjs +1 -1
- package/dist/context/consent-tracking-context.cjs +1 -1
- package/dist/context/theme-context.cjs +1 -1
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/use-color-scheme.cjs +1 -1
- package/dist/hooks/use-component-config.cjs +1 -1
- package/dist/hooks/use-consent-dialog-trigger.cjs +1 -1
- package/dist/hooks/use-consent-manager.cjs +1 -1
- package/dist/hooks/use-consent-script.cjs +1 -0
- package/dist/hooks/use-consent-script.js +1 -0
- package/dist/hooks/use-focus-trap.cjs +1 -1
- package/dist/hooks/use-headless-consent-ui.cjs +1 -1
- package/dist/hooks/use-headless-iab-consent-ui.cjs +1 -1
- package/dist/hooks/use-reduced-motion.cjs +1 -1
- package/dist/hooks/use-scroll-lock.cjs +1 -1
- package/dist/hooks/use-ssr-status.cjs +1 -1
- package/dist/hooks/use-styles.cjs +1 -1
- package/dist/hooks/use-text-direction.cjs +1 -1
- package/dist/hooks/use-theme.cjs +1 -1
- package/dist/hooks/use-translations.cjs +1 -1
- package/dist/iab.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/primitives/accordion.cjs +1 -1
- package/dist/primitives/button.cjs +1 -1
- package/dist/primitives/collapsible.cjs +1 -1
- package/dist/primitives/dialog.cjs +1 -1
- package/dist/primitives/preference-item.cjs +1 -1
- package/dist/primitives/switch.cjs +1 -1
- package/dist/primitives/tabs.cjs +1 -1
- package/dist/primitives.cjs +1 -1
- package/dist/providers/consent-manager-provider.cjs +1 -1
- package/dist/server/fetch-ssr-data.cjs +1 -1
- package/dist/server/fetch-ssr-data.js +1 -1
- package/dist/server/headers.cjs +1 -1
- package/dist/server/headers.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/init-cache-key.cjs +1 -1
- package/dist/server/normalize-url.cjs +1 -1
- package/dist/styles.tw3.css +1 -1
- package/dist/types/theme/index.cjs +1 -1
- package/dist/types/theme/style-types.cjs +1 -1
- package/dist/utils/cn.cjs +1 -1
- package/dist/utils/merge-styles.cjs +1 -1
- package/dist/utils/test-helpers.cjs +1 -1
- package/dist/utils/theme-utils.cjs +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist-types/components/consent-banner/components.d.ts +2 -2
- package/dist-types/components/consent-banner/policy-actions.d.ts +1 -1
- package/dist-types/components/consent-dialog/atoms/card.d.ts +5 -5
- package/dist-types/components/consent-dialog-trigger/atoms/toolbar.d.ts +22 -0
- package/dist-types/components/consent-dialog-trigger/consent-dialog-trigger-toolbar.d.ts +35 -0
- package/dist-types/components/consent-dialog-trigger/index.d.ts +2 -1
- package/dist-types/components/consent-dialog-trigger/types.d.ts +111 -6
- package/dist-types/components/consent-widget/atoms/accordion.d.ts +4 -4
- package/dist-types/components/consent-widget/consent-widget.d.ts +1 -1
- package/dist-types/components/consent-widget/policy-actions.d.ts +1 -1
- package/dist-types/components/integrations/google-map.d.ts +82 -0
- package/dist-types/components/integrations/index.d.ts +2 -0
- package/dist-types/components/integrations/shared.d.ts +12 -0
- package/dist-types/components/integrations/youtube-embed.d.ts +95 -0
- package/dist-types/components/shared/policy-actions.d.ts +1 -1
- package/dist-types/components/shared/primitives/button.d.ts +36 -2
- package/dist-types/components/shared/primitives/legal-links/index.d.ts +1 -1
- package/dist-types/components/shared/ui/accordion/accordion.d.ts +2 -2
- package/dist-types/components/shared/ui/branding.d.ts +3 -3
- package/dist-types/components/shared/ui/button/button.d.ts +1 -1
- package/dist-types/components/shared/ui/dialog/dialog.d.ts +1 -1
- package/dist-types/components/shared/ui/logo.d.ts +8 -8
- package/dist-types/headless.d.ts +1 -0
- package/dist-types/hooks/index.d.ts +1 -0
- package/dist-types/hooks/use-consent-script.d.ts +80 -0
- package/dist-types/index.d.ts +3 -1
- package/dist-types/providers/consent-manager-provider.d.ts +1 -1
- package/dist-types/server/headers.d.ts +1 -1
- package/dist-types/utils/theme-utils.d.ts +1 -1
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +155 -76
- package/docs/{building-headless-components.md → frameworks/react/building-headless-components.md} +3 -1
- package/docs/{callbacks.md → frameworks/react/callbacks.md} +3 -1
- package/docs/{components → frameworks/react/components}/consent-banner.md +10 -21
- package/docs/{components → frameworks/react/components}/consent-dialog-link.md +8 -5
- package/docs/frameworks/react/components/consent-dialog-trigger.md +202 -0
- package/docs/{components → frameworks/react/components}/consent-dialog.md +7 -15
- package/docs/frameworks/react/components/consent-manager-provider.md +228 -0
- package/docs/{components → frameworks/react/components}/consent-widget.md +8 -6
- package/docs/{components → frameworks/react/components}/dev-tools.md +9 -6
- package/docs/{components → frameworks/react/components}/frame.md +8 -9
- package/docs/{concepts → frameworks/react/concepts}/client-modes.md +4 -2
- package/docs/{concepts → frameworks/react/concepts}/consent-categories.md +1 -0
- package/docs/{concepts → frameworks/react/concepts}/consent-models.md +1 -0
- package/docs/{concepts → frameworks/react/concepts}/cookie-management.md +3 -3
- package/docs/{concepts → frameworks/react/concepts}/glossary.md +1 -0
- package/docs/{concepts → frameworks/react/concepts}/initialization-flow.md +1 -0
- package/docs/{concepts → frameworks/react/concepts}/policy-packs.md +1 -0
- package/docs/{headless.md → frameworks/react/headless.md} +3 -1
- package/docs/{hooks → frameworks/react/hooks}/use-color-scheme.md +1 -0
- package/docs/{hooks → frameworks/react/hooks}/use-consent-manager/checking-consent.md +3 -1
- package/docs/{hooks → frameworks/react/hooks}/use-consent-manager/location-info.md +3 -1
- package/docs/frameworks/react/hooks/use-consent-manager/overview.md +172 -0
- package/docs/{hooks → frameworks/react/hooks}/use-consent-manager/setting-consent.md +3 -1
- package/docs/{hooks → frameworks/react/hooks}/use-draggable.md +3 -1
- package/docs/{hooks → frameworks/react/hooks}/use-focus-trap.md +1 -0
- package/docs/{hooks → frameworks/react/hooks}/use-reduced-motion.md +3 -1
- package/docs/{hooks → frameworks/react/hooks}/use-ssr-status.md +6 -5
- package/docs/{hooks → frameworks/react/hooks}/use-text-direction.md +1 -0
- package/docs/frameworks/react/hooks/use-translations.md +55 -0
- package/docs/{iab → frameworks/react/iab}/consent-banner.md +9 -12
- package/docs/{iab → frameworks/react/iab}/consent-dialog.md +9 -14
- package/docs/{iab → frameworks/react/iab}/overview.md +4 -2
- package/docs/{iab → frameworks/react/iab}/use-gvl-data.md +3 -2
- package/docs/{iframe-blocking.md → frameworks/react/iframe-blocking.md} +8 -9
- package/docs/{internationalization.md → frameworks/react/internationalization.md} +13 -3
- package/docs/{network-blocker.md → frameworks/react/network-blocker.md} +13 -51
- package/docs/{optimization.md → frameworks/react/optimization.md} +3 -2
- package/docs/{policy-packs.md → frameworks/react/policy-packs.md} +3 -1
- package/docs/{quickstart.md → frameworks/react/quickstart.md} +26 -42
- package/docs/frameworks/react/script-loader.md +553 -0
- package/docs/{server-side.md → frameworks/react/server-side.md} +9 -4
- package/docs/{styling → frameworks/react/styling}/classnames.md +3 -1
- package/docs/{styling → frameworks/react/styling}/color-scheme.md +3 -1
- package/docs/frameworks/react/styling/css-variables.md +53 -0
- package/docs/frameworks/react/styling/overview.md +302 -0
- package/docs/frameworks/react/styling/slots.md +94 -0
- package/docs/{styling → frameworks/react/styling}/tailwind.md +3 -1
- package/docs/frameworks/react/styling/tokens.md +156 -0
- package/docs/{troubleshooting.md → frameworks/react/troubleshooting.md} +3 -1
- package/docs/integrations/adobe-analytics.md +160 -0
- package/docs/integrations/ahrefs-analytics.md +157 -0
- package/docs/integrations/amplitude.md +230 -0
- package/docs/integrations/building-integrations.md +15 -181
- package/docs/integrations/clearbit.md +130 -0
- package/docs/integrations/cloudflare-web-analytics.md +126 -0
- package/docs/integrations/crisp.md +140 -0
- package/docs/integrations/databuddy.md +152 -150
- package/docs/integrations/fathom-analytics.md +150 -0
- package/docs/integrations/google-maps.md +263 -0
- package/docs/integrations/google-tag-manager.md +102 -101
- package/docs/integrations/google-tag.md +104 -92
- package/docs/integrations/heap.md +219 -0
- package/docs/integrations/hightouch.md +199 -0
- package/docs/integrations/hotjar.md +143 -0
- package/docs/integrations/intercom.md +144 -0
- package/docs/integrations/linkedin-insights.md +142 -90
- package/docs/integrations/logrocket.md +175 -0
- package/docs/integrations/matomo-analytics.md +171 -0
- package/docs/integrations/meta-pixel.md +379 -309
- package/docs/integrations/microsoft-clarity.md +173 -0
- package/docs/integrations/microsoft-uet.md +135 -91
- package/docs/integrations/mixpanel-analytics.md +130 -0
- package/docs/integrations/overview.md +119 -75
- package/docs/integrations/pirsch.md +142 -0
- package/docs/integrations/plausible-analytics.md +154 -0
- package/docs/integrations/posthog.md +186 -127
- package/docs/integrations/promptwatch.md +121 -0
- package/docs/integrations/reddit-pixel.md +241 -0
- package/docs/integrations/rudderstack.md +271 -0
- package/docs/integrations/rybbit-analytics.md +143 -0
- package/docs/integrations/segment.md +146 -0
- package/docs/integrations/snapchat-pixel.md +163 -0
- package/docs/integrations/tiktok-pixel.md +101 -91
- package/docs/integrations/umami-analytics.md +148 -0
- package/docs/integrations/vercel-analytics.md +141 -0
- package/docs/integrations/x-pixel.md +123 -109
- package/docs/integrations/youtube.md +193 -0
- package/docs/shared/concepts/client-modes.md +103 -0
- package/docs/shared/concepts/consent-categories.md +41 -0
- package/docs/shared/concepts/consent-models.md +72 -0
- package/docs/shared/concepts/cookie-management.md +88 -0
- package/docs/shared/concepts/glossary.md +24 -0
- package/docs/shared/concepts/initialization-flow.md +105 -0
- package/docs/shared/concepts/policy-packs.md +225 -0
- package/docs/shared/react/components/consent-banner.md +242 -0
- package/docs/shared/react/components/consent-dialog-link.md +45 -0
- package/docs/shared/react/components/consent-dialog-trigger.md +185 -0
- package/docs/shared/react/components/consent-dialog.md +119 -0
- package/docs/shared/react/components/consent-manager-provider.md +183 -0
- package/docs/shared/react/components/consent-widget.md +121 -0
- package/docs/shared/react/components/dev-tools.md +81 -0
- package/docs/shared/react/components/frame.md +52 -0
- package/docs/shared/react/guides/building-headless-components.md +110 -0
- package/docs/shared/react/guides/callbacks.md +89 -0
- package/docs/shared/react/guides/headless.md +31 -0
- package/docs/shared/react/guides/iframe-blocking.md +65 -0
- package/docs/shared/react/guides/internationalization.md +123 -0
- package/docs/shared/react/guides/network-blocker.md +72 -0
- package/docs/shared/react/guides/optimization.md +44 -0
- package/docs/shared/react/guides/policy-packs.md +173 -0
- package/docs/shared/react/guides/script-loader.md +309 -0
- package/docs/shared/react/hooks/use-color-scheme.md +31 -0
- package/docs/shared/react/hooks/use-consent-manager/checking-consent.md +95 -0
- package/docs/shared/react/hooks/use-consent-manager/location-info.md +96 -0
- package/docs/shared/react/hooks/use-consent-manager/overview.md +74 -0
- package/docs/shared/react/hooks/use-consent-manager/setting-consent.md +93 -0
- package/docs/shared/react/hooks/use-draggable.md +30 -0
- package/docs/shared/react/hooks/use-focus-trap.md +20 -0
- package/docs/shared/react/hooks/use-reduced-motion.md +33 -0
- package/docs/shared/react/hooks/use-ssr-status.md +16 -0
- package/docs/shared/react/hooks/use-text-direction.md +38 -0
- package/docs/shared/react/hooks/use-translations.md +15 -0
- package/docs/shared/react/iab/consent-banner.md +60 -0
- package/docs/shared/react/iab/consent-dialog.md +76 -0
- package/docs/shared/react/iab/overview.md +80 -0
- package/docs/shared/react/iab/use-gvl-data.md +21 -0
- package/docs/shared/react/styling/classnames.md +93 -0
- package/docs/shared/react/styling/color-scheme.md +35 -0
- package/docs/shared/react/styling/css-variables.md +53 -0
- package/docs/shared/react/styling/overview.md +261 -0
- package/docs/shared/react/styling/slots.md +93 -0
- package/docs/shared/react/styling/stylesheet-entrypoint.md +8 -0
- package/docs/shared/react/styling/tailwind.md +88 -0
- package/docs/shared/react/styling/tokens.md +155 -0
- package/docs/shared/troubleshooting.md +82 -0
- package/package.json +23 -12
- package/readme.json +12 -7
- package/docs/ai-agents.md +0 -111
- package/docs/components/consent-dialog-trigger.md +0 -103
- package/docs/components/consent-manager-provider.md +0 -425
- package/docs/hooks/use-consent-manager/overview.md +0 -420
- package/docs/hooks/use-translations.md +0 -118
- package/docs/script-loader.md +0 -321
- package/docs/styling/css-variables.md +0 -92
- package/docs/styling/overview.md +0 -460
- package/docs/styling/slots.md +0 -128
- package/docs/styling/tokens.md +0 -216
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Google Maps
|
|
3
|
+
description: Render Google Maps only after consent with one shared Maps
|
|
4
|
+
JavaScript API loader and independently managed map instances.
|
|
5
|
+
icon: google-maps
|
|
6
|
+
group: integrations
|
|
7
|
+
---
|
|
8
|
+
`GoogleMap` is a renderable integration for React and Next.js. It keeps the
|
|
9
|
+
Google Maps JavaScript API off the page until the configured consent category is
|
|
10
|
+
allowed, then loads the SDK once and creates a map for each mounted component.
|
|
11
|
+
|
|
12
|
+
Unlike the helpers from `@c15t/scripts`, `GoogleMap` owns both the consent-aware
|
|
13
|
+
script lifecycle and the visible map container.
|
|
14
|
+
|
|
15
|
+
> ℹ️ **Info:**
|
|
16
|
+
> The browser must receive a Google Maps API key, so the key is visible to site visitors. Keep it out of source control, use a key created for browser use, and restrict it by website and API in Google Cloud.
|
|
17
|
+
|
|
18
|
+
## Integrate with c15t
|
|
19
|
+
|
|
20
|
+
`GoogleMap` must render inside a `ConsentManagerProvider`. Complete the
|
|
21
|
+
[React quickstart](/docs/frameworks/react/quickstart) or
|
|
22
|
+
[Next.js quickstart](/docs/frameworks/next/quickstart) first.
|
|
23
|
+
|
|
24
|
+
**React**
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { GoogleMap } from '@c15t/react';
|
|
28
|
+
|
|
29
|
+
const apiKey = import.meta.env.VITE_GOOGLE_MAPS_API_KEY;
|
|
30
|
+
|
|
31
|
+
export function StoreMap() {
|
|
32
|
+
if (!apiKey) {
|
|
33
|
+
return <p>Google Maps is not configured.</p>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<GoogleMap
|
|
38
|
+
apiKey={apiKey}
|
|
39
|
+
authReferrerPolicy="origin"
|
|
40
|
+
center={{ lat: 40.7128, lng: -74.006 }}
|
|
41
|
+
consentCategory="measurement"
|
|
42
|
+
style={{ height: 400 }}
|
|
43
|
+
zoom={12}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Next.js**
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
'use client';
|
|
53
|
+
|
|
54
|
+
import { GoogleMap } from '@c15t/nextjs';
|
|
55
|
+
|
|
56
|
+
const apiKey = process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY;
|
|
57
|
+
|
|
58
|
+
export function StoreMap() {
|
|
59
|
+
if (!apiKey) {
|
|
60
|
+
return <p>Google Maps is not configured.</p>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<GoogleMap
|
|
65
|
+
apiKey={apiKey}
|
|
66
|
+
authReferrerPolicy="origin"
|
|
67
|
+
center={{ lat: 40.7128, lng: -74.006 }}
|
|
68
|
+
consentCategory="measurement"
|
|
69
|
+
style={{ height: 400 }}
|
|
70
|
+
zoom={12}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`measurement` is a common choice for an interactive map, but the correct
|
|
77
|
+
category depends on why your application uses Google Maps and the policy shown
|
|
78
|
+
to your users.
|
|
79
|
+
|
|
80
|
+
## How c15t loads it
|
|
81
|
+
|
|
82
|
+
* **Before consent:** no Maps JavaScript API script is requested and no map
|
|
83
|
+
instance is created.
|
|
84
|
+
* **After consent:** c15t registers one shared SDK loader and waits for Google's
|
|
85
|
+
callback before constructing the map.
|
|
86
|
+
* **Multiple maps:** components with the same `scriptId` reuse the SDK while
|
|
87
|
+
keeping separate map instances.
|
|
88
|
+
* **On revocation or unmount:** the component clears the map instance and its
|
|
89
|
+
listeners. The page-level SDK registration is retained after its first load
|
|
90
|
+
because Google supports one loader per page.
|
|
91
|
+
* **Existing SDK:** if another part of the application already loaded a
|
|
92
|
+
compatible Google Maps global, the component adopts it instead of adding a
|
|
93
|
+
duplicate script.
|
|
94
|
+
* **Visible states:** the blocked, loading, and error states are accessible and
|
|
95
|
+
use the active c15t translations by default.
|
|
96
|
+
|
|
97
|
+
Keep one `scriptId` and one loader configuration across the page. Override the
|
|
98
|
+
default `scriptId` only to coordinate with a known c15t script registration, not
|
|
99
|
+
to load a second Maps SDK configuration. If two maps register conflicting
|
|
100
|
+
loader options, c15t reports the conflict and tells you to align the key,
|
|
101
|
+
language, region, libraries, and other loader options. A different `scriptId`
|
|
102
|
+
does not make a second Google loader safe.
|
|
103
|
+
|
|
104
|
+
## Configure the map
|
|
105
|
+
|
|
106
|
+
Pass `center`, `zoom`, `mapId`, and `options` as you would when constructing a
|
|
107
|
+
Google map:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
<GoogleMap
|
|
111
|
+
apiKey={apiKey}
|
|
112
|
+
center={{ lat: 51.5072, lng: -0.1276 }}
|
|
113
|
+
consentCategory="measurement"
|
|
114
|
+
mapId="YOUR_MAP_ID"
|
|
115
|
+
options={{
|
|
116
|
+
disableDefaultUI: true,
|
|
117
|
+
gestureHandling: 'cooperative',
|
|
118
|
+
}}
|
|
119
|
+
zoom={11}
|
|
120
|
+
/>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Changes to `center`, `zoom`, and updateable `options` are applied to the existing
|
|
124
|
+
map. Changing `mapId` recreates it because Google treats that value as
|
|
125
|
+
construction-time configuration.
|
|
126
|
+
|
|
127
|
+
The component has a default height of `320px`. Override `style.height` or apply
|
|
128
|
+
a class with an explicit height when your layout needs another size.
|
|
129
|
+
|
|
130
|
+
### Loader options
|
|
131
|
+
|
|
132
|
+
The direct Maps JavaScript API loader options are available as component props:
|
|
133
|
+
|
|
134
|
+
* `libraries`
|
|
135
|
+
* `language`
|
|
136
|
+
* `region`
|
|
137
|
+
* `version`
|
|
138
|
+
* `authReferrerPolicy`
|
|
139
|
+
* `mapIds`
|
|
140
|
+
* `channel`
|
|
141
|
+
* `solutionChannel`
|
|
142
|
+
* `nonce`
|
|
143
|
+
|
|
144
|
+
`mapIds` preloads map ID configuration; `mapId` selects the map ID for the
|
|
145
|
+
component instance.
|
|
146
|
+
|
|
147
|
+
## Handle loading and errors
|
|
148
|
+
|
|
149
|
+
The built-in loading and error states use `frame.loading` and `frame.error` from
|
|
150
|
+
your c15t messages. The consent placeholder uses the localized consent-type
|
|
151
|
+
title in both its message and button—for example, an `Analytics` title produces
|
|
152
|
+
“Enable Analytics consent.”
|
|
153
|
+
|
|
154
|
+
Use the fallback props when you need integration-specific content and `onError`
|
|
155
|
+
for reporting:
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
import { Frame, GoogleMap } from '@c15t/react';
|
|
159
|
+
|
|
160
|
+
function reportMapError(error: Error) {
|
|
161
|
+
// Send the error to your observability provider.
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
<GoogleMap
|
|
165
|
+
apiKey={apiKey}
|
|
166
|
+
center={{ lat: 40.7128, lng: -74.006 }}
|
|
167
|
+
consentCategory="measurement"
|
|
168
|
+
loadingFallback={<p>Loading map…</p>}
|
|
169
|
+
errorFallback={<p>The map could not be loaded.</p>}
|
|
170
|
+
onError={reportMapError}
|
|
171
|
+
placeholder={
|
|
172
|
+
<Frame.Root>
|
|
173
|
+
<Frame.Title>Allow measurement consent to view this map.</Frame.Title>
|
|
174
|
+
<Frame.Button category="measurement" />
|
|
175
|
+
</Frame.Root>
|
|
176
|
+
}
|
|
177
|
+
/>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
`onError` covers loader failures, timeouts, map-constructor failures, and
|
|
181
|
+
Google's global authentication failure callback. Authentication failures
|
|
182
|
+
usually indicate an invalid key, missing billing, a disabled API, or a referrer
|
|
183
|
+
that is not allowed.
|
|
184
|
+
|
|
185
|
+
If you provide a custom `placeholder`, include `Frame.Button` or another way to
|
|
186
|
+
reopen consent preferences or grant the required category.
|
|
187
|
+
|
|
188
|
+
### Retry a failed map
|
|
189
|
+
|
|
190
|
+
Increment `retryKey` to retry the same map after a loader, authentication, or
|
|
191
|
+
constructor failure:
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import { GoogleMap } from '@c15t/react';
|
|
195
|
+
import { useState } from 'react';
|
|
196
|
+
|
|
197
|
+
function RetryableMap({ apiKey }: { apiKey: string }) {
|
|
198
|
+
const [retryKey, setRetryKey] = useState(0);
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<>
|
|
202
|
+
<GoogleMap
|
|
203
|
+
apiKey={apiKey}
|
|
204
|
+
center={{ lat: 40.7128, lng: -74.006 }}
|
|
205
|
+
retryKey={retryKey}
|
|
206
|
+
/>
|
|
207
|
+
|
|
208
|
+
<button type="button" onClick={() => setRetryKey((key) => key + 1)}>
|
|
209
|
+
Retry map
|
|
210
|
+
</button>
|
|
211
|
+
</>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Changing `retryKey` clears the failed attempt and retries with the same
|
|
217
|
+
`scriptId`. A successful page-level SDK registration remains shared and is not
|
|
218
|
+
loaded again.
|
|
219
|
+
|
|
220
|
+
## Secure the browser key
|
|
221
|
+
|
|
222
|
+
For production:
|
|
223
|
+
|
|
224
|
+
1. Create a key specifically for the browser application.
|
|
225
|
+
2. Apply a **Websites** application restriction for every allowed development
|
|
226
|
+
and production origin.
|
|
227
|
+
3. Restrict the key to the **Maps JavaScript API** and any additional APIs used
|
|
228
|
+
by requested libraries.
|
|
229
|
+
4. Keep the value in an untracked environment file and expose it through the
|
|
230
|
+
browser environment variable required by your framework.
|
|
231
|
+
5. Monitor key usage and rotate the key if you see unexpected traffic.
|
|
232
|
+
|
|
233
|
+
When `authReferrerPolicy="origin"` is set, configure origin-level website
|
|
234
|
+
restrictions without URL paths.
|
|
235
|
+
|
|
236
|
+
* [Google Maps Platform security guidance](https://developers.google.com/maps/api-security-best-practices)
|
|
237
|
+
* [Maps JavaScript API loader options](https://developers.google.com/maps/documentation/javascript/load-maps-js-api)
|
|
238
|
+
* [Maps Demo Key for local prototypes](https://developers.google.com/maps/documentation/javascript/demo-key)
|
|
239
|
+
|
|
240
|
+
## Verify setup
|
|
241
|
+
|
|
242
|
+
1. Clear saved consent and reload the page.
|
|
243
|
+
2. Confirm no request to `maps.googleapis.com/maps/api/js` occurs before the
|
|
244
|
+
configured category is allowed.
|
|
245
|
+
3. Grant consent and confirm the map reaches its ready state.
|
|
246
|
+
4. Render two maps with the same `scriptId` and confirm only one loader script is
|
|
247
|
+
added.
|
|
248
|
+
5. Revoke consent and confirm each map instance is removed.
|
|
249
|
+
6. Test a rejected key or referrer and confirm `errorFallback` and `onError`
|
|
250
|
+
receive the failure.
|
|
251
|
+
7. Fix the rejected configuration, change `retryKey`, and confirm the map can
|
|
252
|
+
recover without changing `scriptId`.
|
|
253
|
+
|
|
254
|
+
## Types
|
|
255
|
+
|
|
256
|
+
### GoogleMapProps
|
|
257
|
+
|
|
258
|
+
|Property|Value|
|
|
259
|
+
|:--|:--|
|
|
260
|
+
|Type Name|\`GoogleMapProps\`|
|
|
261
|
+
|Source Path|\`./packages/react/src/components/integrations/google-map.tsx\`|
|
|
262
|
+
|
|
263
|
+
\*ExtractedTypeTable: Could not extract "GoogleMapProps" from "./packages/react/src/components/integrations/google-map.tsx" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
@@ -1,31 +1,104 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Google Tag Manager
|
|
3
|
-
description: Deploy and manage marketing tags centrally with automatic consent
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
description: Deploy and manage marketing tags centrally with automatic consent
|
|
4
|
+
state synchronization.
|
|
6
5
|
icon: google-tag-manager
|
|
6
|
+
group: integrations
|
|
7
7
|
---
|
|
8
8
|
Google Tag Manager (GTM) is Google's tag management system that lets you deploy and manage marketing tags, analytics scripts, and conversion pixels without modifying your codebase. Instead of hardcoding multiple scripts, you configure them through GTM's web interface.
|
|
9
9
|
|
|
10
|
-
c15t automatically injects the GTM script into your page and syncs consent state with GTM using Consent Mode v2.
|
|
10
|
+
c15t automatically injects the GTM script into your page and syncs consent state with GTM using Consent Mode v2. GTM manages its own internal consent state and only fires tags when appropriate consent is granted, which means it can safely load before consent is collected.
|
|
11
11
|
|
|
12
12
|
This prevents GTM-managed scripts from loading without proper consent while giving you centralized control over your marketing stack.
|
|
13
13
|
|
|
14
14
|
> ℹ️ **Info:**
|
|
15
15
|
> Use GTM if your team manages many tags centrally in the GTM UI. Use gtag.js if you only need GA4/Google Ads directly in code. Don't run both for the same destination unless intentional, or you may duplicate events.
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Integrate with c15t
|
|
18
|
+
|
|
19
|
+
Use your GTM container ID, which begins with `GTM-`.
|
|
20
|
+
|
|
21
|
+
**React**
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { type ReactNode } from 'react';
|
|
25
|
+
import { ConsentManagerProvider } from '@c15t/react';
|
|
26
|
+
import { googleTagManager } from '@c15t/scripts/google-tag-manager';
|
|
27
|
+
|
|
28
|
+
const scripts = [googleTagManager({ id: 'GTM-XXXXXXX' })];
|
|
29
|
+
|
|
30
|
+
export function ConsentProvider({ children }: { children: ReactNode }) {
|
|
31
|
+
return (
|
|
32
|
+
<ConsentManagerProvider
|
|
33
|
+
options={{
|
|
34
|
+
mode: 'hosted',
|
|
35
|
+
backendURL: 'https://your-instance.c15t.dev',
|
|
36
|
+
scripts,
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
</ConsentManagerProvider>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Next.js**
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
'use client';
|
|
49
|
+
|
|
50
|
+
import { type ReactNode } from 'react';
|
|
51
|
+
import { ConsentManagerProvider } from '@c15t/nextjs';
|
|
52
|
+
import { googleTagManager } from '@c15t/scripts/google-tag-manager';
|
|
53
|
+
|
|
54
|
+
const scripts = [googleTagManager({ id: 'GTM-XXXXXXX' })];
|
|
55
|
+
|
|
56
|
+
export function ConsentProvider({ children }: { children: ReactNode }) {
|
|
57
|
+
return (
|
|
58
|
+
<ConsentManagerProvider
|
|
59
|
+
options={{
|
|
60
|
+
mode: 'hosted',
|
|
61
|
+
backendURL: '/api/c15t',
|
|
62
|
+
scripts,
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
</ConsentManagerProvider>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**JavaScript**
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { getOrCreateConsentRuntime } from 'c15t';
|
|
75
|
+
import { googleTagManager } from '@c15t/scripts/google-tag-manager';
|
|
76
|
+
|
|
77
|
+
getOrCreateConsentRuntime({
|
|
78
|
+
mode: 'hosted',
|
|
79
|
+
backendURL: 'https://your-instance.c15t.dev',
|
|
80
|
+
scripts: [googleTagManager({ id: 'GTM-XXXXXXX' })],
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## How c15t loads it
|
|
85
|
+
|
|
86
|
+
* **Category:** `necessary` (Tag Managers)
|
|
87
|
+
* **Loads when:** [`alwaysLoad`](/docs/frameworks/react/script-loader#always-load) — runs on page start with Consent Mode v2 defaults set to denied
|
|
88
|
+
* **On consent change:** c15t pushes a Consent Mode v2 `update` to the data layer; GTM-managed tags re-evaluate against the new state
|
|
89
|
+
|
|
90
|
+
## Configure the integration
|
|
18
91
|
|
|
19
92
|
1. **Creating a Tag Manager Container**
|
|
20
93
|
|
|
21
|
-
>
|
|
22
|
-
>
|
|
94
|
+
> 📝 Note:
|
|
23
95
|
> This step is optional if you already have a Tag Manager container. Ensure your container has consent overview enabled.
|
|
24
96
|
|
|
25
97
|
After signing into Google Tag Manager, you can create a new container.
|
|
26
98
|
Continue to Google Tag Manager
|
|
27
99
|
|
|
28
|
-
In Tag Manager, click Admin > Container Settings.
|
|
100
|
+
1. In Tag Manager, click Admin > Container Settings.
|
|
101
|
+
2. Under Additional Settings, select "Enable consent overview".
|
|
29
102
|
|
|
30
103
|
Enable consent overview
|
|
31
104
|
|
|
@@ -37,25 +110,22 @@ This prevents GTM-managed scripts from loading without proper consent while givi
|
|
|
37
110
|
|
|
38
111
|
Create trigger
|
|
39
112
|
|
|
40
|
-
3. **
|
|
113
|
+
3. **Update tags** Now for your existing tags, you can add the "consent-update" trigger to the tag, this will fire the update event when the consent state is updated & it has the appropriate consent state.
|
|
41
114
|
|
|
42
115
|
Update tags
|
|
43
116
|
|
|
44
|
-
|
|
117
|
+
## Tracking events in your app
|
|
45
118
|
|
|
46
|
-
|
|
47
|
-
>
|
|
48
|
-
> See the integration overview for how to pass scripts to your framework (JavaScript, React, or Next.js).
|
|
119
|
+
GTM is `alwaysLoad: true`, so the GTM container and `window.dataLayer` are present from page start regardless of consent. Calls like `dataLayer.push({ event: 'signup' })` are **safe at any time** — Consent Mode v2 defaults are set to denied before the user makes a choice, and GTM-managed tags only fire when the matching consent has been granted.
|
|
49
120
|
|
|
50
|
-
|
|
51
|
-
|
|
121
|
+
```ts
|
|
122
|
+
window.dataLayer = window.dataLayer || [];
|
|
123
|
+
window.dataLayer.push({ event: 'signup' });
|
|
124
|
+
```
|
|
52
125
|
|
|
53
|
-
|
|
54
|
-
id: 'GTM-XXXXXXX',
|
|
55
|
-
})
|
|
56
|
-
```
|
|
126
|
+
You do not need to wrap `dataLayer.push(...)` in a `useConsentManager().has(...)` check — the consent gate happens inside GTM, not inside c15t.
|
|
57
127
|
|
|
58
|
-
##
|
|
128
|
+
## Verify setup
|
|
59
129
|
|
|
60
130
|
1. Open GTM Preview mode and confirm your container (`GTM-...`) loads on page load.
|
|
61
131
|
2. Before giving consent, confirm non-essential tags do not fire in GTM Preview.
|
|
@@ -67,87 +137,18 @@ This prevents GTM-managed scripts from loading without proper consent while givi
|
|
|
67
137
|
|
|
68
138
|
### GoogleTagManagerOptions
|
|
69
139
|
|
|
70
|
-
|Property|
|
|
71
|
-
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
140
|
+
|Property|Value|
|
|
141
|
+
|:--|:--|
|
|
142
|
+
|Type Name|\`GoogleTagManagerOptions\`|
|
|
143
|
+
|Source Path|\`./packages/scripts/src/vendors/tag-managers/google-tag-manager.ts\`|
|
|
144
|
+
|
|
145
|
+
\*ExtractedTypeTable: Could not extract "GoogleTagManagerOptions" from "./packages/scripts/src/vendors/tag-managers/google-tag-manager.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
75
146
|
|
|
76
147
|
### Script
|
|
77
148
|
|
|
78
|
-
|Property|
|
|
79
|
-
|
|
80
|
-
|
|
|
81
|
-
|src
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|callbackOnly|boolean \|undefined|Whether this is a callback-only script that doesn't need to load an external resource. When true, no script tag will be added to the DOM, only callbacks will be executed.|false|Optional|
|
|
85
|
-
|persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
|
|
86
|
-
|alwaysLoad|boolean \|undefined|Whether the script should always load regardless of consent state. This is useful for scripts like Google Tag Manager or PostHog that manage their own consent state internally. The script will load immediately and never be unloaded based on consent changes. Note: When using this option, you are responsible for ensuring the script itself respects user consent preferences through its own consent management.|false|Optional|
|
|
87
|
-
|fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
|
|
88
|
-
|attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
|
|
89
|
-
|async|boolean \|undefined|Whether to use async loading|-|Optional|
|
|
90
|
-
|defer|boolean \|undefined|Whether to defer script loading|-|Optional|
|
|
91
|
-
|nonce|string \|undefined|Content Security Policy nonce|-|Optional|
|
|
92
|
-
|anonymizeId|boolean \|undefined|Whether to use an anonymized ID for the script element, this helps ensure the script is not blocked by ad blockers|true|Optional|
|
|
93
|
-
|target|"head" \|"body" \|undefined|Where to inject the script element in the DOM. Options: \`'head'\`: Scripts are appended to \`\<head>\` (default); \`'body'\`: Scripts are appended to \`\<body>\`|'head'|Optional|
|
|
94
|
-
|onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
|
|
95
|
-
|onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
|
|
96
|
-
|onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
|
|
97
|
-
|onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
|
|
98
|
-
|vendorId|string \|number \|undefined|IAB TCF vendor ID - links script to a registered vendor. When in IAB mode, the script will only load if this vendor has consent. Takes precedence over \`category\` when in IAB mode. Use custom vendor IDs (string or number) to gate non-IAB vendors too.|-|Optional|
|
|
99
|
-
|iabPurposes|number\[] \|undefined|IAB TCF purpose IDs this script requires consent for. When in IAB mode and no vendorId is set, the script will only load if ALL specified purposes have consent.|-|Optional|
|
|
100
|
-
|iabLegIntPurposes|number\[] \|undefined|IAB TCF legitimate interest purpose IDs. These purposes can operate under legitimate interest instead of consent. The script loads if all iabPurposes have consent OR all iabLegIntPurposes have legitimate interest established.|-|Optional|
|
|
101
|
-
|iabSpecialFeatures|number\[] \|undefined|IAB TCF special feature IDs this script requires. Options: 1: Use precise geolocation data; 2: Actively scan device characteristics for identification|-|Optional|
|
|
102
|
-
|
|
103
|
-
#### `onBeforeLoad`
|
|
104
|
-
|
|
105
|
-
Callback executed before the script is loaded
|
|
106
|
-
|
|
107
|
-
|Property|Type|Description|Default|Required|
|
|
108
|
-
|:--|:--|:--|:--|:--:|
|
|
109
|
-
|id|string|The original script ID|-|✅ Required|
|
|
110
|
-
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
111
|
-
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
112
|
-
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
113
|
-
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
114
|
-
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
115
|
-
|
|
116
|
-
#### `onLoad`
|
|
117
|
-
|
|
118
|
-
Callback executed when the script loads successfully
|
|
119
|
-
|
|
120
|
-
|Property|Type|Description|Default|Required|
|
|
121
|
-
|:--|:--|:--|:--|:--:|
|
|
122
|
-
|id|string|The original script ID|-|✅ Required|
|
|
123
|
-
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
124
|
-
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
125
|
-
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
126
|
-
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
127
|
-
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
128
|
-
|
|
129
|
-
#### `onError`
|
|
130
|
-
|
|
131
|
-
Callback executed if the script fails to load
|
|
132
|
-
|
|
133
|
-
|Property|Type|Description|Default|Required|
|
|
134
|
-
|:--|:--|:--|:--|:--:|
|
|
135
|
-
|id|string|The original script ID|-|✅ Required|
|
|
136
|
-
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
137
|
-
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
138
|
-
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
139
|
-
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
140
|
-
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
141
|
-
|
|
142
|
-
#### `onConsentChange`
|
|
143
|
-
|
|
144
|
-
Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
|
|
145
|
-
|
|
146
|
-
|Property|Type|Description|Default|Required|
|
|
147
|
-
|:--|:--|:--|:--|:--:|
|
|
148
|
-
|id|string|The original script ID|-|✅ Required|
|
|
149
|
-
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
150
|
-
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
151
|
-
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
152
|
-
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
153
|
-
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
149
|
+
|Property|Value|
|
|
150
|
+
|:--|:--|
|
|
151
|
+
|Type Name|\`Script\`|
|
|
152
|
+
|Source Path|\`./packages/core/src/libs/script-loader/types.ts\`|
|
|
153
|
+
|
|
154
|
+
\*ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|