@simpleapps-com/augur-web 0.2.13 → 0.2.14
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/dist/gtm.cjs +142 -0
- package/dist/gtm.cjs.map +1 -0
- package/dist/gtm.d.cts +69 -0
- package/dist/gtm.d.ts +69 -0
- package/dist/gtm.js +142 -0
- package/dist/gtm.js.map +1 -0
- package/package.json +7 -2
package/dist/gtm.cjs
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
// src/gtm.tsx
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _react = require('react');
|
|
13
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
14
|
+
var GtmContext = _react.createContext.call(void 0, null);
|
|
15
|
+
function getDataLayer() {
|
|
16
|
+
if (typeof window === "undefined") return [];
|
|
17
|
+
if (!window.dataLayer) window.dataLayer = [];
|
|
18
|
+
return window.dataLayer;
|
|
19
|
+
}
|
|
20
|
+
function injectGtmScript(gtmId, strategy) {
|
|
21
|
+
if (typeof document === "undefined") return;
|
|
22
|
+
if (document.getElementById("gtm-script")) return;
|
|
23
|
+
const dataLayer = getDataLayer();
|
|
24
|
+
dataLayer.push({ "gtm.start": (/* @__PURE__ */ new Date()).getTime(), event: "gtm.js" });
|
|
25
|
+
const script = document.createElement("script");
|
|
26
|
+
script.id = "gtm-script";
|
|
27
|
+
script.src = `https://www.googletagmanager.com/gtm.js?id=${encodeURIComponent(gtmId)}`;
|
|
28
|
+
if (strategy === "lazyOnload") {
|
|
29
|
+
script.async = true;
|
|
30
|
+
script.defer = true;
|
|
31
|
+
} else if (strategy === "worker") {
|
|
32
|
+
script.type = "text/partytown";
|
|
33
|
+
script.async = true;
|
|
34
|
+
} else {
|
|
35
|
+
script.async = true;
|
|
36
|
+
}
|
|
37
|
+
document.head.appendChild(script);
|
|
38
|
+
}
|
|
39
|
+
function GtmProvider({
|
|
40
|
+
gtmId,
|
|
41
|
+
strategy = "afterInteractive",
|
|
42
|
+
consentRequired = false,
|
|
43
|
+
debug = false,
|
|
44
|
+
children
|
|
45
|
+
}) {
|
|
46
|
+
const [hasConsent, setHasConsent] = _react.useState.call(void 0, !consentRequired);
|
|
47
|
+
const [isLoaded, setIsLoaded] = _react.useState.call(void 0, false);
|
|
48
|
+
const injectedRef = _react.useRef.call(void 0, false);
|
|
49
|
+
const loadGtm = _react.useCallback.call(void 0, () => {
|
|
50
|
+
if (injectedRef.current) return;
|
|
51
|
+
injectedRef.current = true;
|
|
52
|
+
if (strategy === "lazyOnload" && typeof requestIdleCallback === "function") {
|
|
53
|
+
requestIdleCallback(() => {
|
|
54
|
+
injectGtmScript(gtmId, strategy);
|
|
55
|
+
setIsLoaded(true);
|
|
56
|
+
});
|
|
57
|
+
} else if (strategy === "afterInteractive") {
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
injectGtmScript(gtmId, strategy);
|
|
60
|
+
setIsLoaded(true);
|
|
61
|
+
}, 0);
|
|
62
|
+
} else {
|
|
63
|
+
injectGtmScript(gtmId, strategy);
|
|
64
|
+
setIsLoaded(true);
|
|
65
|
+
}
|
|
66
|
+
}, [gtmId, strategy]);
|
|
67
|
+
if (hasConsent && !injectedRef.current && typeof window !== "undefined") {
|
|
68
|
+
loadGtm();
|
|
69
|
+
}
|
|
70
|
+
const pushEvent = _react.useCallback.call(void 0,
|
|
71
|
+
(event, params) => {
|
|
72
|
+
const entry = { event, ...params };
|
|
73
|
+
if (debug) {
|
|
74
|
+
console.log("[GTM]", entry);
|
|
75
|
+
}
|
|
76
|
+
getDataLayer().push(entry);
|
|
77
|
+
},
|
|
78
|
+
[debug]
|
|
79
|
+
);
|
|
80
|
+
const pushEcommerceEvent = _react.useCallback.call(void 0,
|
|
81
|
+
(event, params) => {
|
|
82
|
+
getDataLayer().push({ ecommerce: null });
|
|
83
|
+
const entry = { event, ecommerce: params };
|
|
84
|
+
if (debug) {
|
|
85
|
+
console.log("[GTM ecommerce]", entry);
|
|
86
|
+
}
|
|
87
|
+
getDataLayer().push(entry);
|
|
88
|
+
},
|
|
89
|
+
[debug]
|
|
90
|
+
);
|
|
91
|
+
const grantConsent = _react.useCallback.call(void 0, () => {
|
|
92
|
+
setHasConsent(true);
|
|
93
|
+
loadGtm();
|
|
94
|
+
}, [loadGtm]);
|
|
95
|
+
const revokeConsent = _react.useCallback.call(void 0, () => {
|
|
96
|
+
setHasConsent(false);
|
|
97
|
+
}, []);
|
|
98
|
+
const value = _react.useMemo.call(void 0,
|
|
99
|
+
() => ({
|
|
100
|
+
pushEvent,
|
|
101
|
+
pushEcommerceEvent,
|
|
102
|
+
grantConsent,
|
|
103
|
+
revokeConsent,
|
|
104
|
+
hasConsent,
|
|
105
|
+
isLoaded
|
|
106
|
+
}),
|
|
107
|
+
[
|
|
108
|
+
pushEvent,
|
|
109
|
+
pushEcommerceEvent,
|
|
110
|
+
grantConsent,
|
|
111
|
+
revokeConsent,
|
|
112
|
+
hasConsent,
|
|
113
|
+
isLoaded
|
|
114
|
+
]
|
|
115
|
+
);
|
|
116
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, GtmContext.Provider, { value, children });
|
|
117
|
+
}
|
|
118
|
+
function useGtm() {
|
|
119
|
+
const context = _react.useContext.call(void 0, GtmContext);
|
|
120
|
+
if (!context) {
|
|
121
|
+
throw new Error("useGtm must be used within a <GtmProvider>");
|
|
122
|
+
}
|
|
123
|
+
return context;
|
|
124
|
+
}
|
|
125
|
+
function GtmNoscript({ gtmId }) {
|
|
126
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "noscript", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
127
|
+
"iframe",
|
|
128
|
+
{
|
|
129
|
+
src: `https://www.googletagmanager.com/ns.html?id=${encodeURIComponent(gtmId)}`,
|
|
130
|
+
height: "0",
|
|
131
|
+
width: "0",
|
|
132
|
+
style: { display: "none", visibility: "hidden" },
|
|
133
|
+
title: "Google Tag Manager"
|
|
134
|
+
}
|
|
135
|
+
) });
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
exports.GtmNoscript = GtmNoscript; exports.GtmProvider = GtmProvider; exports.useGtm = useGtm;
|
|
142
|
+
//# sourceMappingURL=gtm.cjs.map
|
package/dist/gtm.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/gtm.cjs","../src/gtm.tsx"],"names":[],"mappings":"AAAA,qFAAY;AACZ,YAAY;AACZ;AACA;ACDA;AACE;AACA;AACA;AACA;AACA;AACA;AAAA,8BACK;AAiOE,+CAAA;AA1IT,IAAM,WAAA,EAAa,kCAAA,IAA0C,CAAA;AAY7D,SAAS,YAAA,CAAA,EAA0C;AACjD,EAAA,GAAA,CAAI,OAAO,OAAA,IAAW,WAAA,EAAa,OAAO,CAAC,CAAA;AAC3C,EAAA,GAAA,CAAI,CAAC,MAAA,CAAO,SAAA,EAAW,MAAA,CAAO,UAAA,EAAY,CAAC,CAAA;AAC3C,EAAA,OAAO,MAAA,CAAO,SAAA;AAChB;AAEA,SAAS,eAAA,CAAgB,KAAA,EAAe,QAAA,EAA6B;AACnE,EAAA,GAAA,CAAI,OAAO,SAAA,IAAa,WAAA,EAAa,MAAA;AAGrC,EAAA,GAAA,CAAI,QAAA,CAAS,cAAA,CAAe,YAAY,CAAA,EAAG,MAAA;AAE3C,EAAA,MAAM,UAAA,EAAY,YAAA,CAAa,CAAA;AAC/B,EAAA,SAAA,CAAU,IAAA,CAAK,EAAE,WAAA,EAAA,iBAAa,IAAI,IAAA,CAAK,CAAA,CAAA,CAAE,OAAA,CAAQ,CAAA,EAAG,KAAA,EAAO,SAAS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EoD,EAAA;AACtD;AAM0C;AACH,EAAA;AACvB,EAAA;AACgD,IAAA;AAC9D,EAAA;AACO,EAAA;AACT;AAWyD;AAGnD,EAAA;AAAC,IAAA;AAAA,IAAA;AAC8E,MAAA;AACtE,MAAA;AACD,MAAA;AACyC,MAAA;AACzC,MAAA;AAAA,IAAA;AAEV,EAAA;AAEJ;ADtIuF;AACA;AACA;AACA;AACA","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/gtm.cjs","sourcesContent":[null,"\"use client\";\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ReactNode } from \"react\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** GTM script loading strategy. */\nexport type GtmStrategy =\n | \"default\"\n | \"afterInteractive\"\n | \"lazyOnload\"\n | \"worker\";\n\n/** GA4 standard e-commerce event names. */\nexport type GtmEcommerceEvent =\n | \"view_item\"\n | \"view_item_list\"\n | \"select_item\"\n | \"add_to_cart\"\n | \"remove_from_cart\"\n | \"view_cart\"\n | \"begin_checkout\"\n | \"add_shipping_info\"\n | \"add_payment_info\"\n | \"purchase\"\n | \"refund\";\n\n/** GA4 e-commerce item shape. */\nexport interface GtmItem {\n item_id: string;\n item_name?: string;\n item_brand?: string;\n item_category?: string;\n item_variant?: string;\n price?: number;\n quantity?: number;\n index?: number;\n [key: string]: unknown;\n}\n\n/** Parameters for e-commerce events. */\nexport interface GtmEcommerceParams {\n currency?: string;\n value?: number;\n items?: GtmItem[];\n transaction_id?: string;\n shipping?: number;\n tax?: number;\n coupon?: string;\n [key: string]: unknown;\n}\n\nexport interface GtmProviderProps {\n /** GTM container ID (e.g. \"GTM-XXXXX\"). */\n gtmId: string;\n /** Script loading strategy. Default: \"afterInteractive\". */\n strategy?: GtmStrategy;\n /** Delay GTM loading until consent is granted. Default: false. */\n consentRequired?: boolean;\n /** Log dataLayer pushes to console. Default: false. */\n debug?: boolean;\n children: ReactNode;\n}\n\nexport interface GtmContextValue {\n /** Push a custom event to the dataLayer. */\n pushEvent: (event: string, params?: Record<string, unknown>) => void;\n /** Push a GA4 e-commerce event to the dataLayer. */\n pushEcommerceEvent: (\n event: GtmEcommerceEvent,\n params: GtmEcommerceParams,\n ) => void;\n /** Grant consent — loads GTM if consentRequired was true. */\n grantConsent: () => void;\n /** Revoke consent. Does not unload GTM (scripts can't be unloaded). */\n revokeConsent: () => void;\n /** Whether consent has been granted. */\n hasConsent: boolean;\n /** Whether the GTM script has been injected. */\n isLoaded: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst GtmContext = createContext<GtmContextValue | null>(null);\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\ndeclare global {\n interface Window {\n dataLayer?: Record<string, unknown>[];\n }\n}\n\nfunction getDataLayer(): Record<string, unknown>[] {\n if (typeof window === \"undefined\") return [];\n if (!window.dataLayer) window.dataLayer = [];\n return window.dataLayer;\n}\n\nfunction injectGtmScript(gtmId: string, strategy: GtmStrategy): void {\n if (typeof document === \"undefined\") return;\n\n // Prevent double-injection\n if (document.getElementById(\"gtm-script\")) return;\n\n const dataLayer = getDataLayer();\n dataLayer.push({ \"gtm.start\": new Date().getTime(), event: \"gtm.js\" });\n\n const script = document.createElement(\"script\");\n script.id = \"gtm-script\";\n script.src = `https://www.googletagmanager.com/gtm.js?id=${encodeURIComponent(gtmId)}`;\n\n if (strategy === \"lazyOnload\") {\n script.async = true;\n script.defer = true;\n } else if (strategy === \"worker\") {\n script.type = \"text/partytown\";\n script.async = true;\n } else {\n // \"default\" and \"afterInteractive\"\n script.async = true;\n }\n\n document.head.appendChild(script);\n}\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport function GtmProvider({\n gtmId,\n strategy = \"afterInteractive\",\n consentRequired = false,\n debug = false,\n children,\n}: GtmProviderProps) {\n const [hasConsent, setHasConsent] = useState(!consentRequired);\n const [isLoaded, setIsLoaded] = useState(false);\n const injectedRef = useRef(false);\n\n const loadGtm = useCallback(() => {\n if (injectedRef.current) return;\n injectedRef.current = true;\n\n if (strategy === \"lazyOnload\" && typeof requestIdleCallback === \"function\") {\n requestIdleCallback(() => {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n });\n } else if (strategy === \"afterInteractive\") {\n // Defer to after hydration\n setTimeout(() => {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n }, 0);\n } else {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n }\n }, [gtmId, strategy]);\n\n // Auto-load when consent is not required or already granted\n if (hasConsent && !injectedRef.current && typeof window !== \"undefined\") {\n loadGtm();\n }\n\n const pushEvent = useCallback(\n (event: string, params?: Record<string, unknown>) => {\n const entry = { event, ...params };\n if (debug) {\n console.log(\"[GTM]\", entry);\n }\n getDataLayer().push(entry);\n },\n [debug],\n );\n\n const pushEcommerceEvent = useCallback(\n (event: GtmEcommerceEvent, params: GtmEcommerceParams) => {\n // Clear previous ecommerce data per GA4 best practices\n getDataLayer().push({ ecommerce: null });\n const entry = { event, ecommerce: params };\n if (debug) {\n console.log(\"[GTM ecommerce]\", entry);\n }\n getDataLayer().push(entry);\n },\n [debug],\n );\n\n const grantConsent = useCallback(() => {\n setHasConsent(true);\n loadGtm();\n }, [loadGtm]);\n\n const revokeConsent = useCallback(() => {\n setHasConsent(false);\n }, []);\n\n const value = useMemo<GtmContextValue>(\n () => ({\n pushEvent,\n pushEcommerceEvent,\n grantConsent,\n revokeConsent,\n hasConsent,\n isLoaded,\n }),\n [\n pushEvent,\n pushEcommerceEvent,\n grantConsent,\n revokeConsent,\n hasConsent,\n isLoaded,\n ],\n );\n\n return <GtmContext.Provider value={value}>{children}</GtmContext.Provider>;\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\nexport function useGtm(): GtmContextValue {\n const context = useContext(GtmContext);\n if (!context) {\n throw new Error(\"useGtm must be used within a <GtmProvider>\");\n }\n return context;\n}\n\n// ---------------------------------------------------------------------------\n// Noscript\n// ---------------------------------------------------------------------------\n\nexport interface GtmNoscriptProps {\n /** GTM container ID (must match GtmProvider). */\n gtmId: string;\n}\n\nexport function GtmNoscript({ gtmId }: GtmNoscriptProps) {\n return (\n <noscript>\n <iframe\n src={`https://www.googletagmanager.com/ns.html?id=${encodeURIComponent(gtmId)}`}\n height=\"0\"\n width=\"0\"\n style={{ display: \"none\", visibility: \"hidden\" }}\n title=\"Google Tag Manager\"\n />\n </noscript>\n );\n}\n"]}
|
package/dist/gtm.d.cts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/** GTM script loading strategy. */
|
|
5
|
+
type GtmStrategy = "default" | "afterInteractive" | "lazyOnload" | "worker";
|
|
6
|
+
/** GA4 standard e-commerce event names. */
|
|
7
|
+
type GtmEcommerceEvent = "view_item" | "view_item_list" | "select_item" | "add_to_cart" | "remove_from_cart" | "view_cart" | "begin_checkout" | "add_shipping_info" | "add_payment_info" | "purchase" | "refund";
|
|
8
|
+
/** GA4 e-commerce item shape. */
|
|
9
|
+
interface GtmItem {
|
|
10
|
+
item_id: string;
|
|
11
|
+
item_name?: string;
|
|
12
|
+
item_brand?: string;
|
|
13
|
+
item_category?: string;
|
|
14
|
+
item_variant?: string;
|
|
15
|
+
price?: number;
|
|
16
|
+
quantity?: number;
|
|
17
|
+
index?: number;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/** Parameters for e-commerce events. */
|
|
21
|
+
interface GtmEcommerceParams {
|
|
22
|
+
currency?: string;
|
|
23
|
+
value?: number;
|
|
24
|
+
items?: GtmItem[];
|
|
25
|
+
transaction_id?: string;
|
|
26
|
+
shipping?: number;
|
|
27
|
+
tax?: number;
|
|
28
|
+
coupon?: string;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
interface GtmProviderProps {
|
|
32
|
+
/** GTM container ID (e.g. "GTM-XXXXX"). */
|
|
33
|
+
gtmId: string;
|
|
34
|
+
/** Script loading strategy. Default: "afterInteractive". */
|
|
35
|
+
strategy?: GtmStrategy;
|
|
36
|
+
/** Delay GTM loading until consent is granted. Default: false. */
|
|
37
|
+
consentRequired?: boolean;
|
|
38
|
+
/** Log dataLayer pushes to console. Default: false. */
|
|
39
|
+
debug?: boolean;
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
}
|
|
42
|
+
interface GtmContextValue {
|
|
43
|
+
/** Push a custom event to the dataLayer. */
|
|
44
|
+
pushEvent: (event: string, params?: Record<string, unknown>) => void;
|
|
45
|
+
/** Push a GA4 e-commerce event to the dataLayer. */
|
|
46
|
+
pushEcommerceEvent: (event: GtmEcommerceEvent, params: GtmEcommerceParams) => void;
|
|
47
|
+
/** Grant consent — loads GTM if consentRequired was true. */
|
|
48
|
+
grantConsent: () => void;
|
|
49
|
+
/** Revoke consent. Does not unload GTM (scripts can't be unloaded). */
|
|
50
|
+
revokeConsent: () => void;
|
|
51
|
+
/** Whether consent has been granted. */
|
|
52
|
+
hasConsent: boolean;
|
|
53
|
+
/** Whether the GTM script has been injected. */
|
|
54
|
+
isLoaded: boolean;
|
|
55
|
+
}
|
|
56
|
+
declare global {
|
|
57
|
+
interface Window {
|
|
58
|
+
dataLayer?: Record<string, unknown>[];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
declare function GtmProvider({ gtmId, strategy, consentRequired, debug, children, }: GtmProviderProps): react_jsx_runtime.JSX.Element;
|
|
62
|
+
declare function useGtm(): GtmContextValue;
|
|
63
|
+
interface GtmNoscriptProps {
|
|
64
|
+
/** GTM container ID (must match GtmProvider). */
|
|
65
|
+
gtmId: string;
|
|
66
|
+
}
|
|
67
|
+
declare function GtmNoscript({ gtmId }: GtmNoscriptProps): react_jsx_runtime.JSX.Element;
|
|
68
|
+
|
|
69
|
+
export { type GtmContextValue, type GtmEcommerceEvent, type GtmEcommerceParams, type GtmItem, GtmNoscript, type GtmNoscriptProps, GtmProvider, type GtmProviderProps, type GtmStrategy, useGtm };
|
package/dist/gtm.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/** GTM script loading strategy. */
|
|
5
|
+
type GtmStrategy = "default" | "afterInteractive" | "lazyOnload" | "worker";
|
|
6
|
+
/** GA4 standard e-commerce event names. */
|
|
7
|
+
type GtmEcommerceEvent = "view_item" | "view_item_list" | "select_item" | "add_to_cart" | "remove_from_cart" | "view_cart" | "begin_checkout" | "add_shipping_info" | "add_payment_info" | "purchase" | "refund";
|
|
8
|
+
/** GA4 e-commerce item shape. */
|
|
9
|
+
interface GtmItem {
|
|
10
|
+
item_id: string;
|
|
11
|
+
item_name?: string;
|
|
12
|
+
item_brand?: string;
|
|
13
|
+
item_category?: string;
|
|
14
|
+
item_variant?: string;
|
|
15
|
+
price?: number;
|
|
16
|
+
quantity?: number;
|
|
17
|
+
index?: number;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/** Parameters for e-commerce events. */
|
|
21
|
+
interface GtmEcommerceParams {
|
|
22
|
+
currency?: string;
|
|
23
|
+
value?: number;
|
|
24
|
+
items?: GtmItem[];
|
|
25
|
+
transaction_id?: string;
|
|
26
|
+
shipping?: number;
|
|
27
|
+
tax?: number;
|
|
28
|
+
coupon?: string;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
interface GtmProviderProps {
|
|
32
|
+
/** GTM container ID (e.g. "GTM-XXXXX"). */
|
|
33
|
+
gtmId: string;
|
|
34
|
+
/** Script loading strategy. Default: "afterInteractive". */
|
|
35
|
+
strategy?: GtmStrategy;
|
|
36
|
+
/** Delay GTM loading until consent is granted. Default: false. */
|
|
37
|
+
consentRequired?: boolean;
|
|
38
|
+
/** Log dataLayer pushes to console. Default: false. */
|
|
39
|
+
debug?: boolean;
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
}
|
|
42
|
+
interface GtmContextValue {
|
|
43
|
+
/** Push a custom event to the dataLayer. */
|
|
44
|
+
pushEvent: (event: string, params?: Record<string, unknown>) => void;
|
|
45
|
+
/** Push a GA4 e-commerce event to the dataLayer. */
|
|
46
|
+
pushEcommerceEvent: (event: GtmEcommerceEvent, params: GtmEcommerceParams) => void;
|
|
47
|
+
/** Grant consent — loads GTM if consentRequired was true. */
|
|
48
|
+
grantConsent: () => void;
|
|
49
|
+
/** Revoke consent. Does not unload GTM (scripts can't be unloaded). */
|
|
50
|
+
revokeConsent: () => void;
|
|
51
|
+
/** Whether consent has been granted. */
|
|
52
|
+
hasConsent: boolean;
|
|
53
|
+
/** Whether the GTM script has been injected. */
|
|
54
|
+
isLoaded: boolean;
|
|
55
|
+
}
|
|
56
|
+
declare global {
|
|
57
|
+
interface Window {
|
|
58
|
+
dataLayer?: Record<string, unknown>[];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
declare function GtmProvider({ gtmId, strategy, consentRequired, debug, children, }: GtmProviderProps): react_jsx_runtime.JSX.Element;
|
|
62
|
+
declare function useGtm(): GtmContextValue;
|
|
63
|
+
interface GtmNoscriptProps {
|
|
64
|
+
/** GTM container ID (must match GtmProvider). */
|
|
65
|
+
gtmId: string;
|
|
66
|
+
}
|
|
67
|
+
declare function GtmNoscript({ gtmId }: GtmNoscriptProps): react_jsx_runtime.JSX.Element;
|
|
68
|
+
|
|
69
|
+
export { type GtmContextValue, type GtmEcommerceEvent, type GtmEcommerceParams, type GtmItem, GtmNoscript, type GtmNoscriptProps, GtmProvider, type GtmProviderProps, type GtmStrategy, useGtm };
|
package/dist/gtm.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
// src/gtm.tsx
|
|
5
|
+
import {
|
|
6
|
+
createContext,
|
|
7
|
+
useCallback,
|
|
8
|
+
useContext,
|
|
9
|
+
useMemo,
|
|
10
|
+
useRef,
|
|
11
|
+
useState
|
|
12
|
+
} from "react";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
var GtmContext = createContext(null);
|
|
15
|
+
function getDataLayer() {
|
|
16
|
+
if (typeof window === "undefined") return [];
|
|
17
|
+
if (!window.dataLayer) window.dataLayer = [];
|
|
18
|
+
return window.dataLayer;
|
|
19
|
+
}
|
|
20
|
+
function injectGtmScript(gtmId, strategy) {
|
|
21
|
+
if (typeof document === "undefined") return;
|
|
22
|
+
if (document.getElementById("gtm-script")) return;
|
|
23
|
+
const dataLayer = getDataLayer();
|
|
24
|
+
dataLayer.push({ "gtm.start": (/* @__PURE__ */ new Date()).getTime(), event: "gtm.js" });
|
|
25
|
+
const script = document.createElement("script");
|
|
26
|
+
script.id = "gtm-script";
|
|
27
|
+
script.src = `https://www.googletagmanager.com/gtm.js?id=${encodeURIComponent(gtmId)}`;
|
|
28
|
+
if (strategy === "lazyOnload") {
|
|
29
|
+
script.async = true;
|
|
30
|
+
script.defer = true;
|
|
31
|
+
} else if (strategy === "worker") {
|
|
32
|
+
script.type = "text/partytown";
|
|
33
|
+
script.async = true;
|
|
34
|
+
} else {
|
|
35
|
+
script.async = true;
|
|
36
|
+
}
|
|
37
|
+
document.head.appendChild(script);
|
|
38
|
+
}
|
|
39
|
+
function GtmProvider({
|
|
40
|
+
gtmId,
|
|
41
|
+
strategy = "afterInteractive",
|
|
42
|
+
consentRequired = false,
|
|
43
|
+
debug = false,
|
|
44
|
+
children
|
|
45
|
+
}) {
|
|
46
|
+
const [hasConsent, setHasConsent] = useState(!consentRequired);
|
|
47
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
48
|
+
const injectedRef = useRef(false);
|
|
49
|
+
const loadGtm = useCallback(() => {
|
|
50
|
+
if (injectedRef.current) return;
|
|
51
|
+
injectedRef.current = true;
|
|
52
|
+
if (strategy === "lazyOnload" && typeof requestIdleCallback === "function") {
|
|
53
|
+
requestIdleCallback(() => {
|
|
54
|
+
injectGtmScript(gtmId, strategy);
|
|
55
|
+
setIsLoaded(true);
|
|
56
|
+
});
|
|
57
|
+
} else if (strategy === "afterInteractive") {
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
injectGtmScript(gtmId, strategy);
|
|
60
|
+
setIsLoaded(true);
|
|
61
|
+
}, 0);
|
|
62
|
+
} else {
|
|
63
|
+
injectGtmScript(gtmId, strategy);
|
|
64
|
+
setIsLoaded(true);
|
|
65
|
+
}
|
|
66
|
+
}, [gtmId, strategy]);
|
|
67
|
+
if (hasConsent && !injectedRef.current && typeof window !== "undefined") {
|
|
68
|
+
loadGtm();
|
|
69
|
+
}
|
|
70
|
+
const pushEvent = useCallback(
|
|
71
|
+
(event, params) => {
|
|
72
|
+
const entry = { event, ...params };
|
|
73
|
+
if (debug) {
|
|
74
|
+
console.log("[GTM]", entry);
|
|
75
|
+
}
|
|
76
|
+
getDataLayer().push(entry);
|
|
77
|
+
},
|
|
78
|
+
[debug]
|
|
79
|
+
);
|
|
80
|
+
const pushEcommerceEvent = useCallback(
|
|
81
|
+
(event, params) => {
|
|
82
|
+
getDataLayer().push({ ecommerce: null });
|
|
83
|
+
const entry = { event, ecommerce: params };
|
|
84
|
+
if (debug) {
|
|
85
|
+
console.log("[GTM ecommerce]", entry);
|
|
86
|
+
}
|
|
87
|
+
getDataLayer().push(entry);
|
|
88
|
+
},
|
|
89
|
+
[debug]
|
|
90
|
+
);
|
|
91
|
+
const grantConsent = useCallback(() => {
|
|
92
|
+
setHasConsent(true);
|
|
93
|
+
loadGtm();
|
|
94
|
+
}, [loadGtm]);
|
|
95
|
+
const revokeConsent = useCallback(() => {
|
|
96
|
+
setHasConsent(false);
|
|
97
|
+
}, []);
|
|
98
|
+
const value = useMemo(
|
|
99
|
+
() => ({
|
|
100
|
+
pushEvent,
|
|
101
|
+
pushEcommerceEvent,
|
|
102
|
+
grantConsent,
|
|
103
|
+
revokeConsent,
|
|
104
|
+
hasConsent,
|
|
105
|
+
isLoaded
|
|
106
|
+
}),
|
|
107
|
+
[
|
|
108
|
+
pushEvent,
|
|
109
|
+
pushEcommerceEvent,
|
|
110
|
+
grantConsent,
|
|
111
|
+
revokeConsent,
|
|
112
|
+
hasConsent,
|
|
113
|
+
isLoaded
|
|
114
|
+
]
|
|
115
|
+
);
|
|
116
|
+
return /* @__PURE__ */ jsx(GtmContext.Provider, { value, children });
|
|
117
|
+
}
|
|
118
|
+
function useGtm() {
|
|
119
|
+
const context = useContext(GtmContext);
|
|
120
|
+
if (!context) {
|
|
121
|
+
throw new Error("useGtm must be used within a <GtmProvider>");
|
|
122
|
+
}
|
|
123
|
+
return context;
|
|
124
|
+
}
|
|
125
|
+
function GtmNoscript({ gtmId }) {
|
|
126
|
+
return /* @__PURE__ */ jsx("noscript", { children: /* @__PURE__ */ jsx(
|
|
127
|
+
"iframe",
|
|
128
|
+
{
|
|
129
|
+
src: `https://www.googletagmanager.com/ns.html?id=${encodeURIComponent(gtmId)}`,
|
|
130
|
+
height: "0",
|
|
131
|
+
width: "0",
|
|
132
|
+
style: { display: "none", visibility: "hidden" },
|
|
133
|
+
title: "Google Tag Manager"
|
|
134
|
+
}
|
|
135
|
+
) });
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
GtmNoscript,
|
|
139
|
+
GtmProvider,
|
|
140
|
+
useGtm
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=gtm.js.map
|
package/dist/gtm.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/gtm.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ReactNode } from \"react\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** GTM script loading strategy. */\nexport type GtmStrategy =\n | \"default\"\n | \"afterInteractive\"\n | \"lazyOnload\"\n | \"worker\";\n\n/** GA4 standard e-commerce event names. */\nexport type GtmEcommerceEvent =\n | \"view_item\"\n | \"view_item_list\"\n | \"select_item\"\n | \"add_to_cart\"\n | \"remove_from_cart\"\n | \"view_cart\"\n | \"begin_checkout\"\n | \"add_shipping_info\"\n | \"add_payment_info\"\n | \"purchase\"\n | \"refund\";\n\n/** GA4 e-commerce item shape. */\nexport interface GtmItem {\n item_id: string;\n item_name?: string;\n item_brand?: string;\n item_category?: string;\n item_variant?: string;\n price?: number;\n quantity?: number;\n index?: number;\n [key: string]: unknown;\n}\n\n/** Parameters for e-commerce events. */\nexport interface GtmEcommerceParams {\n currency?: string;\n value?: number;\n items?: GtmItem[];\n transaction_id?: string;\n shipping?: number;\n tax?: number;\n coupon?: string;\n [key: string]: unknown;\n}\n\nexport interface GtmProviderProps {\n /** GTM container ID (e.g. \"GTM-XXXXX\"). */\n gtmId: string;\n /** Script loading strategy. Default: \"afterInteractive\". */\n strategy?: GtmStrategy;\n /** Delay GTM loading until consent is granted. Default: false. */\n consentRequired?: boolean;\n /** Log dataLayer pushes to console. Default: false. */\n debug?: boolean;\n children: ReactNode;\n}\n\nexport interface GtmContextValue {\n /** Push a custom event to the dataLayer. */\n pushEvent: (event: string, params?: Record<string, unknown>) => void;\n /** Push a GA4 e-commerce event to the dataLayer. */\n pushEcommerceEvent: (\n event: GtmEcommerceEvent,\n params: GtmEcommerceParams,\n ) => void;\n /** Grant consent — loads GTM if consentRequired was true. */\n grantConsent: () => void;\n /** Revoke consent. Does not unload GTM (scripts can't be unloaded). */\n revokeConsent: () => void;\n /** Whether consent has been granted. */\n hasConsent: boolean;\n /** Whether the GTM script has been injected. */\n isLoaded: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst GtmContext = createContext<GtmContextValue | null>(null);\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\ndeclare global {\n interface Window {\n dataLayer?: Record<string, unknown>[];\n }\n}\n\nfunction getDataLayer(): Record<string, unknown>[] {\n if (typeof window === \"undefined\") return [];\n if (!window.dataLayer) window.dataLayer = [];\n return window.dataLayer;\n}\n\nfunction injectGtmScript(gtmId: string, strategy: GtmStrategy): void {\n if (typeof document === \"undefined\") return;\n\n // Prevent double-injection\n if (document.getElementById(\"gtm-script\")) return;\n\n const dataLayer = getDataLayer();\n dataLayer.push({ \"gtm.start\": new Date().getTime(), event: \"gtm.js\" });\n\n const script = document.createElement(\"script\");\n script.id = \"gtm-script\";\n script.src = `https://www.googletagmanager.com/gtm.js?id=${encodeURIComponent(gtmId)}`;\n\n if (strategy === \"lazyOnload\") {\n script.async = true;\n script.defer = true;\n } else if (strategy === \"worker\") {\n script.type = \"text/partytown\";\n script.async = true;\n } else {\n // \"default\" and \"afterInteractive\"\n script.async = true;\n }\n\n document.head.appendChild(script);\n}\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport function GtmProvider({\n gtmId,\n strategy = \"afterInteractive\",\n consentRequired = false,\n debug = false,\n children,\n}: GtmProviderProps) {\n const [hasConsent, setHasConsent] = useState(!consentRequired);\n const [isLoaded, setIsLoaded] = useState(false);\n const injectedRef = useRef(false);\n\n const loadGtm = useCallback(() => {\n if (injectedRef.current) return;\n injectedRef.current = true;\n\n if (strategy === \"lazyOnload\" && typeof requestIdleCallback === \"function\") {\n requestIdleCallback(() => {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n });\n } else if (strategy === \"afterInteractive\") {\n // Defer to after hydration\n setTimeout(() => {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n }, 0);\n } else {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n }\n }, [gtmId, strategy]);\n\n // Auto-load when consent is not required or already granted\n if (hasConsent && !injectedRef.current && typeof window !== \"undefined\") {\n loadGtm();\n }\n\n const pushEvent = useCallback(\n (event: string, params?: Record<string, unknown>) => {\n const entry = { event, ...params };\n if (debug) {\n console.log(\"[GTM]\", entry);\n }\n getDataLayer().push(entry);\n },\n [debug],\n );\n\n const pushEcommerceEvent = useCallback(\n (event: GtmEcommerceEvent, params: GtmEcommerceParams) => {\n // Clear previous ecommerce data per GA4 best practices\n getDataLayer().push({ ecommerce: null });\n const entry = { event, ecommerce: params };\n if (debug) {\n console.log(\"[GTM ecommerce]\", entry);\n }\n getDataLayer().push(entry);\n },\n [debug],\n );\n\n const grantConsent = useCallback(() => {\n setHasConsent(true);\n loadGtm();\n }, [loadGtm]);\n\n const revokeConsent = useCallback(() => {\n setHasConsent(false);\n }, []);\n\n const value = useMemo<GtmContextValue>(\n () => ({\n pushEvent,\n pushEcommerceEvent,\n grantConsent,\n revokeConsent,\n hasConsent,\n isLoaded,\n }),\n [\n pushEvent,\n pushEcommerceEvent,\n grantConsent,\n revokeConsent,\n hasConsent,\n isLoaded,\n ],\n );\n\n return <GtmContext.Provider value={value}>{children}</GtmContext.Provider>;\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\nexport function useGtm(): GtmContextValue {\n const context = useContext(GtmContext);\n if (!context) {\n throw new Error(\"useGtm must be used within a <GtmProvider>\");\n }\n return context;\n}\n\n// ---------------------------------------------------------------------------\n// Noscript\n// ---------------------------------------------------------------------------\n\nexport interface GtmNoscriptProps {\n /** GTM container ID (must match GtmProvider). */\n gtmId: string;\n}\n\nexport function GtmNoscript({ gtmId }: GtmNoscriptProps) {\n return (\n <noscript>\n <iframe\n src={`https://www.googletagmanager.com/ns.html?id=${encodeURIComponent(gtmId)}`}\n height=\"0\"\n width=\"0\"\n style={{ display: \"none\", visibility: \"hidden\" }}\n title=\"Google Tag Manager\"\n />\n </noscript>\n );\n}\n"],"mappings":";;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAiOE;AA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M,UAAU,WAAW,UAAU;AACrC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AACA,SAAO;AACT;AAWO,SAAS,YAAY,EAAE,MAAM,GAAqB;AACvD,SACE,oBAAC,cACC;AAAA,IAAC;AAAA;AAAA,MACC,KAAK,+CAA+C,mBAAmB,KAAK,CAAC;AAAA,MAC7E,QAAO;AAAA,MACP,OAAM;AAAA,MACN,OAAO,EAAE,SAAS,QAAQ,YAAY,SAAS;AAAA,MAC/C,OAAM;AAAA;AAAA,EACR,GACF;AAEJ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simpleapps-com/augur-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "Shared React UI components for Augur ecommerce sites (Radix + Tailwind)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -145,6 +145,11 @@
|
|
|
145
145
|
"import": "./dist/form-textarea.js",
|
|
146
146
|
"require": "./dist/form-textarea.cjs"
|
|
147
147
|
},
|
|
148
|
+
"./gtm": {
|
|
149
|
+
"types": "./dist/gtm.d.ts",
|
|
150
|
+
"import": "./dist/gtm.js",
|
|
151
|
+
"require": "./dist/gtm.cjs"
|
|
152
|
+
},
|
|
148
153
|
"./mdx-components": {
|
|
149
154
|
"types": "./dist/mdx-components.d.ts",
|
|
150
155
|
"import": "./dist/mdx-components.js",
|
|
@@ -156,7 +161,7 @@
|
|
|
156
161
|
"dist"
|
|
157
162
|
],
|
|
158
163
|
"dependencies": {
|
|
159
|
-
"@simpleapps-com/augur-utils": "0.2.
|
|
164
|
+
"@simpleapps-com/augur-utils": "0.2.14"
|
|
160
165
|
},
|
|
161
166
|
"peerDependencies": {
|
|
162
167
|
"@radix-ui/react-accordion": "^1.2.0",
|