@shware/analytics 2.8.2 → 2.8.3
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/next/index.cjs +1 -1
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.mjs +1 -1
- package/dist/next/index.mjs.map +1 -1
- package/dist/react-router/index.cjs +1 -1
- package/dist/react-router/index.cjs.map +1 -1
- package/dist/react-router/index.mjs +1 -1
- package/dist/react-router/index.mjs.map +1 -1
- package/dist/third-parties/meta-pixel.cjs +2 -0
- package/dist/third-parties/meta-pixel.cjs.map +1 -1
- package/dist/third-parties/meta-pixel.mjs +2 -0
- package/dist/third-parties/meta-pixel.mjs.map +1 -1
- package/dist/third-parties/reddit-pixel.cjs +2 -0
- package/dist/third-parties/reddit-pixel.cjs.map +1 -1
- package/dist/third-parties/reddit-pixel.mjs +2 -0
- package/dist/third-parties/reddit-pixel.mjs.map +1 -1
- package/package.json +1 -1
package/dist/next/index.cjs
CHANGED
|
@@ -63,7 +63,7 @@ function Analytics({
|
|
|
63
63
|
non_interaction: true
|
|
64
64
|
// avoids affecting bounce rate.
|
|
65
65
|
};
|
|
66
|
-
(0, import_track.track)(metric.name, properties
|
|
66
|
+
(0, import_track.track)(metric.name, properties);
|
|
67
67
|
});
|
|
68
68
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
69
69
|
facebookAppId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("meta", { property: "fb:app_id", content: facebookAppId }),
|
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 { 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
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wBAA4B;AAC5B,oBAAmB;AACnB,wBAAmC;AACnC,qCAAqC;AACrC,mBAAsB;AA+CE;AA5BjB,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AACpB,GAAU;AACR,QAAM,eAAW,+BAAY;AAC7B,2DAAqB,QAAQ;AAE7B,4CAAmB,CAAC,WAAW;AAC7B,QAAI,CAAC,gBAAiB;AACtB,UAAM,aAAa;AAAA,MACjB,IAAI,OAAO;AAAA,MACX,QAAQ,OAAO;AAAA,MACf,OAAO,OAAO;AAAA,MACd,OAAO,OAAO;AAAA,MACd,iBAAiB,OAAO;AAAA,MACxB,iBAAiB;AAAA;AAAA,IACnB;AACA,4BAAM,OAAO,MAAM,UAAU;AAAA,EAC/B,CAAC;AAED,SACE,4EACG;AAAA,qBAAiB,4CAAC,UAAK,UAAS,aAAY,SAAS,eAAe;AAAA,IACpE,QACC,4EACE;AAAA;AAAA,QAAC,cAAAA;AAAA,QAAA;AAAA,UACC,IAAG;AAAA,UACH;AAAA,UACA,KAAK,+CAA+C,IAAI;AAAA;AAAA,MAC1D;AAAA,MACA;AAAA,QAAC,cAAAA;AAAA,QAAA;AAAA,UACC;AAAA,UACA,IAAG;AAAA,UACH,yBAAyB;AAAA,YACvB,QAAQ;AAAA;AAAA;AAAA;AAAA,gCAIU,IAAI,IAAI,YAAY,6BAA6B,EAAE;AAAA;AAAA,UAEvE;AAAA;AAAA,MACF;AAAA,OACF;AAAA,IAED,eACC;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;AAAA;AAAA;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.mjs
CHANGED
|
@@ -30,7 +30,7 @@ function Analytics({
|
|
|
30
30
|
non_interaction: true
|
|
31
31
|
// avoids affecting bounce rate.
|
|
32
32
|
};
|
|
33
|
-
track(metric.name, properties
|
|
33
|
+
track(metric.name, properties);
|
|
34
34
|
});
|
|
35
35
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
36
|
facebookAppId && /* @__PURE__ */ jsx("meta", { property: "fb:app_id", content: facebookAppId }),
|
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 { 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
|
|
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,OAAO;AAAA,MACf,OAAO,OAAO;AAAA,MACd,OAAO,OAAO;AAAA,MACd,iBAAiB,OAAO;AAAA,MACxB,iBAAiB;AAAA;AAAA,IACnB;AACA,UAAM,OAAO,MAAM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affecting bounce rate.
|
|
63
63
|
};
|
|
64
|
-
(0, import_track.track)(metric.name, properties
|
|
64
|
+
(0, import_track.track)(metric.name, properties);
|
|
65
65
|
});
|
|
66
66
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
67
67
|
facebookAppId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("meta", { property: "fb:app_id", content: facebookAppId }),
|
|
@@ -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 { 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
|
|
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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EvE;AAAA;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":[]}
|
|
@@ -37,7 +37,7 @@ function Analytics({
|
|
|
37
37
|
non_interaction: true
|
|
38
38
|
// avoids affecting bounce rate.
|
|
39
39
|
};
|
|
40
|
-
track(metric.name, properties
|
|
40
|
+
track(metric.name, properties);
|
|
41
41
|
});
|
|
42
42
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
43
43
|
facebookAppId && /* @__PURE__ */ jsx("meta", { property: "fb:app_id", content: facebookAppId }),
|
|
@@ -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 { 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
|
|
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 </>\n );\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAsB,OAAO,OAAO,OAAO,OAAO,cAAc;AAChE,SAAS,4BAA4B;AACrC,SAAS,aAAa;AAyDE,SAEhB,UAFgB,KAEhB,YAFgB;AAlDxB,SAAS,mBAAmB,mBAA6C;AACvE,YAAU,MAAM;AACd,UAAM,iBAAiB;AACvB,UAAM,iBAAiB;AACvB,UAAM,iBAAiB;AACvB,UAAM,iBAAiB;AACvB,WAAO,iBAAiB;AAAA,EAC1B,GAAG,CAAC,iBAAiB,CAAC;AACxB;AAcO,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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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":[]}
|
|
@@ -26,11 +26,13 @@ __export(meta_pixel_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(meta_pixel_exports);
|
|
27
27
|
var import_fbq = require("../track/fbq.cjs");
|
|
28
28
|
var import_field = require("../utils/field.cjs");
|
|
29
|
+
var metrics = ["CLS", "FCP", "INP", "LCP", "TTFB"];
|
|
29
30
|
function sendFBEvent(name, properties, event_id) {
|
|
30
31
|
if (typeof window === "undefined" || !window.fbq) {
|
|
31
32
|
console.warn("fbq has not been initialized");
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
35
|
+
if (metrics.includes(name)) return;
|
|
34
36
|
const { fbq } = window;
|
|
35
37
|
const options = { eventID: event_id };
|
|
36
38
|
const [type, fbEventName, fbEventProperties] = (0, import_fbq.mapFBEvent)(name, properties);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/third-parties/meta-pixel.ts"],"sourcesContent":["import { PixelId, mapFBEvent } from '../track/fbq';\nimport { getFirst } from '../utils/field';\nimport type { FBQ } from '../track/fbq';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends FBQ {}\n}\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function setFBUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n\n const address = getFirst(data?.address);\n\n window.fbq('init', pixelId, {\n em: getFirst(data?.email),\n fn: address?.first_name,\n ln: address?.last_name,\n ph: getFirst(data?.phone_number),\n external_id: user_id,\n ct: address?.city,\n st: address?.street,\n zp: address?.postal_code,\n country: address?.country,\n });\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoC;AACpC,mBAAyB;
|
|
1
|
+
{"version":3,"sources":["../../src/third-parties/meta-pixel.ts"],"sourcesContent":["import { PixelId, mapFBEvent } from '../track/fbq';\nimport { getFirst } from '../utils/field';\nimport type { FBQ } from '../track/fbq';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends FBQ {}\n}\n\nconst metrics = ['CLS', 'FCP', 'INP', 'LCP', 'TTFB'];\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n if (metrics.includes(name)) return;\n\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function setFBUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n\n const address = getFirst(data?.address);\n\n window.fbq('init', pixelId, {\n em: getFirst(data?.email),\n fn: address?.first_name,\n ln: address?.last_name,\n ph: getFirst(data?.phone_number),\n external_id: user_id,\n ct: address?.city,\n st: address?.street,\n zp: address?.postal_code,\n country: address?.country,\n });\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoC;AACpC,mBAAyB;AASzB,IAAM,UAAU,CAAC,OAAO,OAAO,OAAO,OAAO,MAAM;AAE5C,SAAS,YACd,MACA,YACA,UACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,YAAQ,KAAK,8BAA8B;AAC3C;AAAA,EACF;AACA,MAAI,QAAQ,SAAS,IAAI,EAAG;AAE5B,QAAM,EAAE,IAAI,IAAI;AAChB,QAAM,UAAU,EAAE,SAAS,SAAS;AACpC,QAAM,CAAC,MAAM,aAAa,iBAAiB,QAAI,uBAAW,MAAM,UAAU;AAC1E,MAAI,SAAS,SAAS;AACpB,QAAI,MAAM,aAAa,mBAAmB,OAAO;AAAA,EACnD,OAAO;AACL,QAAI,MAAM,aAAa,mBAAmB,OAAO;AAAA,EACnD;AACF;AAEO,SAAS,UAAU,SAAkB;AAC1C,SAAO,CAAC,EAAE,SAAS,KAAK,MAAwB;AAC9C,QAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,cAAQ,KAAK,8BAA8B;AAC3C;AAAA,IACF;AAEA,UAAM,cAAU,uBAAS,6BAAM,OAAO;AAEtC,WAAO,IAAI,QAAQ,SAAS;AAAA,MAC1B,QAAI,uBAAS,6BAAM,KAAK;AAAA,MACxB,IAAI,mCAAS;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,QAAI,uBAAS,6BAAM,YAAY;AAAA,MAC/B,aAAa;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,SAAS,mCAAS;AAAA,IACpB,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// src/third-parties/meta-pixel.ts
|
|
2
2
|
import { mapFBEvent } from "../track/fbq.mjs";
|
|
3
3
|
import { getFirst } from "../utils/field.mjs";
|
|
4
|
+
var metrics = ["CLS", "FCP", "INP", "LCP", "TTFB"];
|
|
4
5
|
function sendFBEvent(name, properties, event_id) {
|
|
5
6
|
if (typeof window === "undefined" || !window.fbq) {
|
|
6
7
|
console.warn("fbq has not been initialized");
|
|
7
8
|
return;
|
|
8
9
|
}
|
|
10
|
+
if (metrics.includes(name)) return;
|
|
9
11
|
const { fbq } = window;
|
|
10
12
|
const options = { eventID: event_id };
|
|
11
13
|
const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/third-parties/meta-pixel.ts"],"sourcesContent":["import { PixelId, mapFBEvent } from '../track/fbq';\nimport { getFirst } from '../utils/field';\nimport type { FBQ } from '../track/fbq';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends FBQ {}\n}\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function setFBUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n\n const address = getFirst(data?.address);\n\n window.fbq('init', pixelId, {\n em: getFirst(data?.email),\n fn: address?.first_name,\n ln: address?.last_name,\n ph: getFirst(data?.phone_number),\n external_id: user_id,\n ct: address?.city,\n st: address?.street,\n zp: address?.postal_code,\n country: address?.country,\n });\n };\n}\n"],"mappings":";AAAA,SAAkB,kBAAkB;AACpC,SAAS,gBAAgB;
|
|
1
|
+
{"version":3,"sources":["../../src/third-parties/meta-pixel.ts"],"sourcesContent":["import { PixelId, mapFBEvent } from '../track/fbq';\nimport { getFirst } from '../utils/field';\nimport type { FBQ } from '../track/fbq';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends FBQ {}\n}\n\nconst metrics = ['CLS', 'FCP', 'INP', 'LCP', 'TTFB'];\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n if (metrics.includes(name)) return;\n\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function setFBUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n\n const address = getFirst(data?.address);\n\n window.fbq('init', pixelId, {\n em: getFirst(data?.email),\n fn: address?.first_name,\n ln: address?.last_name,\n ph: getFirst(data?.phone_number),\n external_id: user_id,\n ct: address?.city,\n st: address?.street,\n zp: address?.postal_code,\n country: address?.country,\n });\n };\n}\n"],"mappings":";AAAA,SAAkB,kBAAkB;AACpC,SAAS,gBAAgB;AASzB,IAAM,UAAU,CAAC,OAAO,OAAO,OAAO,OAAO,MAAM;AAE5C,SAAS,YACd,MACA,YACA,UACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,YAAQ,KAAK,8BAA8B;AAC3C;AAAA,EACF;AACA,MAAI,QAAQ,SAAS,IAAI,EAAG;AAE5B,QAAM,EAAE,IAAI,IAAI;AAChB,QAAM,UAAU,EAAE,SAAS,SAAS;AACpC,QAAM,CAAC,MAAM,aAAa,iBAAiB,IAAI,WAAW,MAAM,UAAU;AAC1E,MAAI,SAAS,SAAS;AACpB,QAAI,MAAM,aAAa,mBAAmB,OAAO;AAAA,EACnD,OAAO;AACL,QAAI,MAAM,aAAa,mBAAmB,OAAO;AAAA,EACnD;AACF;AAEO,SAAS,UAAU,SAAkB;AAC1C,SAAO,CAAC,EAAE,SAAS,KAAK,MAAwB;AAC9C,QAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,cAAQ,KAAK,8BAA8B;AAC3C;AAAA,IACF;AAEA,UAAM,UAAU,SAAS,6BAAM,OAAO;AAEtC,WAAO,IAAI,QAAQ,SAAS;AAAA,MAC1B,IAAI,SAAS,6BAAM,KAAK;AAAA,MACxB,IAAI,mCAAS;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,IAAI,SAAS,6BAAM,YAAY;AAAA,MAC/B,aAAa;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,SAAS,mCAAS;AAAA,IACpB,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -26,11 +26,13 @@ __export(reddit_pixel_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(reddit_pixel_exports);
|
|
27
27
|
var import_rdt = require("../track/rdt.cjs");
|
|
28
28
|
var import_field = require("../utils/field.cjs");
|
|
29
|
+
var metrics = ["CLS", "FCP", "INP", "LCP", "TTFB"];
|
|
29
30
|
function sendRDTEvent(name, properties, eventId) {
|
|
30
31
|
if (typeof window === "undefined" || !window.rdt) {
|
|
31
32
|
console.warn("rdt has not been initialized");
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
35
|
+
if (metrics.includes(name)) return;
|
|
34
36
|
const { rdt } = window;
|
|
35
37
|
const [type, params] = (0, import_rdt.mapRDTEvent)(name, properties, eventId);
|
|
36
38
|
if (type === "Custom") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/third-parties/reddit-pixel.ts"],"sourcesContent":["import { mapRDTEvent } from '../track/rdt';\nimport { getFirst } from '../utils/field';\nimport type { PixelId, RDT } from '../track/rdt';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends RDT {}\n}\n\nexport function sendRDTEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n\n const { rdt } = window;\n const [type, params] = mapRDTEvent(name, properties, eventId);\n if (type === 'Custom') {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n } else {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n }\n}\n\nexport function setRDTUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (!window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n\n window.rdt('init', pixelId, {\n email: getFirst(data?.email),\n phoneNumber: getFirst(data?.phone_number),\n externalId: user_id,\n });\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA4B;AAC5B,mBAAyB;
|
|
1
|
+
{"version":3,"sources":["../../src/third-parties/reddit-pixel.ts"],"sourcesContent":["import { mapRDTEvent } from '../track/rdt';\nimport { getFirst } from '../utils/field';\nimport type { PixelId, RDT } from '../track/rdt';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends RDT {}\n}\n\nconst metrics = ['CLS', 'FCP', 'INP', 'LCP', 'TTFB'];\n\nexport function sendRDTEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n if (metrics.includes(name)) return;\n\n const { rdt } = window;\n const [type, params] = mapRDTEvent(name, properties, eventId);\n if (type === 'Custom') {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n } else {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n }\n}\n\nexport function setRDTUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (!window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n\n window.rdt('init', pixelId, {\n email: getFirst(data?.email),\n phoneNumber: getFirst(data?.phone_number),\n externalId: user_id,\n });\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA4B;AAC5B,mBAAyB;AASzB,IAAM,UAAU,CAAC,OAAO,OAAO,OAAO,OAAO,MAAM;AAE5C,SAAS,aACd,MACA,YACA,SACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,YAAQ,KAAK,8BAA8B;AAC3C;AAAA,EACF;AACA,MAAI,QAAQ,SAAS,IAAI,EAAG;AAE5B,QAAM,EAAE,IAAI,IAAI;AAChB,QAAM,CAAC,MAAM,MAAM,QAAI,wBAAY,MAAM,YAAY,OAAO;AAC5D,MAAI,SAAS,UAAU;AACrB,QAAI,SAAS,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;AAAA,EACvD,OAAO;AACL,QAAI,SAAS,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;AAAA,EACvD;AACF;AAEO,SAAS,WAAW,SAAkB;AAC3C,SAAO,CAAC,EAAE,SAAS,KAAK,MAAwB;AAC9C,QAAI,CAAC,OAAO,KAAK;AACf,cAAQ,KAAK,8BAA8B;AAC3C;AAAA,IACF;AAEA,WAAO,IAAI,QAAQ,SAAS;AAAA,MAC1B,WAAO,uBAAS,6BAAM,KAAK;AAAA,MAC3B,iBAAa,uBAAS,6BAAM,YAAY;AAAA,MACxC,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// src/third-parties/reddit-pixel.ts
|
|
2
2
|
import { mapRDTEvent } from "../track/rdt.mjs";
|
|
3
3
|
import { getFirst } from "../utils/field.mjs";
|
|
4
|
+
var metrics = ["CLS", "FCP", "INP", "LCP", "TTFB"];
|
|
4
5
|
function sendRDTEvent(name, properties, eventId) {
|
|
5
6
|
if (typeof window === "undefined" || !window.rdt) {
|
|
6
7
|
console.warn("rdt has not been initialized");
|
|
7
8
|
return;
|
|
8
9
|
}
|
|
10
|
+
if (metrics.includes(name)) return;
|
|
9
11
|
const { rdt } = window;
|
|
10
12
|
const [type, params] = mapRDTEvent(name, properties, eventId);
|
|
11
13
|
if (type === "Custom") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/third-parties/reddit-pixel.ts"],"sourcesContent":["import { mapRDTEvent } from '../track/rdt';\nimport { getFirst } from '../utils/field';\nimport type { PixelId, RDT } from '../track/rdt';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends RDT {}\n}\n\nexport function sendRDTEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n\n const { rdt } = window;\n const [type, params] = mapRDTEvent(name, properties, eventId);\n if (type === 'Custom') {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n } else {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n }\n}\n\nexport function setRDTUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (!window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n\n window.rdt('init', pixelId, {\n email: getFirst(data?.email),\n phoneNumber: getFirst(data?.phone_number),\n externalId: user_id,\n });\n };\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;
|
|
1
|
+
{"version":3,"sources":["../../src/third-parties/reddit-pixel.ts"],"sourcesContent":["import { mapRDTEvent } from '../track/rdt';\nimport { getFirst } from '../utils/field';\nimport type { PixelId, RDT } from '../track/rdt';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends RDT {}\n}\n\nconst metrics = ['CLS', 'FCP', 'INP', 'LCP', 'TTFB'];\n\nexport function sendRDTEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n if (metrics.includes(name)) return;\n\n const { rdt } = window;\n const [type, params] = mapRDTEvent(name, properties, eventId);\n if (type === 'Custom') {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n } else {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n }\n}\n\nexport function setRDTUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (!window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n\n window.rdt('init', pixelId, {\n email: getFirst(data?.email),\n phoneNumber: getFirst(data?.phone_number),\n externalId: user_id,\n });\n };\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AASzB,IAAM,UAAU,CAAC,OAAO,OAAO,OAAO,OAAO,MAAM;AAE5C,SAAS,aACd,MACA,YACA,SACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,YAAQ,KAAK,8BAA8B;AAC3C;AAAA,EACF;AACA,MAAI,QAAQ,SAAS,IAAI,EAAG;AAE5B,QAAM,EAAE,IAAI,IAAI;AAChB,QAAM,CAAC,MAAM,MAAM,IAAI,YAAY,MAAM,YAAY,OAAO;AAC5D,MAAI,SAAS,UAAU;AACrB,QAAI,SAAS,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;AAAA,EACvD,OAAO;AACL,QAAI,SAAS,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;AAAA,EACvD;AACF;AAEO,SAAS,WAAW,SAAkB;AAC3C,SAAO,CAAC,EAAE,SAAS,KAAK,MAAwB;AAC9C,QAAI,CAAC,OAAO,KAAK;AACf,cAAQ,KAAK,8BAA8B;AAC3C;AAAA,IACF;AAEA,WAAO,IAAI,QAAQ,SAAS;AAAA,MAC1B,OAAO,SAAS,6BAAM,KAAK;AAAA,MAC3B,aAAa,SAAS,6BAAM,YAAY;AAAA,MACxC,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACF;","names":[]}
|