@shware/analytics 2.7.0 → 2.8.1
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/README.md +4 -0
- package/dist/next/index.cjs +32 -43
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +8 -14
- package/dist/next/index.d.ts +8 -14
- package/dist/next/index.mjs +31 -39
- package/dist/next/index.mjs.map +1 -1
- package/dist/react-router/index.cjs +32 -43
- package/dist/react-router/index.cjs.map +1 -1
- package/dist/react-router/index.d.cts +8 -14
- package/dist/react-router/index.d.ts +8 -14
- package/dist/react-router/index.mjs +31 -39
- package/dist/react-router/index.mjs.map +1 -1
- package/dist/schema/index.cjs +85 -148
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +81 -1
- package/dist/schema/index.d.ts +81 -1
- package/dist/schema/index.mjs +83 -148
- package/dist/schema/index.mjs.map +1 -1
- package/dist/server/{conversions-api.cjs → meta-conversions-api.cjs} +5 -5
- package/dist/server/meta-conversions-api.cjs.map +1 -0
- package/dist/server/{conversions-api.mjs → meta-conversions-api.mjs} +2 -2
- package/dist/server/meta-conversions-api.mjs.map +1 -0
- package/dist/server/reddit-conversions-api.cjs +88 -0
- package/dist/server/reddit-conversions-api.cjs.map +1 -0
- package/dist/server/reddit-conversions-api.d.cts +75 -0
- package/dist/server/reddit-conversions-api.d.ts +75 -0
- package/dist/server/reddit-conversions-api.mjs +62 -0
- package/dist/server/reddit-conversions-api.mjs.map +1 -0
- package/dist/third-parties/google-analytics.cjs +48 -0
- package/dist/third-parties/google-analytics.cjs.map +1 -0
- package/dist/third-parties/google-analytics.d.cts +12 -0
- package/dist/third-parties/google-analytics.d.ts +12 -0
- package/dist/third-parties/google-analytics.mjs +22 -0
- package/dist/third-parties/google-analytics.mjs.map +1 -0
- package/dist/third-parties/hotjar.cjs +2 -0
- package/dist/third-parties/hotjar.cjs.map +1 -0
- package/dist/third-parties/hotjar.d.cts +2 -0
- package/dist/third-parties/hotjar.d.ts +2 -0
- package/dist/third-parties/hotjar.mjs +1 -0
- package/dist/third-parties/hotjar.mjs.map +1 -0
- package/dist/third-parties/index.cjs +43 -0
- package/dist/third-parties/index.cjs.map +1 -0
- package/dist/third-parties/index.d.cts +8 -0
- package/dist/third-parties/index.d.ts +8 -0
- package/dist/third-parties/index.mjs +13 -0
- package/dist/third-parties/index.mjs.map +1 -0
- package/dist/third-parties/meta-pixel.cjs +68 -0
- package/dist/third-parties/meta-pixel.cjs.map +1 -0
- package/dist/third-parties/meta-pixel.d.cts +13 -0
- package/dist/third-parties/meta-pixel.d.ts +13 -0
- package/dist/third-parties/meta-pixel.mjs +42 -0
- package/dist/third-parties/meta-pixel.mjs.map +1 -0
- package/dist/third-parties/reddit-pixel.cjs +60 -0
- package/dist/third-parties/reddit-pixel.cjs.map +1 -0
- package/dist/third-parties/reddit-pixel.d.cts +13 -0
- package/dist/third-parties/reddit-pixel.d.ts +13 -0
- package/dist/third-parties/reddit-pixel.mjs +34 -0
- package/dist/third-parties/reddit-pixel.mjs.map +1 -0
- package/dist/track/fbq.cjs.map +1 -1
- package/dist/track/fbq.d.cts +2 -2
- package/dist/track/fbq.d.ts +2 -2
- package/dist/track/fbq.mjs.map +1 -1
- package/dist/track/rdt.cjs +104 -0
- package/dist/track/rdt.cjs.map +1 -0
- package/dist/track/rdt.d.cts +94 -0
- package/dist/track/rdt.d.ts +94 -0
- package/dist/track/rdt.mjs +78 -0
- package/dist/track/rdt.mjs.map +1 -0
- package/dist/track/types.cjs.map +1 -1
- package/dist/track/types.d.cts +4 -3
- package/dist/track/types.d.ts +4 -3
- package/dist/{react/index.cjs → utils/field.cjs} +11 -9
- package/dist/utils/field.cjs.map +1 -0
- package/dist/utils/field.d.cts +3 -0
- package/dist/utils/field.d.ts +3 -0
- package/dist/utils/field.mjs +10 -0
- package/dist/utils/field.mjs.map +1 -0
- package/dist/web/index.cjs +3 -0
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.mjs +3 -0
- package/dist/web/index.mjs.map +1 -1
- package/package.json +15 -10
- package/dist/react/index.cjs.map +0 -1
- package/dist/react/index.d.cts +0 -3
- package/dist/react/index.d.ts +0 -3
- package/dist/react/index.mjs +0 -8
- package/dist/react/index.mjs.map +0 -1
- package/dist/server/conversions-api.cjs.map +0 -1
- package/dist/server/conversions-api.mjs.map +0 -1
- /package/dist/server/{conversions-api.d.cts → meta-conversions-api.d.cts} +0 -0
- /package/dist/server/{conversions-api.d.ts → meta-conversions-api.d.ts} +0 -0
package/README.md
CHANGED
package/dist/next/index.cjs
CHANGED
|
@@ -31,55 +31,22 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
// src/next/index.tsx
|
|
32
32
|
var next_exports = {};
|
|
33
33
|
__export(next_exports, {
|
|
34
|
-
Analytics: () => Analytics
|
|
35
|
-
sendFBEvent: () => sendFBEvent,
|
|
36
|
-
sendGAEvent: () => sendGAEvent,
|
|
37
|
-
setGAUser: () => setGAUser
|
|
34
|
+
Analytics: () => Analytics
|
|
38
35
|
});
|
|
39
36
|
module.exports = __toCommonJS(next_exports);
|
|
40
37
|
var import_navigation = require("next/navigation");
|
|
41
38
|
var import_script = __toESM(require("next/script"), 1);
|
|
42
39
|
var import_web_vitals = require("next/web-vitals");
|
|
43
40
|
var import_use_page_view_analytics = require("../hooks/use-page-view-analytics.cjs");
|
|
44
|
-
var import_fbq = require("../track/fbq.cjs");
|
|
45
41
|
var import_track = require("../track/index.cjs");
|
|
46
42
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
47
|
-
function sendGAEvent(name, properties) {
|
|
48
|
-
if (!window.gtag) {
|
|
49
|
-
console.warn("GA has not been initialized");
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
window.gtag("event", name, properties);
|
|
53
|
-
}
|
|
54
|
-
function setGAUser({ user_id, data, properties }) {
|
|
55
|
-
if (!window.gtag) {
|
|
56
|
-
console.warn("GA has not been initialized");
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (user_id) window.gtag("set", "user_id", user_id);
|
|
60
|
-
if (data) window.gtag("set", "user_data", data);
|
|
61
|
-
if (properties) window.gtag("set", "user_properties", properties);
|
|
62
|
-
}
|
|
63
|
-
function sendFBEvent(name, properties, event_id) {
|
|
64
|
-
if (typeof window === "undefined" || !window.fbq) {
|
|
65
|
-
console.warn("fbq has not been initialized");
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const { fbq } = window;
|
|
69
|
-
const options = { eventID: event_id };
|
|
70
|
-
const [type, fbEventName, fbEventProperties] = (0, import_fbq.mapFBEvent)(name, properties);
|
|
71
|
-
if (type === "track") {
|
|
72
|
-
fbq(type, fbEventName, fbEventProperties, options);
|
|
73
|
-
} else {
|
|
74
|
-
fbq(type, fbEventName, fbEventProperties, options);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
43
|
function Analytics({
|
|
78
44
|
gaId,
|
|
79
45
|
nonce,
|
|
80
46
|
debugMode,
|
|
81
|
-
|
|
47
|
+
metaPixelId,
|
|
82
48
|
hotjarId,
|
|
49
|
+
redditPixelId,
|
|
83
50
|
facebookAppId,
|
|
84
51
|
reportWebVitals = true
|
|
85
52
|
}) {
|
|
@@ -125,10 +92,10 @@ function Analytics({
|
|
|
125
92
|
}
|
|
126
93
|
)
|
|
127
94
|
] }),
|
|
128
|
-
|
|
95
|
+
metaPixelId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
129
96
|
import_script.default,
|
|
130
97
|
{
|
|
131
|
-
id: "pixel",
|
|
98
|
+
id: "meta-pixel",
|
|
132
99
|
strategy: "afterInteractive",
|
|
133
100
|
dangerouslySetInnerHTML: {
|
|
134
101
|
__html: `
|
|
@@ -148,11 +115,36 @@ function Analytics({
|
|
|
148
115
|
s = b.getElementsByTagName(e)[0];
|
|
149
116
|
s.parentNode.insertBefore(t, s);
|
|
150
117
|
})(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
|
|
151
|
-
fbq('init', '${
|
|
118
|
+
fbq('init', '${metaPixelId}');
|
|
152
119
|
fbq('track', 'PageView');`
|
|
153
120
|
}
|
|
154
121
|
}
|
|
155
122
|
),
|
|
123
|
+
redditPixelId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
124
|
+
import_script.default,
|
|
125
|
+
{
|
|
126
|
+
id: "reddit-pixel",
|
|
127
|
+
strategy: "afterInteractive",
|
|
128
|
+
dangerouslySetInnerHTML: {
|
|
129
|
+
__html: `
|
|
130
|
+
!function(w,d) {
|
|
131
|
+
if(!w.rdt) {
|
|
132
|
+
var p = w.rdt = function() {
|
|
133
|
+
p.sendEvent ? p.sendEvent.apply(p,arguments) : p.callQueue.push(arguments)
|
|
134
|
+
};
|
|
135
|
+
p.callQueue = [];
|
|
136
|
+
var t = d.createElement("script");
|
|
137
|
+
t.src = "https://www.redditstatic.com/ads/pixel.js";
|
|
138
|
+
t.async = !0;
|
|
139
|
+
var s = d.getElementsByTagName("script")[0];
|
|
140
|
+
s.parentNode.insertBefore(t,s)
|
|
141
|
+
}
|
|
142
|
+
}(window, document);
|
|
143
|
+
rdt('init', '${redditPixelId}');
|
|
144
|
+
rdt('track', 'PageVisit');`
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
),
|
|
156
148
|
hotjarId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
149
|
import_script.default,
|
|
158
150
|
{
|
|
@@ -176,9 +168,6 @@ function Analytics({
|
|
|
176
168
|
}
|
|
177
169
|
// Annotate the CommonJS export names for ESM import in node:
|
|
178
170
|
0 && (module.exports = {
|
|
179
|
-
Analytics
|
|
180
|
-
sendFBEvent,
|
|
181
|
-
sendGAEvent,
|
|
182
|
-
setGAUser
|
|
171
|
+
Analytics
|
|
183
172
|
});
|
|
184
173
|
//# sourceMappingURL=index.cjs.map
|
package/dist/next/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/next/index.tsx"],"sourcesContent":["'use client';\n\nimport { usePathname } from 'next/navigation';\nimport Script from 'next/script';\nimport { useReportWebVitals } from 'next/web-vitals';\nimport { usePageViewAnalytics } from '../hooks/use-page-view-analytics';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/next/index.tsx"],"sourcesContent":["'use client';\n\nimport { usePathname } from 'next/navigation';\nimport Script from 'next/script';\nimport { useReportWebVitals } from 'next/web-vitals';\nimport { usePageViewAnalytics } from '../hooks/use-page-view-analytics';\nimport { track } from '../track/index';\nimport type { PixelId as MetaPixelId } from '../track/fbq';\nimport type { GaId, GtmId } from '../track/gtag';\nimport type { PixelId as RedditPixelId } from '../track/rdt';\n\ntype HotjarId = `${number}`;\n\ninterface Props {\n gaId?: GaId;\n gtmId?: GtmId;\n hotjarId?: HotjarId;\n metaPixelId?: MetaPixelId;\n redditPixelId?: RedditPixelId;\n facebookAppId?: string;\n nonce?: string;\n debugMode?: boolean;\n reportWebVitals?: boolean;\n}\n\nexport function Analytics({\n gaId,\n nonce,\n debugMode,\n metaPixelId,\n hotjarId,\n redditPixelId,\n facebookAppId,\n reportWebVitals = true,\n}: Props) {\n const pathname = usePathname();\n usePageViewAnalytics(pathname);\n\n useReportWebVitals((metric) => {\n if (!reportWebVitals) return;\n const properties = {\n id: metric.id,\n rating: metric.rating,\n value: metric.value,\n delta: metric.delta,\n navigation_type: metric.navigationType,\n non_interaction: true, // avoids affecting bounce rate.\n };\n track(metric.name, properties);\n });\n\n return (\n <>\n {facebookAppId && <meta property=\"fb:app_id\" content={facebookAppId} />}\n {gaId && (\n <>\n <Script\n id=\"gtag\"\n nonce={nonce}\n src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}\n />\n <Script\n nonce={nonce}\n id=\"gtag-init\"\n dangerouslySetInnerHTML={{\n __html: `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}'${debugMode ? \" ,{ 'debug_mode': true }\" : ''});\n `,\n }}\n />\n </>\n )}\n {metaPixelId && (\n <Script\n id=\"meta-pixel\"\n strategy=\"afterInteractive\"\n dangerouslySetInnerHTML={{\n __html: `\n !(function (f, b, e, v, n, t, s) {\n if (f.fbq) return;\n n = f.fbq = function () {\n n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n n.push = n;\n n.loaded = !0;\n n.version = '2.0';\n n.queue = [];\n t = b.createElement(e);\n t.async = !0;\n t.src = v;\n s = b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t, s);\n })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '${metaPixelId}');\n fbq('track', 'PageView');`,\n }}\n />\n )}\n {redditPixelId && (\n <Script\n id=\"reddit-pixel\"\n strategy=\"afterInteractive\"\n dangerouslySetInnerHTML={{\n __html: `\n !function(w,d) {\n if(!w.rdt) {\n var p = w.rdt = function() {\n p.sendEvent ? p.sendEvent.apply(p,arguments) : p.callQueue.push(arguments)\n };\n p.callQueue = [];\n var t = d.createElement(\"script\");\n t.src = \"https://www.redditstatic.com/ads/pixel.js\";\n t.async = !0;\n var s = d.getElementsByTagName(\"script\")[0];\n s.parentNode.insertBefore(t,s)\n }\n }(window, document);\n rdt('init', '${redditPixelId}');\n rdt('track', 'PageVisit');`,\n }}\n />\n )}\n {hotjarId && (\n <Script\n id=\"hotjar\"\n strategy=\"afterInteractive\"\n dangerouslySetInnerHTML={{\n __html: `\n (function(h,o,t,j,a,r){\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n h._hjSettings={hjid:${hotjarId},hjsv:6};\n a=o.getElementsByTagName('head')[0];\n r=o.createElement('script');r.async=1;\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n a.appendChild(r);\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n `,\n }}\n />\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;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A;AAAA,2BAiBO,WAAW;AAAA;AAAA,QAE5B;AAAA;AAAA,IACF;AAAA,IAED,iBACC;AAAA,MAAC,cAAAA;AAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,UAAS;AAAA,QACT,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAcO,aAAa;AAAA;AAAA,QAE9B;AAAA;AAAA,IACF;AAAA,IAED,YACC;AAAA,MAAC,cAAAA;AAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,UAAS;AAAA,QACT,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA;AAAA,oCAGgB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOlC;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":["Script"]}
|
package/dist/next/index.d.cts
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
2
|
+
import { PixelId } from '../track/fbq.cjs';
|
|
3
|
+
import { GaId, GtmId } from '../track/gtag.cjs';
|
|
4
|
+
import { PixelId as PixelId$1 } from '../track/rdt.cjs';
|
|
5
|
+
import '../track/types.cjs';
|
|
6
6
|
|
|
7
7
|
type HotjarId = `${number}`;
|
|
8
|
-
declare global {
|
|
9
|
-
interface Window extends Gtag, Pixel {
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
8
|
interface Props {
|
|
13
9
|
gaId?: GaId;
|
|
14
10
|
gtmId?: GtmId;
|
|
15
|
-
pixelId?: PixelId;
|
|
16
11
|
hotjarId?: HotjarId;
|
|
12
|
+
metaPixelId?: PixelId;
|
|
13
|
+
redditPixelId?: PixelId$1;
|
|
17
14
|
facebookAppId?: string;
|
|
18
15
|
nonce?: string;
|
|
19
16
|
debugMode?: boolean;
|
|
20
17
|
reportWebVitals?: boolean;
|
|
21
18
|
}
|
|
22
|
-
declare function
|
|
23
|
-
declare function setGAUser({ user_id, data, properties }: UpdateVisitorDTO): void;
|
|
24
|
-
declare function sendFBEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, event_id?: string): void;
|
|
25
|
-
declare function Analytics({ gaId, nonce, debugMode, pixelId, hotjarId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
|
|
19
|
+
declare function Analytics({ gaId, nonce, debugMode, metaPixelId, hotjarId, redditPixelId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
|
|
26
20
|
|
|
27
|
-
export { Analytics
|
|
21
|
+
export { Analytics };
|
package/dist/next/index.d.ts
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
2
|
+
import { PixelId } from '../track/fbq.js';
|
|
3
|
+
import { GaId, GtmId } from '../track/gtag.js';
|
|
4
|
+
import { PixelId as PixelId$1 } from '../track/rdt.js';
|
|
5
|
+
import '../track/types.js';
|
|
6
6
|
|
|
7
7
|
type HotjarId = `${number}`;
|
|
8
|
-
declare global {
|
|
9
|
-
interface Window extends Gtag, Pixel {
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
8
|
interface Props {
|
|
13
9
|
gaId?: GaId;
|
|
14
10
|
gtmId?: GtmId;
|
|
15
|
-
pixelId?: PixelId;
|
|
16
11
|
hotjarId?: HotjarId;
|
|
12
|
+
metaPixelId?: PixelId;
|
|
13
|
+
redditPixelId?: PixelId$1;
|
|
17
14
|
facebookAppId?: string;
|
|
18
15
|
nonce?: string;
|
|
19
16
|
debugMode?: boolean;
|
|
20
17
|
reportWebVitals?: boolean;
|
|
21
18
|
}
|
|
22
|
-
declare function
|
|
23
|
-
declare function setGAUser({ user_id, data, properties }: UpdateVisitorDTO): void;
|
|
24
|
-
declare function sendFBEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, event_id?: string): void;
|
|
25
|
-
declare function Analytics({ gaId, nonce, debugMode, pixelId, hotjarId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
|
|
19
|
+
declare function Analytics({ gaId, nonce, debugMode, metaPixelId, hotjarId, redditPixelId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
|
|
26
20
|
|
|
27
|
-
export { Analytics
|
|
21
|
+
export { Analytics };
|
package/dist/next/index.mjs
CHANGED
|
@@ -5,45 +5,15 @@ import { usePathname } from "next/navigation";
|
|
|
5
5
|
import Script from "next/script";
|
|
6
6
|
import { useReportWebVitals } from "next/web-vitals";
|
|
7
7
|
import { usePageViewAnalytics } from "../hooks/use-page-view-analytics.mjs";
|
|
8
|
-
import { mapFBEvent } from "../track/fbq.mjs";
|
|
9
8
|
import { track } from "../track/index.mjs";
|
|
10
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
function sendGAEvent(name, properties) {
|
|
12
|
-
if (!window.gtag) {
|
|
13
|
-
console.warn("GA has not been initialized");
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
window.gtag("event", name, properties);
|
|
17
|
-
}
|
|
18
|
-
function setGAUser({ user_id, data, properties }) {
|
|
19
|
-
if (!window.gtag) {
|
|
20
|
-
console.warn("GA has not been initialized");
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
if (user_id) window.gtag("set", "user_id", user_id);
|
|
24
|
-
if (data) window.gtag("set", "user_data", data);
|
|
25
|
-
if (properties) window.gtag("set", "user_properties", properties);
|
|
26
|
-
}
|
|
27
|
-
function sendFBEvent(name, properties, event_id) {
|
|
28
|
-
if (typeof window === "undefined" || !window.fbq) {
|
|
29
|
-
console.warn("fbq has not been initialized");
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const { fbq } = window;
|
|
33
|
-
const options = { eventID: event_id };
|
|
34
|
-
const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);
|
|
35
|
-
if (type === "track") {
|
|
36
|
-
fbq(type, fbEventName, fbEventProperties, options);
|
|
37
|
-
} else {
|
|
38
|
-
fbq(type, fbEventName, fbEventProperties, options);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
10
|
function Analytics({
|
|
42
11
|
gaId,
|
|
43
12
|
nonce,
|
|
44
13
|
debugMode,
|
|
45
|
-
|
|
14
|
+
metaPixelId,
|
|
46
15
|
hotjarId,
|
|
16
|
+
redditPixelId,
|
|
47
17
|
facebookAppId,
|
|
48
18
|
reportWebVitals = true
|
|
49
19
|
}) {
|
|
@@ -89,10 +59,10 @@ function Analytics({
|
|
|
89
59
|
}
|
|
90
60
|
)
|
|
91
61
|
] }),
|
|
92
|
-
|
|
62
|
+
metaPixelId && /* @__PURE__ */ jsx(
|
|
93
63
|
Script,
|
|
94
64
|
{
|
|
95
|
-
id: "pixel",
|
|
65
|
+
id: "meta-pixel",
|
|
96
66
|
strategy: "afterInteractive",
|
|
97
67
|
dangerouslySetInnerHTML: {
|
|
98
68
|
__html: `
|
|
@@ -112,11 +82,36 @@ function Analytics({
|
|
|
112
82
|
s = b.getElementsByTagName(e)[0];
|
|
113
83
|
s.parentNode.insertBefore(t, s);
|
|
114
84
|
})(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
|
|
115
|
-
fbq('init', '${
|
|
85
|
+
fbq('init', '${metaPixelId}');
|
|
116
86
|
fbq('track', 'PageView');`
|
|
117
87
|
}
|
|
118
88
|
}
|
|
119
89
|
),
|
|
90
|
+
redditPixelId && /* @__PURE__ */ jsx(
|
|
91
|
+
Script,
|
|
92
|
+
{
|
|
93
|
+
id: "reddit-pixel",
|
|
94
|
+
strategy: "afterInteractive",
|
|
95
|
+
dangerouslySetInnerHTML: {
|
|
96
|
+
__html: `
|
|
97
|
+
!function(w,d) {
|
|
98
|
+
if(!w.rdt) {
|
|
99
|
+
var p = w.rdt = function() {
|
|
100
|
+
p.sendEvent ? p.sendEvent.apply(p,arguments) : p.callQueue.push(arguments)
|
|
101
|
+
};
|
|
102
|
+
p.callQueue = [];
|
|
103
|
+
var t = d.createElement("script");
|
|
104
|
+
t.src = "https://www.redditstatic.com/ads/pixel.js";
|
|
105
|
+
t.async = !0;
|
|
106
|
+
var s = d.getElementsByTagName("script")[0];
|
|
107
|
+
s.parentNode.insertBefore(t,s)
|
|
108
|
+
}
|
|
109
|
+
}(window, document);
|
|
110
|
+
rdt('init', '${redditPixelId}');
|
|
111
|
+
rdt('track', 'PageVisit');`
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
),
|
|
120
115
|
hotjarId && /* @__PURE__ */ jsx(
|
|
121
116
|
Script,
|
|
122
117
|
{
|
|
@@ -139,9 +134,6 @@ function Analytics({
|
|
|
139
134
|
] });
|
|
140
135
|
}
|
|
141
136
|
export {
|
|
142
|
-
Analytics
|
|
143
|
-
sendFBEvent,
|
|
144
|
-
sendGAEvent,
|
|
145
|
-
setGAUser
|
|
137
|
+
Analytics
|
|
146
138
|
};
|
|
147
139
|
//# sourceMappingURL=index.mjs.map
|
package/dist/next/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/next/index.tsx"],"sourcesContent":["'use client';\n\nimport { usePathname } from 'next/navigation';\nimport Script from 'next/script';\nimport { useReportWebVitals } from 'next/web-vitals';\nimport { usePageViewAnalytics } from '../hooks/use-page-view-analytics';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/next/index.tsx"],"sourcesContent":["'use client';\n\nimport { usePathname } from 'next/navigation';\nimport Script from 'next/script';\nimport { useReportWebVitals } from 'next/web-vitals';\nimport { usePageViewAnalytics } from '../hooks/use-page-view-analytics';\nimport { track } from '../track/index';\nimport type { PixelId as MetaPixelId } from '../track/fbq';\nimport type { GaId, GtmId } from '../track/gtag';\nimport type { PixelId as RedditPixelId } from '../track/rdt';\n\ntype HotjarId = `${number}`;\n\ninterface Props {\n gaId?: GaId;\n gtmId?: GtmId;\n hotjarId?: HotjarId;\n metaPixelId?: MetaPixelId;\n redditPixelId?: RedditPixelId;\n facebookAppId?: string;\n nonce?: string;\n debugMode?: boolean;\n reportWebVitals?: boolean;\n}\n\nexport function Analytics({\n gaId,\n nonce,\n debugMode,\n metaPixelId,\n hotjarId,\n redditPixelId,\n facebookAppId,\n reportWebVitals = true,\n}: Props) {\n const pathname = usePathname();\n usePageViewAnalytics(pathname);\n\n useReportWebVitals((metric) => {\n if (!reportWebVitals) return;\n const properties = {\n id: metric.id,\n rating: metric.rating,\n value: metric.value,\n delta: metric.delta,\n navigation_type: metric.navigationType,\n non_interaction: true, // avoids affecting bounce rate.\n };\n track(metric.name, properties);\n });\n\n return (\n <>\n {facebookAppId && <meta property=\"fb:app_id\" content={facebookAppId} />}\n {gaId && (\n <>\n <Script\n id=\"gtag\"\n nonce={nonce}\n src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}\n />\n <Script\n nonce={nonce}\n id=\"gtag-init\"\n dangerouslySetInnerHTML={{\n __html: `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}'${debugMode ? \" ,{ 'debug_mode': true }\" : ''});\n `,\n }}\n />\n </>\n )}\n {metaPixelId && (\n <Script\n id=\"meta-pixel\"\n strategy=\"afterInteractive\"\n dangerouslySetInnerHTML={{\n __html: `\n !(function (f, b, e, v, n, t, s) {\n if (f.fbq) return;\n n = f.fbq = function () {\n n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n n.push = n;\n n.loaded = !0;\n n.version = '2.0';\n n.queue = [];\n t = b.createElement(e);\n t.async = !0;\n t.src = v;\n s = b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t, s);\n })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '${metaPixelId}');\n fbq('track', 'PageView');`,\n }}\n />\n )}\n {redditPixelId && (\n <Script\n id=\"reddit-pixel\"\n strategy=\"afterInteractive\"\n dangerouslySetInnerHTML={{\n __html: `\n !function(w,d) {\n if(!w.rdt) {\n var p = w.rdt = function() {\n p.sendEvent ? p.sendEvent.apply(p,arguments) : p.callQueue.push(arguments)\n };\n p.callQueue = [];\n var t = d.createElement(\"script\");\n t.src = \"https://www.redditstatic.com/ads/pixel.js\";\n t.async = !0;\n var s = d.getElementsByTagName(\"script\")[0];\n s.parentNode.insertBefore(t,s)\n }\n }(window, document);\n rdt('init', '${redditPixelId}');\n rdt('track', 'PageVisit');`,\n }}\n />\n )}\n {hotjarId && (\n <Script\n id=\"hotjar\"\n strategy=\"afterInteractive\"\n dangerouslySetInnerHTML={{\n __html: `\n (function(h,o,t,j,a,r){\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n h._hjSettings={hjid:${hotjarId},hjsv:6};\n a=o.getElementsByTagName('head')[0];\n r=o.createElement('script');r.async=1;\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n a.appendChild(r);\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n `,\n }}\n />\n )}\n </>\n );\n}\n"],"mappings":";;;AAEA,SAAS,mBAAmB;AAC5B,OAAO,YAAY;AACnB,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,aAAa;AA+CE,SAEhB,UAFgB,KAEhB,YAFgB;AA5BjB,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AACpB,GAAU;AACR,QAAM,WAAW,YAAY;AAC7B,uBAAqB,QAAQ;AAE7B,qBAAmB,CAAC,WAAW;AAC7B,QAAI,CAAC,gBAAiB;AACtB,UAAM,aAAa;AAAA,MACjB,IAAI,OAAO;AAAA,MACX,QAAQ,OA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A;AAAA,QAOlC;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -20,17 +20,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/react-router/index.tsx
|
|
21
21
|
var react_router_exports = {};
|
|
22
22
|
__export(react_router_exports, {
|
|
23
|
-
Analytics: () => Analytics
|
|
24
|
-
sendFBEvent: () => sendFBEvent,
|
|
25
|
-
sendGAEvent: () => sendGAEvent,
|
|
26
|
-
setGAUser: () => setGAUser
|
|
23
|
+
Analytics: () => Analytics
|
|
27
24
|
});
|
|
28
25
|
module.exports = __toCommonJS(react_router_exports);
|
|
29
26
|
var import_react = require("react");
|
|
30
27
|
var import_react_router = require("react-router");
|
|
31
28
|
var import_web_vitals = require("web-vitals");
|
|
32
29
|
var import_use_page_view_analytics = require("../hooks/use-page-view-analytics.cjs");
|
|
33
|
-
var import_fbq = require("../track/fbq.cjs");
|
|
34
30
|
var import_track = require("../track/index.cjs");
|
|
35
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
32
|
function useReportWebVitals(reportWebVitalsFn) {
|
|
@@ -42,41 +38,12 @@ function useReportWebVitals(reportWebVitalsFn) {
|
|
|
42
38
|
(0, import_web_vitals.onTTFB)(reportWebVitalsFn);
|
|
43
39
|
}, [reportWebVitalsFn]);
|
|
44
40
|
}
|
|
45
|
-
function sendGAEvent(name, properties) {
|
|
46
|
-
if (typeof window === "undefined" || !window.gtag) {
|
|
47
|
-
console.warn("gtag has not been initialized");
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
window.gtag("event", name, properties);
|
|
51
|
-
}
|
|
52
|
-
function setGAUser({ user_id, data, properties }) {
|
|
53
|
-
if (!window.gtag) {
|
|
54
|
-
console.warn("GA has not been initialized");
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (user_id) window.gtag("set", "user_id", user_id);
|
|
58
|
-
if (data) window.gtag("set", "user_data", data);
|
|
59
|
-
if (properties) window.gtag("set", "user_properties", properties);
|
|
60
|
-
}
|
|
61
|
-
function sendFBEvent(name, properties, event_id) {
|
|
62
|
-
if (typeof window === "undefined" || !window.fbq) {
|
|
63
|
-
console.warn("fbq has not been initialized");
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const { fbq } = window;
|
|
67
|
-
const options = { eventID: event_id };
|
|
68
|
-
const [type, fbEventName, fbEventProperties] = (0, import_fbq.mapFBEvent)(name, properties);
|
|
69
|
-
if (type === "track") {
|
|
70
|
-
fbq(type, fbEventName, fbEventProperties, options);
|
|
71
|
-
} else {
|
|
72
|
-
fbq(type, fbEventName, fbEventProperties, options);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
41
|
function Analytics({
|
|
76
42
|
gaId,
|
|
77
43
|
nonce,
|
|
78
44
|
debugMode,
|
|
79
|
-
|
|
45
|
+
metaPixelId,
|
|
46
|
+
redditPixelId,
|
|
80
47
|
hotjarId,
|
|
81
48
|
facebookAppId,
|
|
82
49
|
reportWebVitals = true
|
|
@@ -125,11 +92,11 @@ function Analytics({
|
|
|
125
92
|
}
|
|
126
93
|
)
|
|
127
94
|
] }),
|
|
128
|
-
|
|
95
|
+
metaPixelId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
129
96
|
"script",
|
|
130
97
|
{
|
|
131
98
|
async: true,
|
|
132
|
-
id: "pixel",
|
|
99
|
+
id: "meta-pixel",
|
|
133
100
|
dangerouslySetInnerHTML: {
|
|
134
101
|
__html: `
|
|
135
102
|
!(function (f, b, e, v, n, t, s) {
|
|
@@ -148,11 +115,36 @@ function Analytics({
|
|
|
148
115
|
s = b.getElementsByTagName(e)[0];
|
|
149
116
|
s.parentNode.insertBefore(t, s);
|
|
150
117
|
})(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
|
|
151
|
-
fbq('init', '${
|
|
118
|
+
fbq('init', '${metaPixelId}');
|
|
152
119
|
fbq('track', 'PageView');`
|
|
153
120
|
}
|
|
154
121
|
}
|
|
155
122
|
),
|
|
123
|
+
redditPixelId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
124
|
+
"script",
|
|
125
|
+
{
|
|
126
|
+
async: true,
|
|
127
|
+
id: "reddit-pixel",
|
|
128
|
+
dangerouslySetInnerHTML: {
|
|
129
|
+
__html: `
|
|
130
|
+
!function(w,d) {
|
|
131
|
+
if(!w.rdt) {
|
|
132
|
+
var p = w.rdt = function() {
|
|
133
|
+
p.sendEvent ? p.sendEvent.apply(p,arguments) : p.callQueue.push(arguments)
|
|
134
|
+
};
|
|
135
|
+
p.callQueue = [];
|
|
136
|
+
var t = d.createElement("script");
|
|
137
|
+
t.src = "https://www.redditstatic.com/ads/pixel.js";
|
|
138
|
+
t.async = !0;
|
|
139
|
+
var s = d.getElementsByTagName("script")[0];
|
|
140
|
+
s.parentNode.insertBefore(t,s)
|
|
141
|
+
}
|
|
142
|
+
}(window, document);
|
|
143
|
+
rdt('init', '${redditPixelId}');
|
|
144
|
+
rdt('track', 'PageVisit');`
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
),
|
|
156
148
|
hotjarId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
149
|
"script",
|
|
158
150
|
{
|
|
@@ -176,9 +168,6 @@ function Analytics({
|
|
|
176
168
|
}
|
|
177
169
|
// Annotate the CommonJS export names for ESM import in node:
|
|
178
170
|
0 && (module.exports = {
|
|
179
|
-
Analytics
|
|
180
|
-
sendFBEvent,
|
|
181
|
-
sendGAEvent,
|
|
182
|
-
setGAUser
|
|
171
|
+
Analytics
|
|
183
172
|
});
|
|
184
173
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/react-router/index.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { useLocation } from 'react-router';\nimport { type Metric, onCLS, onFCP, onINP, onLCP, onTTFB } from 'web-vitals';\nimport { usePageViewAnalytics } from '../hooks/use-page-view-analytics';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/react-router/index.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { useLocation } from 'react-router';\nimport { type Metric, onCLS, onFCP, onINP, onLCP, onTTFB } from 'web-vitals';\nimport { usePageViewAnalytics } from '../hooks/use-page-view-analytics';\nimport { track } from '../track/index';\nimport type { PixelId as MetaPixelId } from '../track/fbq';\nimport type { GaId, GtmId } from '../track/gtag';\nimport type { PixelId as RedditPixelId } from '../track/rdt';\n\ntype HotjarId = `${number}`;\n\nfunction useReportWebVitals(reportWebVitalsFn: (metric: Metric) => void) {\n useEffect(() => {\n onCLS(reportWebVitalsFn);\n onLCP(reportWebVitalsFn);\n onINP(reportWebVitalsFn);\n onFCP(reportWebVitalsFn);\n onTTFB(reportWebVitalsFn);\n }, [reportWebVitalsFn]);\n}\n\ninterface Props {\n gaId?: GaId;\n gtmId?: GtmId;\n metaPixelId?: MetaPixelId;\n redditPixelId?: RedditPixelId;\n hotjarId?: HotjarId;\n facebookAppId?: string;\n nonce?: string;\n debugMode?: boolean;\n reportWebVitals?: boolean;\n}\n\nexport function Analytics({\n gaId,\n nonce,\n debugMode,\n metaPixelId,\n redditPixelId,\n hotjarId,\n facebookAppId,\n reportWebVitals = true,\n}: Props) {\n const { pathname } = useLocation();\n usePageViewAnalytics(pathname);\n\n useReportWebVitals((metric) => {\n if (!reportWebVitals) return;\n const properties = {\n id: metric.id,\n rating: metric.rating,\n value: metric.value,\n delta: metric.delta,\n navigation_type: metric.navigationType,\n non_interaction: true, // avoids affecting bounce rate.\n };\n track(metric.name, properties);\n });\n\n return (\n <>\n {facebookAppId && <meta property=\"fb:app_id\" content={facebookAppId} />}\n {gaId && (\n <>\n <script\n async\n id=\"gtag\"\n nonce={nonce}\n src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}\n />\n <script\n async\n nonce={nonce}\n id=\"gtag-init\"\n dangerouslySetInnerHTML={{\n __html: `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}'${debugMode ? \" ,{ 'debug_mode': true }\" : ''});\n `,\n }}\n />\n </>\n )}\n {metaPixelId && (\n <script\n async\n id=\"meta-pixel\"\n dangerouslySetInnerHTML={{\n __html: `\n !(function (f, b, e, v, n, t, s) {\n if (f.fbq) return;\n n = f.fbq = function () {\n n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n n.push = n;\n n.loaded = !0;\n n.version = '2.0';\n n.queue = [];\n t = b.createElement(e);\n t.async = !0;\n t.src = v;\n s = b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t, s);\n })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '${metaPixelId}');\n fbq('track', 'PageView');`,\n }}\n />\n )}\n {redditPixelId && (\n <script\n async\n id=\"reddit-pixel\"\n dangerouslySetInnerHTML={{\n __html: `\n !function(w,d) {\n if(!w.rdt) {\n var p = w.rdt = function() {\n p.sendEvent ? p.sendEvent.apply(p,arguments) : p.callQueue.push(arguments)\n };\n p.callQueue = [];\n var t = d.createElement(\"script\");\n t.src = \"https://www.redditstatic.com/ads/pixel.js\";\n t.async = !0;\n var s = d.getElementsByTagName(\"script\")[0];\n s.parentNode.insertBefore(t,s)\n }\n }(window, document);\n rdt('init', '${redditPixelId}');\n rdt('track', 'PageVisit');`,\n }}\n />\n )}\n {hotjarId && (\n <script\n async\n id=\"hotjar\"\n dangerouslySetInnerHTML={{\n __html: `\n (function(h,o,t,j,a,r){\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n h._hjSettings={hjid:${hotjarId},hjsv:6};\n a=o.getElementsByTagName('head')[0];\n r=o.createElement('script');r.async=1;\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n a.appendChild(r);\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n `,\n }}\n />\n )}\n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A;AAAA,MACF;AAAA,OACF;AAAA,IAED,eACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAK;AAAA,QACL,IAAG;AAAA,QACH,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAiBO,WAAW;AAAA;AAAA,QAE5B;AAAA;AAAA,IACF;AAAA,IAED,iBACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAK;AAAA,QACL,IAAG;AAAA,QACH,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAcO,aAAa;AAAA;AAAA,QAE9B;AAAA;AAAA,IACF;AAAA,IAED,YACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAK;AAAA,QACL,IAAG;AAAA,QACH,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA;AAAA,oCAGgB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOlC;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
2
|
+
import { PixelId } from '../track/fbq.cjs';
|
|
3
|
+
import { GaId, GtmId } from '../track/gtag.cjs';
|
|
4
|
+
import { PixelId as PixelId$1 } from '../track/rdt.cjs';
|
|
5
|
+
import '../track/types.cjs';
|
|
6
6
|
|
|
7
7
|
type HotjarId = `${number}`;
|
|
8
|
-
declare global {
|
|
9
|
-
interface Window extends Gtag, Pixel {
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
8
|
interface Props {
|
|
13
9
|
gaId?: GaId;
|
|
14
10
|
gtmId?: GtmId;
|
|
15
|
-
|
|
11
|
+
metaPixelId?: PixelId;
|
|
12
|
+
redditPixelId?: PixelId$1;
|
|
16
13
|
hotjarId?: HotjarId;
|
|
17
14
|
facebookAppId?: string;
|
|
18
15
|
nonce?: string;
|
|
19
16
|
debugMode?: boolean;
|
|
20
17
|
reportWebVitals?: boolean;
|
|
21
18
|
}
|
|
22
|
-
declare function
|
|
23
|
-
declare function setGAUser({ user_id, data, properties }: UpdateVisitorDTO): void;
|
|
24
|
-
declare function sendFBEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, event_id?: string): void;
|
|
25
|
-
declare function Analytics({ gaId, nonce, debugMode, pixelId, hotjarId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
|
|
19
|
+
declare function Analytics({ gaId, nonce, debugMode, metaPixelId, redditPixelId, hotjarId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
|
|
26
20
|
|
|
27
|
-
export { Analytics
|
|
21
|
+
export { Analytics };
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
2
|
+
import { PixelId } from '../track/fbq.js';
|
|
3
|
+
import { GaId, GtmId } from '../track/gtag.js';
|
|
4
|
+
import { PixelId as PixelId$1 } from '../track/rdt.js';
|
|
5
|
+
import '../track/types.js';
|
|
6
6
|
|
|
7
7
|
type HotjarId = `${number}`;
|
|
8
|
-
declare global {
|
|
9
|
-
interface Window extends Gtag, Pixel {
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
8
|
interface Props {
|
|
13
9
|
gaId?: GaId;
|
|
14
10
|
gtmId?: GtmId;
|
|
15
|
-
|
|
11
|
+
metaPixelId?: PixelId;
|
|
12
|
+
redditPixelId?: PixelId$1;
|
|
16
13
|
hotjarId?: HotjarId;
|
|
17
14
|
facebookAppId?: string;
|
|
18
15
|
nonce?: string;
|
|
19
16
|
debugMode?: boolean;
|
|
20
17
|
reportWebVitals?: boolean;
|
|
21
18
|
}
|
|
22
|
-
declare function
|
|
23
|
-
declare function setGAUser({ user_id, data, properties }: UpdateVisitorDTO): void;
|
|
24
|
-
declare function sendFBEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, event_id?: string): void;
|
|
25
|
-
declare function Analytics({ gaId, nonce, debugMode, pixelId, hotjarId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
|
|
19
|
+
declare function Analytics({ gaId, nonce, debugMode, metaPixelId, redditPixelId, hotjarId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
|
|
26
20
|
|
|
27
|
-
export { Analytics
|
|
21
|
+
export { Analytics };
|