@shware/analytics 16.3.4 → 16.3.5
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 +2 -1
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts.map +1 -1
- package/dist/next/index.d.mts.map +1 -1
- package/dist/next/index.mjs +2 -1
- package/dist/next/index.mjs.map +1 -1
- package/dist/third-parties/analytics-props.cjs +2 -1
- package/dist/third-parties/analytics-props.cjs.map +1 -1
- package/dist/third-parties/analytics-props.mjs +2 -1
- package/dist/third-parties/analytics-props.mjs.map +1 -1
- package/dist/third-parties/index.cjs +1 -0
- package/dist/third-parties/index.d.cts +2 -2
- package/dist/third-parties/index.d.mts +2 -2
- package/dist/third-parties/index.mjs +2 -2
- package/dist/third-parties/integration.cjs +31 -0
- package/dist/third-parties/integration.cjs.map +1 -1
- package/dist/third-parties/integration.d.cts +16 -0
- package/dist/third-parties/integration.d.cts.map +1 -1
- package/dist/third-parties/integration.d.mts +16 -0
- package/dist/third-parties/integration.d.mts.map +1 -1
- package/dist/third-parties/integration.mjs +29 -1
- package/dist/third-parties/integration.mjs.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.cjs +2 -2
- package/dist/third-parties/linkedin-insight-tag.cjs.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.d.cts.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.d.mts.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.mjs +2 -2
- package/dist/third-parties/linkedin-insight-tag.mjs.map +1 -1
- package/dist/third-parties/meta-pixel.cjs +1 -2
- package/dist/third-parties/meta-pixel.cjs.map +1 -1
- package/dist/third-parties/meta-pixel.d.cts.map +1 -1
- package/dist/third-parties/meta-pixel.d.mts.map +1 -1
- package/dist/third-parties/meta-pixel.mjs +2 -3
- package/dist/third-parties/meta-pixel.mjs.map +1 -1
- package/dist/third-parties/microsoft-uet.cjs +2 -5
- package/dist/third-parties/microsoft-uet.cjs.map +1 -1
- package/dist/third-parties/microsoft-uet.d.cts.map +1 -1
- package/dist/third-parties/microsoft-uet.d.mts.map +1 -1
- package/dist/third-parties/microsoft-uet.mjs +3 -6
- package/dist/third-parties/microsoft-uet.mjs.map +1 -1
- package/dist/third-parties/openai-pixel.cjs +1 -2
- package/dist/third-parties/openai-pixel.cjs.map +1 -1
- package/dist/third-parties/openai-pixel.d.cts.map +1 -1
- package/dist/third-parties/openai-pixel.d.mts.map +1 -1
- package/dist/third-parties/openai-pixel.mjs +2 -3
- package/dist/third-parties/openai-pixel.mjs.map +1 -1
- package/dist/third-parties/posthog.cjs +2 -2
- package/dist/third-parties/posthog.cjs.map +1 -1
- package/dist/third-parties/posthog.d.cts.map +1 -1
- package/dist/third-parties/posthog.d.mts.map +1 -1
- package/dist/third-parties/posthog.mjs +2 -2
- package/dist/third-parties/posthog.mjs.map +1 -1
- package/dist/third-parties/reddit-pixel.cjs +1 -2
- package/dist/third-parties/reddit-pixel.cjs.map +1 -1
- package/dist/third-parties/reddit-pixel.d.cts.map +1 -1
- package/dist/third-parties/reddit-pixel.d.mts.map +1 -1
- package/dist/third-parties/reddit-pixel.mjs +2 -3
- package/dist/third-parties/reddit-pixel.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reddit-pixel.cjs","names":["mapRDTEvent","getFirst","adsTracker","adEvents","isStandardRDTEvent"],"sources":["../../src/third-parties/reddit-pixel.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport { type PixelId, type RDT, isStandardRDTEvent, mapRDTEvent } from '../track/rdt';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { getFirst } from '../utils/field';\nimport {
|
|
1
|
+
{"version":3,"file":"reddit-pixel.cjs","names":["isLocalHost","mapRDTEvent","getFirst","adsTracker","adEvents","isStandardRDTEvent"],"sources":["../../src/third-parties/reddit-pixel.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport { type PixelId, type RDT, isStandardRDTEvent, mapRDTEvent } from '../track/rdt';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { getFirst } from '../utils/field';\nimport {\n type AdsOptions,\n type Integration,\n adEvents,\n adsTracker,\n isLocalHost,\n} from './integration';\n\ndeclare global {\n interface Window {\n /** Undefined until the Reddit Pixel script has loaded. */\n rdt?: RDT['rdt'];\n }\n}\n\nconst metrics = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'];\n\nexport function sendRedditEvent<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 false;\n }\n if (metrics.includes(name)) return;\n if (isLocalHost()) return;\n\n const [type, params] = mapRDTEvent(name, properties, eventId);\n // The two branches are identical on purpose: `rdt('track', ...)` is overloaded — a standard\n // event name carries its own params type, 'Custom' carries `CustomEventParams` — and what\n // `mapRDTEvent` returns is a union of both. Narrowing `type` is what picks a single overload.\n if (type === 'Custom') {\n window.rdt('track', type, JSON.parse(JSON.stringify(params)));\n } else {\n window.rdt('track', type, JSON.parse(JSON.stringify(params)));\n }\n}\n\nexport function setRedditUser(pixelId: PixelId) {\n return ({ user_id, user_data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n\n window.rdt('init', pixelId, {\n email: getFirst(user_data?.email),\n phoneNumber: getFirst(user_data?.phone_number),\n externalId: user_id,\n });\n };\n}\n\n/** Reddit Pixel: the events `mapRDTEvent` maps to a Reddit standard event, and `customEvents`. */\n/** Reddit's configuration, shared by `redditAds` and `redditConversions` on the server. */\nexport interface RedditAdsOptions extends AdsOptions {\n pixelId: PixelId;\n}\n\nexport function redditAds(options: RedditAdsOptions): Integration {\n // As the Ads console's tag: the pixel loads with its id.\n const src = `https://www.redditstatic.com/ads/pixel.js?pixel_id=${encodeURIComponent(options.pixelId)}`;\n return {\n type: 'ads',\n track: adsTracker(sendRedditEvent, adEvents(isStandardRDTEvent, options.customEvents)),\n setUser: setRedditUser(options.pixelId),\n script: {\n id: 'reddit-pixel',\n inline: `\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 = ${JSON.stringify(src)};\n t.async = !0;\n var s = d.getElementsByTagName(\"script\")[0];\n s.parentNode.insertBefore(t,s)\n }\n }(window, document);\n rdt('init', ${JSON.stringify(options.pixelId)});\n rdt('track', 'PageVisit');\n `,\n },\n };\n}\n"],"mappings":";;;;;AAmBA,MAAM,UAAU;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;AAAM;AAE1D,SAAgB,gBACd,MACA,YACA,SACA;CACA,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;EAChD,QAAQ,KAAK,8BAA8B;EAC3C,OAAO;CACT;CACA,IAAI,QAAQ,SAAS,IAAI,GAAG;CAC5B,IAAIA,kCAAAA,YAAY,GAAG;CAEnB,MAAM,CAAC,MAAM,UAAUC,kBAAAA,YAAY,MAAM,YAAY,OAAO;CAI5D,IAAI,SAAS,UACX,OAAO,IAAI,SAAS,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;MAE5D,OAAO,IAAI,SAAS,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;AAEhE;AAEA,SAAgB,cAAc,SAAkB;CAC9C,QAAQ,EAAE,SAAS,gBAAkC;EACnD,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;GAChD,QAAQ,KAAK,8BAA8B;GAC3C;EACF;EAEA,OAAO,IAAI,QAAQ,SAAS;GAC1B,OAAOC,oBAAAA,SAAS,WAAW,KAAK;GAChC,aAAaA,oBAAAA,SAAS,WAAW,YAAY;GAC7C,YAAY;EACd,CAAC;CACH;AACF;AAQA,SAAgB,UAAU,SAAwC;CAEhE,MAAM,MAAM,sDAAsD,mBAAmB,QAAQ,OAAO;CACpG,OAAO;EACL,MAAM;EACN,OAAOC,kCAAAA,WAAW,iBAAiBC,kCAAAA,SAASC,kBAAAA,oBAAoB,QAAQ,YAAY,CAAC;EACrF,SAAS,cAAc,QAAQ,OAAO;EACtC,QAAQ;GACN,IAAI;GACJ,QAAQ;;;;;;;;sBAQQ,KAAK,UAAU,GAAG,EAAE;;;;;;sBAMpB,KAAK,UAAU,QAAQ,OAAO,EAAE;;;EAGlD;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reddit-pixel.d.cts","names":[],"sources":["../../src/third-parties/reddit-pixel.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"reddit-pixel.d.cts","names":[],"sources":["../../src/third-parties/reddit-pixel.ts"],"mappings":";;;;QAYQ;YACI;;IAER,MAAM;;;wBAMM,gBAAgB,UAAU,WACxC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;wBAoBc,cAAc,SAAS,aAAO,SAAA,aACZ;;;iBAgBjB,yBAAyB;EACxC,SAAS;;wBAGK,UAAU,SAAS,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reddit-pixel.d.mts","names":[],"sources":["../../src/third-parties/reddit-pixel.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"reddit-pixel.d.mts","names":[],"sources":["../../src/third-parties/reddit-pixel.ts"],"mappings":";;;;QAYQ;YACI;;IAER,MAAM;;;wBAMM,gBAAgB,UAAU,WACxC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;wBAoBc,cAAc,SAAS,aAAO,SAAA,aACZ;;;iBAgBjB,yBAAyB;EACxC,SAAS;;wBAGK,UAAU,SAAS,mBAAmB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getFirst } from "../utils/field.mjs";
|
|
2
|
-
import { adEvents, adsTracker } from "./integration.mjs";
|
|
2
|
+
import { adEvents, adsTracker, isLocalHost } from "./integration.mjs";
|
|
3
3
|
import { isStandardRDTEvent, mapRDTEvent } from "../track/rdt.mjs";
|
|
4
4
|
// src/third-parties/reddit-pixel.ts
|
|
5
5
|
const metrics = [
|
|
@@ -16,8 +16,7 @@ function sendRedditEvent(name, properties, eventId) {
|
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
18
|
if (metrics.includes(name)) return;
|
|
19
|
-
if (
|
|
20
|
-
if (window.location.host.includes("localhost")) return;
|
|
19
|
+
if (isLocalHost()) return;
|
|
21
20
|
const [type, params] = mapRDTEvent(name, properties, eventId);
|
|
22
21
|
if (type === "Custom") window.rdt("track", type, JSON.parse(JSON.stringify(params)));
|
|
23
22
|
else window.rdt("track", type, JSON.parse(JSON.stringify(params)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reddit-pixel.mjs","names":[],"sources":["../../src/third-parties/reddit-pixel.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport { type PixelId, type RDT, isStandardRDTEvent, mapRDTEvent } from '../track/rdt';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { getFirst } from '../utils/field';\nimport {
|
|
1
|
+
{"version":3,"file":"reddit-pixel.mjs","names":[],"sources":["../../src/third-parties/reddit-pixel.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport { type PixelId, type RDT, isStandardRDTEvent, mapRDTEvent } from '../track/rdt';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { getFirst } from '../utils/field';\nimport {\n type AdsOptions,\n type Integration,\n adEvents,\n adsTracker,\n isLocalHost,\n} from './integration';\n\ndeclare global {\n interface Window {\n /** Undefined until the Reddit Pixel script has loaded. */\n rdt?: RDT['rdt'];\n }\n}\n\nconst metrics = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'];\n\nexport function sendRedditEvent<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 false;\n }\n if (metrics.includes(name)) return;\n if (isLocalHost()) return;\n\n const [type, params] = mapRDTEvent(name, properties, eventId);\n // The two branches are identical on purpose: `rdt('track', ...)` is overloaded — a standard\n // event name carries its own params type, 'Custom' carries `CustomEventParams` — and what\n // `mapRDTEvent` returns is a union of both. Narrowing `type` is what picks a single overload.\n if (type === 'Custom') {\n window.rdt('track', type, JSON.parse(JSON.stringify(params)));\n } else {\n window.rdt('track', type, JSON.parse(JSON.stringify(params)));\n }\n}\n\nexport function setRedditUser(pixelId: PixelId) {\n return ({ user_id, user_data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n\n window.rdt('init', pixelId, {\n email: getFirst(user_data?.email),\n phoneNumber: getFirst(user_data?.phone_number),\n externalId: user_id,\n });\n };\n}\n\n/** Reddit Pixel: the events `mapRDTEvent` maps to a Reddit standard event, and `customEvents`. */\n/** Reddit's configuration, shared by `redditAds` and `redditConversions` on the server. */\nexport interface RedditAdsOptions extends AdsOptions {\n pixelId: PixelId;\n}\n\nexport function redditAds(options: RedditAdsOptions): Integration {\n // As the Ads console's tag: the pixel loads with its id.\n const src = `https://www.redditstatic.com/ads/pixel.js?pixel_id=${encodeURIComponent(options.pixelId)}`;\n return {\n type: 'ads',\n track: adsTracker(sendRedditEvent, adEvents(isStandardRDTEvent, options.customEvents)),\n setUser: setRedditUser(options.pixelId),\n script: {\n id: 'reddit-pixel',\n inline: `\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 = ${JSON.stringify(src)};\n t.async = !0;\n var s = d.getElementsByTagName(\"script\")[0];\n s.parentNode.insertBefore(t,s)\n }\n }(window, document);\n rdt('init', ${JSON.stringify(options.pixelId)});\n rdt('track', 'PageVisit');\n `,\n },\n };\n}\n"],"mappings":";;;;AAmBA,MAAM,UAAU;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;AAAM;AAE1D,SAAgB,gBACd,MACA,YACA,SACA;CACA,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;EAChD,QAAQ,KAAK,8BAA8B;EAC3C,OAAO;CACT;CACA,IAAI,QAAQ,SAAS,IAAI,GAAG;CAC5B,IAAI,YAAY,GAAG;CAEnB,MAAM,CAAC,MAAM,UAAU,YAAY,MAAM,YAAY,OAAO;CAI5D,IAAI,SAAS,UACX,OAAO,IAAI,SAAS,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;MAE5D,OAAO,IAAI,SAAS,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;AAEhE;AAEA,SAAgB,cAAc,SAAkB;CAC9C,QAAQ,EAAE,SAAS,gBAAkC;EACnD,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;GAChD,QAAQ,KAAK,8BAA8B;GAC3C;EACF;EAEA,OAAO,IAAI,QAAQ,SAAS;GAC1B,OAAO,SAAS,WAAW,KAAK;GAChC,aAAa,SAAS,WAAW,YAAY;GAC7C,YAAY;EACd,CAAC;CACH;AACF;AAQA,SAAgB,UAAU,SAAwC;CAEhE,MAAM,MAAM,sDAAsD,mBAAmB,QAAQ,OAAO;CACpG,OAAO;EACL,MAAM;EACN,OAAO,WAAW,iBAAiB,SAAS,oBAAoB,QAAQ,YAAY,CAAC;EACrF,SAAS,cAAc,QAAQ,OAAO;EACtC,QAAQ;GACN,IAAI;GACJ,QAAQ;;;;;;;;sBAQQ,KAAK,UAAU,GAAG,EAAE;;;;;;sBAMpB,KAAK,UAAU,QAAQ,OAAO,EAAE;;;EAGlD;CACF;AACF"}
|