@shware/analytics 13.0.4 → 13.1.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 +3 -1
- package/dist/_virtual/_rolldown/runtime.cjs +1 -2
- package/dist/_virtual/_rolldown/runtime.mjs +1 -2
- package/dist/ads/google.cjs +1 -2
- package/dist/ads/google.d.cts +0 -2
- package/dist/ads/google.d.cts.map +1 -1
- package/dist/ads/google.d.mts +0 -2
- package/dist/ads/google.d.mts.map +1 -1
- package/dist/ads/google.mjs +1 -2
- package/dist/ads/meta.cjs +1 -2
- package/dist/ads/meta.d.cts +0 -2
- package/dist/ads/meta.d.cts.map +1 -1
- package/dist/ads/meta.d.mts +0 -2
- package/dist/ads/meta.d.mts.map +1 -1
- package/dist/ads/meta.mjs +1 -2
- package/dist/ads/time.cjs +1 -2
- package/dist/ads/time.d.cts +0 -2
- package/dist/ads/time.d.cts.map +1 -1
- package/dist/ads/time.d.mts +0 -2
- package/dist/ads/time.d.mts.map +1 -1
- package/dist/ads/time.mjs +1 -2
- package/dist/ads/types.d.cts +0 -2
- package/dist/ads/types.d.cts.map +1 -1
- package/dist/ads/types.d.mts +0 -2
- package/dist/ads/types.d.mts.map +1 -1
- package/dist/attribution/classify.cjs +1 -2
- package/dist/attribution/classify.d.cts +0 -2
- package/dist/attribution/classify.d.cts.map +1 -1
- package/dist/attribution/classify.d.mts +0 -2
- package/dist/attribution/classify.d.mts.map +1 -1
- package/dist/attribution/classify.mjs +1 -2
- package/dist/attribution/vocabulary.cjs +1 -2
- package/dist/attribution/vocabulary.d.cts +0 -2
- package/dist/attribution/vocabulary.d.cts.map +1 -1
- package/dist/attribution/vocabulary.d.mts +0 -2
- package/dist/attribution/vocabulary.d.mts.map +1 -1
- package/dist/attribution/vocabulary.mjs +1 -2
- package/dist/bot/generic.cjs +1 -2
- package/dist/bot/generic.d.cts +0 -2
- package/dist/bot/generic.d.cts.map +1 -1
- package/dist/bot/generic.d.mts +0 -2
- package/dist/bot/generic.d.mts.map +1 -1
- package/dist/bot/generic.mjs +1 -2
- package/dist/bot/index.cjs +1 -2
- package/dist/bot/index.d.cts +0 -2
- package/dist/bot/index.d.cts.map +1 -1
- package/dist/bot/index.d.mts +0 -2
- package/dist/bot/index.d.mts.map +1 -1
- package/dist/bot/index.mjs +1 -2
- package/dist/click-id/index.cjs +1 -2
- package/dist/click-id/index.d.cts +0 -2
- package/dist/click-id/index.d.cts.map +1 -1
- package/dist/click-id/index.d.mts +0 -2
- package/dist/click-id/index.d.mts.map +1 -1
- package/dist/click-id/index.mjs +1 -2
- package/dist/constants/storage.cjs +1 -2
- package/dist/constants/storage.d.cts +0 -2
- package/dist/constants/storage.d.cts.map +1 -1
- package/dist/constants/storage.d.mts +0 -2
- package/dist/constants/storage.d.mts.map +1 -1
- package/dist/constants/storage.mjs +1 -2
- package/dist/feedback/index.cjs +1 -2
- package/dist/feedback/index.d.cts +0 -2
- package/dist/feedback/index.d.cts.map +1 -1
- package/dist/feedback/index.d.mts +0 -2
- package/dist/feedback/index.d.mts.map +1 -1
- package/dist/feedback/index.mjs +1 -2
- package/dist/hooks/use-app-analytics.cjs +1 -2
- package/dist/hooks/use-app-analytics.d.cts +0 -2
- package/dist/hooks/use-app-analytics.d.cts.map +1 -1
- package/dist/hooks/use-app-analytics.d.mts +0 -2
- package/dist/hooks/use-app-analytics.d.mts.map +1 -1
- package/dist/hooks/use-app-analytics.mjs +1 -2
- package/dist/hooks/use-outbound-click-analytics.cjs +1 -2
- package/dist/hooks/use-outbound-click-analytics.d.cts +0 -2
- package/dist/hooks/use-outbound-click-analytics.d.cts.map +1 -1
- package/dist/hooks/use-outbound-click-analytics.d.mts +0 -2
- package/dist/hooks/use-outbound-click-analytics.d.mts.map +1 -1
- package/dist/hooks/use-outbound-click-analytics.mjs +1 -2
- package/dist/hooks/use-report-web-vitals.cjs +1 -2
- package/dist/hooks/use-report-web-vitals.d.cts +0 -2
- package/dist/hooks/use-report-web-vitals.d.cts.map +1 -1
- package/dist/hooks/use-report-web-vitals.d.mts +0 -2
- package/dist/hooks/use-report-web-vitals.d.mts.map +1 -1
- package/dist/hooks/use-report-web-vitals.mjs +1 -2
- package/dist/hooks/use-track-impression.cjs +1 -2
- package/dist/hooks/use-track-impression.d.cts +0 -2
- package/dist/hooks/use-track-impression.d.cts.map +1 -1
- package/dist/hooks/use-track-impression.d.mts +0 -2
- package/dist/hooks/use-track-impression.d.mts.map +1 -1
- package/dist/hooks/use-track-impression.mjs +1 -2
- package/dist/hooks/use-uet-id-sync.cjs +1 -2
- package/dist/hooks/use-uet-id-sync.d.cts +0 -2
- package/dist/hooks/use-uet-id-sync.d.cts.map +1 -1
- package/dist/hooks/use-uet-id-sync.d.mts +0 -2
- package/dist/hooks/use-uet-id-sync.d.mts.map +1 -1
- package/dist/hooks/use-uet-id-sync.mjs +1 -2
- package/dist/hooks/use-web-analytics.cjs +1 -2
- package/dist/hooks/use-web-analytics.d.cts +0 -2
- package/dist/hooks/use-web-analytics.d.cts.map +1 -1
- package/dist/hooks/use-web-analytics.d.mts +0 -2
- package/dist/hooks/use-web-analytics.d.mts.map +1 -1
- package/dist/hooks/use-web-analytics.mjs +1 -2
- package/dist/link/index.cjs +1 -2
- package/dist/link/index.d.cts +0 -2
- package/dist/link/index.d.cts.map +1 -1
- package/dist/link/index.d.mts +0 -2
- package/dist/link/index.d.mts.map +1 -1
- package/dist/link/index.mjs +1 -2
- package/dist/native/deep-link.cjs +1 -2
- package/dist/native/deep-link.d.cts +0 -2
- package/dist/native/deep-link.d.cts.map +1 -1
- package/dist/native/deep-link.d.mts +0 -2
- package/dist/native/deep-link.d.mts.map +1 -1
- package/dist/native/deep-link.mjs +1 -2
- package/dist/native/fbsdk.cjs +1 -2
- package/dist/native/fbsdk.d.cts +0 -2
- package/dist/native/fbsdk.d.cts.map +1 -1
- package/dist/native/fbsdk.d.mts +0 -2
- package/dist/native/fbsdk.d.mts.map +1 -1
- package/dist/native/fbsdk.mjs +1 -2
- package/dist/native/fingerprint.cjs +1 -2
- package/dist/native/fingerprint.d.cts +0 -2
- package/dist/native/fingerprint.d.cts.map +1 -1
- package/dist/native/fingerprint.d.mts +0 -2
- package/dist/native/fingerprint.d.mts.map +1 -1
- package/dist/native/fingerprint.mjs +1 -2
- package/dist/native/firebase.cjs +1 -2
- package/dist/native/firebase.d.cts +0 -2
- package/dist/native/firebase.d.cts.map +1 -1
- package/dist/native/firebase.d.mts +0 -2
- package/dist/native/firebase.d.mts.map +1 -1
- package/dist/native/firebase.mjs +1 -2
- package/dist/native/posthog.cjs +1 -2
- package/dist/native/posthog.d.cts +0 -2
- package/dist/native/posthog.d.cts.map +1 -1
- package/dist/native/posthog.d.mts +0 -2
- package/dist/native/posthog.d.mts.map +1 -1
- package/dist/native/posthog.mjs +1 -2
- package/dist/native/setup.cjs +1 -2
- package/dist/native/setup.d.cts +0 -2
- package/dist/native/setup.d.cts.map +1 -1
- package/dist/native/setup.d.mts +0 -2
- package/dist/native/setup.d.mts.map +1 -1
- package/dist/native/setup.mjs +1 -2
- package/dist/next/index.cjs +1 -2
- package/dist/next/index.d.cts +0 -2
- package/dist/next/index.d.cts.map +1 -1
- package/dist/next/index.d.mts +0 -2
- package/dist/next/index.d.mts.map +1 -1
- package/dist/next/index.mjs +1 -2
- package/dist/node_modules/.pnpm/bowser@2.14.1/node_modules/bowser/es5.cjs +1 -2
- package/dist/node_modules/.pnpm/bowser@2.14.1/node_modules/bowser/es5.mjs +1 -2
- package/dist/react-router/index.cjs +1 -2
- package/dist/react-router/index.d.cts +0 -2
- package/dist/react-router/index.d.cts.map +1 -1
- package/dist/react-router/index.d.mts +0 -2
- package/dist/react-router/index.d.mts.map +1 -1
- package/dist/react-router/index.mjs +1 -2
- package/dist/schema/index.cjs +1 -2
- package/dist/schema/index.d.cts +0 -2
- package/dist/schema/index.d.cts.map +1 -1
- package/dist/schema/index.d.mts +0 -2
- package/dist/schema/index.d.mts.map +1 -1
- package/dist/schema/index.mjs +1 -2
- package/dist/server/action-source.cjs +1 -2
- package/dist/server/action-source.d.cts +0 -2
- package/dist/server/action-source.d.cts.map +1 -1
- package/dist/server/action-source.d.mts +0 -2
- package/dist/server/action-source.d.mts.map +1 -1
- package/dist/server/action-source.mjs +1 -2
- package/dist/server/click-ids.cjs +1 -2
- package/dist/server/click-ids.d.cts +0 -2
- package/dist/server/click-ids.d.cts.map +1 -1
- package/dist/server/click-ids.d.mts +0 -2
- package/dist/server/click-ids.d.mts.map +1 -1
- package/dist/server/click-ids.mjs +1 -2
- package/dist/server/google-data-manager.cjs +1 -2
- package/dist/server/google-data-manager.d.cts +0 -2
- package/dist/server/google-data-manager.d.cts.map +1 -1
- package/dist/server/google-data-manager.d.mts +0 -2
- package/dist/server/google-data-manager.d.mts.map +1 -1
- package/dist/server/google-data-manager.mjs +1 -2
- package/dist/server/linkedin-conversions-api.cjs +1 -2
- package/dist/server/linkedin-conversions-api.d.cts +0 -2
- package/dist/server/linkedin-conversions-api.d.cts.map +1 -1
- package/dist/server/linkedin-conversions-api.d.mts +0 -2
- package/dist/server/linkedin-conversions-api.d.mts.map +1 -1
- package/dist/server/linkedin-conversions-api.mjs +1 -2
- package/dist/server/meta-capi.cjs +1 -2
- package/dist/server/meta-capi.d.cts +0 -2
- package/dist/server/meta-capi.d.cts.map +1 -1
- package/dist/server/meta-capi.d.mts +0 -2
- package/dist/server/meta-capi.d.mts.map +1 -1
- package/dist/server/meta-capi.mjs +1 -2
- package/dist/server/meta-conversions-api.cjs +1 -2
- package/dist/server/meta-conversions-api.d.cts +0 -2
- package/dist/server/meta-conversions-api.d.cts.map +1 -1
- package/dist/server/meta-conversions-api.d.mts +0 -2
- package/dist/server/meta-conversions-api.d.mts.map +1 -1
- package/dist/server/meta-conversions-api.mjs +1 -2
- package/dist/server/microsoft-conversions-api.cjs +1 -2
- package/dist/server/microsoft-conversions-api.d.cts +0 -2
- package/dist/server/microsoft-conversions-api.d.cts.map +1 -1
- package/dist/server/microsoft-conversions-api.d.mts +0 -2
- package/dist/server/microsoft-conversions-api.d.mts.map +1 -1
- package/dist/server/microsoft-conversions-api.mjs +1 -2
- package/dist/server/openai-conversions-api.cjs +1 -2
- package/dist/server/openai-conversions-api.d.cts +0 -2
- package/dist/server/openai-conversions-api.d.cts.map +1 -1
- package/dist/server/openai-conversions-api.d.mts +0 -2
- package/dist/server/openai-conversions-api.d.mts.map +1 -1
- package/dist/server/openai-conversions-api.mjs +1 -2
- package/dist/server/page-location.cjs +1 -2
- package/dist/server/page-location.d.cts +0 -2
- package/dist/server/page-location.d.cts.map +1 -1
- package/dist/server/page-location.d.mts +0 -2
- package/dist/server/page-location.d.mts.map +1 -1
- package/dist/server/page-location.mjs +1 -2
- package/dist/server/reddit-conversions-api.cjs +1 -2
- package/dist/server/reddit-conversions-api.d.cts +0 -2
- package/dist/server/reddit-conversions-api.d.cts.map +1 -1
- package/dist/server/reddit-conversions-api.d.mts +0 -2
- package/dist/server/reddit-conversions-api.d.mts.map +1 -1
- package/dist/server/reddit-conversions-api.mjs +1 -2
- package/dist/setup/index.cjs +1 -2
- package/dist/setup/index.d.cts +0 -2
- package/dist/setup/index.d.cts.map +1 -1
- package/dist/setup/index.d.mts +0 -2
- package/dist/setup/index.d.mts.map +1 -1
- package/dist/setup/index.mjs +1 -2
- package/dist/setup/session.cjs +1 -2
- package/dist/setup/session.d.cts +0 -2
- package/dist/setup/session.d.cts.map +1 -1
- package/dist/setup/session.d.mts +0 -2
- package/dist/setup/session.d.mts.map +1 -1
- package/dist/setup/session.mjs +1 -2
- package/dist/tanstack/analytics.cjs +1 -2
- package/dist/tanstack/analytics.d.cts +0 -2
- package/dist/tanstack/analytics.d.cts.map +1 -1
- package/dist/tanstack/analytics.d.mts +0 -2
- package/dist/tanstack/analytics.d.mts.map +1 -1
- package/dist/tanstack/analytics.mjs +1 -2
- package/dist/tanstack/middleware.cjs +1 -2
- package/dist/tanstack/middleware.d.cts +0 -2
- package/dist/tanstack/middleware.d.cts.map +1 -1
- package/dist/tanstack/middleware.d.mts +0 -2
- package/dist/tanstack/middleware.d.mts.map +1 -1
- package/dist/tanstack/middleware.mjs +1 -2
- package/dist/test/native-modules.d.cts +0 -2
- package/dist/test/native-modules.d.mts +0 -2
- package/dist/test/setup.cjs +1 -2
- package/dist/test/setup.d.cts +0 -2
- package/dist/test/setup.d.cts.map +1 -1
- package/dist/test/setup.d.mts +0 -2
- package/dist/test/setup.d.mts.map +1 -1
- package/dist/test/setup.mjs +1 -2
- package/dist/third-parties/google-analytics.cjs +2 -3
- package/dist/third-parties/google-analytics.cjs.map +1 -1
- package/dist/third-parties/google-analytics.d.cts +0 -2
- package/dist/third-parties/google-analytics.d.cts.map +1 -1
- package/dist/third-parties/google-analytics.d.mts +0 -2
- package/dist/third-parties/google-analytics.d.mts.map +1 -1
- package/dist/third-parties/google-analytics.mjs +2 -3
- package/dist/third-parties/google-analytics.mjs.map +1 -1
- package/dist/third-parties/ignored-events.cjs +1 -2
- package/dist/third-parties/ignored-events.d.cts +0 -2
- package/dist/third-parties/ignored-events.d.cts.map +1 -1
- package/dist/third-parties/ignored-events.d.mts +0 -2
- package/dist/third-parties/ignored-events.d.mts.map +1 -1
- package/dist/third-parties/ignored-events.mjs +1 -2
- package/dist/third-parties/linkedin-insight-tag.cjs +1 -2
- package/dist/third-parties/linkedin-insight-tag.d.cts +0 -2
- package/dist/third-parties/linkedin-insight-tag.d.cts.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.d.mts +0 -2
- package/dist/third-parties/linkedin-insight-tag.d.mts.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.mjs +1 -2
- package/dist/third-parties/meta-pixel.cjs +1 -2
- package/dist/third-parties/meta-pixel.d.cts +0 -2
- package/dist/third-parties/meta-pixel.d.cts.map +1 -1
- package/dist/third-parties/meta-pixel.d.mts +0 -2
- package/dist/third-parties/meta-pixel.d.mts.map +1 -1
- package/dist/third-parties/meta-pixel.mjs +1 -2
- package/dist/third-parties/microsoft-uet.cjs +1 -2
- package/dist/third-parties/microsoft-uet.d.cts +0 -2
- package/dist/third-parties/microsoft-uet.d.cts.map +1 -1
- package/dist/third-parties/microsoft-uet.d.mts +0 -2
- package/dist/third-parties/microsoft-uet.d.mts.map +1 -1
- package/dist/third-parties/microsoft-uet.mjs +1 -2
- package/dist/third-parties/openai-pixel.cjs +1 -2
- package/dist/third-parties/openai-pixel.d.cts +0 -2
- package/dist/third-parties/openai-pixel.d.cts.map +1 -1
- package/dist/third-parties/openai-pixel.d.mts +0 -2
- package/dist/third-parties/openai-pixel.d.mts.map +1 -1
- package/dist/third-parties/openai-pixel.mjs +1 -2
- package/dist/third-parties/posthog.cjs +8 -4
- package/dist/third-parties/posthog.cjs.map +1 -1
- package/dist/third-parties/posthog.d.cts +3 -2
- package/dist/third-parties/posthog.d.cts.map +1 -1
- package/dist/third-parties/posthog.d.mts +3 -2
- package/dist/third-parties/posthog.d.mts.map +1 -1
- package/dist/third-parties/posthog.mjs +8 -4
- package/dist/third-parties/posthog.mjs.map +1 -1
- package/dist/third-parties/reddit-pixel.cjs +1 -2
- package/dist/third-parties/reddit-pixel.d.cts +0 -2
- package/dist/third-parties/reddit-pixel.d.cts.map +1 -1
- package/dist/third-parties/reddit-pixel.d.mts +0 -2
- package/dist/third-parties/reddit-pixel.d.mts.map +1 -1
- package/dist/third-parties/reddit-pixel.mjs +1 -2
- package/dist/track/fbq.cjs +1 -2
- package/dist/track/fbq.d.cts +0 -2
- package/dist/track/fbq.d.cts.map +1 -1
- package/dist/track/fbq.d.mts +0 -2
- package/dist/track/fbq.d.mts.map +1 -1
- package/dist/track/fbq.mjs +1 -2
- package/dist/track/gtag.cjs +1 -2
- package/dist/track/gtag.cjs.map +1 -1
- package/dist/track/gtag.d.cts +2 -4
- package/dist/track/gtag.d.cts.map +1 -1
- package/dist/track/gtag.d.mts +2 -4
- package/dist/track/gtag.d.mts.map +1 -1
- package/dist/track/gtag.mjs +1 -2
- package/dist/track/gtag.mjs.map +1 -1
- package/dist/track/index.cjs +5 -3
- package/dist/track/index.cjs.map +1 -1
- package/dist/track/index.d.cts +6 -4
- package/dist/track/index.d.cts.map +1 -1
- package/dist/track/index.d.mts +6 -4
- package/dist/track/index.d.mts.map +1 -1
- package/dist/track/index.mjs +5 -3
- package/dist/track/index.mjs.map +1 -1
- package/dist/track/lintrk.d.cts +0 -2
- package/dist/track/lintrk.d.cts.map +1 -1
- package/dist/track/lintrk.d.mts +0 -2
- package/dist/track/lintrk.d.mts.map +1 -1
- package/dist/track/oaiq.cjs +1 -2
- package/dist/track/oaiq.d.cts +0 -2
- package/dist/track/oaiq.d.cts.map +1 -1
- package/dist/track/oaiq.d.mts +0 -2
- package/dist/track/oaiq.d.mts.map +1 -1
- package/dist/track/oaiq.mjs +1 -2
- package/dist/track/once.cjs +12 -3
- package/dist/track/once.cjs.map +1 -1
- package/dist/track/once.d.cts +7 -3
- package/dist/track/once.d.cts.map +1 -1
- package/dist/track/once.d.mts +7 -3
- package/dist/track/once.d.mts.map +1 -1
- package/dist/track/once.mjs +12 -3
- package/dist/track/once.mjs.map +1 -1
- package/dist/track/rdt.cjs +1 -2
- package/dist/track/rdt.d.cts +0 -2
- package/dist/track/rdt.d.cts.map +1 -1
- package/dist/track/rdt.d.mts +0 -2
- package/dist/track/rdt.d.mts.map +1 -1
- package/dist/track/rdt.mjs +1 -2
- package/dist/track/types.d.cts +0 -2
- package/dist/track/types.d.cts.map +1 -1
- package/dist/track/types.d.mts +0 -2
- package/dist/track/types.d.mts.map +1 -1
- package/dist/track/uetq.cjs +1 -2
- package/dist/track/uetq.d.cts +0 -2
- package/dist/track/uetq.d.cts.map +1 -1
- package/dist/track/uetq.d.mts +0 -2
- package/dist/track/uetq.d.mts.map +1 -1
- package/dist/track/uetq.mjs +1 -2
- package/dist/utils/field.cjs +1 -2
- package/dist/utils/field.d.cts +0 -2
- package/dist/utils/field.d.cts.map +1 -1
- package/dist/utils/field.d.mts +0 -2
- package/dist/utils/field.d.mts.map +1 -1
- package/dist/utils/field.mjs +1 -2
- package/dist/utils/redact-url.cjs +1 -2
- package/dist/utils/redact-url.d.cts +0 -2
- package/dist/utils/redact-url.d.cts.map +1 -1
- package/dist/utils/redact-url.d.mts +0 -2
- package/dist/utils/redact-url.d.mts.map +1 -1
- package/dist/utils/redact-url.mjs +1 -2
- package/dist/utils/sha256.cjs +1 -2
- package/dist/utils/sha256.d.cts +0 -2
- package/dist/utils/sha256.d.cts.map +1 -1
- package/dist/utils/sha256.d.mts +0 -2
- package/dist/utils/sha256.d.mts.map +1 -1
- package/dist/utils/sha256.mjs +1 -2
- package/dist/visitor/id.cjs +1 -2
- package/dist/visitor/id.cjs.map +1 -1
- package/dist/visitor/id.d.cts +0 -2
- package/dist/visitor/id.d.cts.map +1 -1
- package/dist/visitor/id.d.mts +0 -2
- package/dist/visitor/id.d.mts.map +1 -1
- package/dist/visitor/id.mjs +1 -2
- package/dist/visitor/id.mjs.map +1 -1
- package/dist/visitor/index.cjs +14 -6
- package/dist/visitor/index.cjs.map +1 -1
- package/dist/visitor/index.d.cts +6 -3
- package/dist/visitor/index.d.cts.map +1 -1
- package/dist/visitor/index.d.mts +6 -3
- package/dist/visitor/index.d.mts.map +1 -1
- package/dist/visitor/index.mjs +14 -6
- package/dist/visitor/index.mjs.map +1 -1
- package/dist/visitor/types.d.cts +0 -2
- package/dist/visitor/types.d.cts.map +1 -1
- package/dist/visitor/types.d.mts +0 -2
- package/dist/visitor/types.d.mts.map +1 -1
- package/dist/web/index.cjs +1 -2
- package/dist/web/index.d.cts +0 -2
- package/dist/web/index.d.cts.map +1 -1
- package/dist/web/index.d.mts +0 -2
- package/dist/web/index.d.mts.map +1 -1
- package/dist/web/index.mjs +1 -2
- package/dist/web/page-key.cjs +1 -2
- package/dist/web/page-key.d.cts +0 -2
- package/dist/web/page-key.d.cts.map +1 -1
- package/dist/web/page-key.d.mts +0 -2
- package/dist/web/page-key.d.mts.map +1 -1
- package/dist/web/page-key.mjs +1 -2
- package/package.json +9 -9
package/dist/track/rdt.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/track/rdt.ts
|
|
2
2
|
function mapItems(items) {
|
|
3
3
|
if (!items || items.length === 0) return void 0;
|
|
4
4
|
return items.map((item) => ({
|
|
@@ -63,7 +63,6 @@ function mapServerStandardEvent(name) {
|
|
|
63
63
|
if (name === "Lead") return "LEAD";
|
|
64
64
|
return "SIGN_UP";
|
|
65
65
|
}
|
|
66
|
-
//#endregion
|
|
67
66
|
export { mapItems, mapRDTEvent, mapServerStandardEvent };
|
|
68
67
|
|
|
69
68
|
//# sourceMappingURL=rdt.mjs.map
|
package/dist/track/types.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { StandardEvents, UserProvidedData as UserProvidedData$1 } from "./gtag.cjs";
|
|
2
|
-
//#region src/track/types.d.ts
|
|
3
2
|
export type AllowedPropertyValues = string | number | boolean | null;
|
|
4
3
|
export type EventName = Lowercase<string> | 'CLS' | 'FCP' | 'INP' | 'LCP' | 'TTFB';
|
|
5
4
|
/**
|
|
@@ -320,6 +319,5 @@ export type TrackEventResponse = {
|
|
|
320
319
|
/** The event's id, the one the pixels and the conversions APIs deduplicate on. */
|
|
321
320
|
id: string;
|
|
322
321
|
}[];
|
|
323
|
-
//#endregion
|
|
324
322
|
export {};
|
|
325
323
|
//# sourceMappingURL=types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":["GAUserProvidedData"],"sources":["../../src/track/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":["GAUserProvidedData"],"sources":["../../src/track/types.ts"],"mappings":";YAEY;YACA,YAAY;;;;;;;;;;;;;;;;;;;;iBAsBP;;KAGZ,SAAS;EAA2B;;;;;;;YAO7B,0BACF,iBACN,cAAc,uBAAuB;;;;;;YAO7B,UAAU,UAAU,YAAY,aAAa,sBACrD,UAAU,oBACR,IACA,oBACF,gBAAgB,iBACd,IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgCW;;;;;;;KAQZ,oBAAoB,KAAK,gBAAgB,wBAC1C,sBAAsB;YAGd,gBAAgB,UAAU,YAAY,aAAa,gBAAgB,iBAC3E,eAAe,KAAK,oBAAoB,KACxC,gBAAgB,wBACd,sBAAsB,KAGtB,8BAEE,OAAO,mBAAmB;YAEtB;YACA;iBAEK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe,yBAAyBA;EACxC;EACA;EACA;EACA;EACA;IAAa;IAAc;IAAe;;EAE1C;EACA;;;;;;;;;;;YAYU,qBAAqB,UAAU,WACzC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;iBAGe;;EAEf;EACA;;iBAGe;EACf;EACA;EACA;;;;;;;;;;iBAWe;EACf;EACA;EACA;;;;;;;EAOA;;;;;;EAMA;;;;;;;;;;;;;iBAce;EAEf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;EAMA;;EAEA;;EAEA;;EAEA;EAEA;EACA;EACA;EACA;;;;;;;;EAQA;;;;;;EAMA;EACA;EACA;EACA;;EAEA;;EAEA;EAEA;;EAEA;EAEA;;EAEA;;EAEA;;EAEA;EAEA;;;;;EAKA;EAEA;;EAEA;;EAEA;EAEA;EACA;EACA;EACA;EACA;EACA;;;;;;;iBAQe;;EAEf;;;;;;;;;;;;EAqCA;;;;;;EAuDA;;EAMA;;EAEA;;EAEA;;EAEA;;EAUA;;EAEA;;iBAGe,kBACP,cAAc,YAAY,SAAS,iBAAiB,UAAU,iBAAiB;EACvF;GACC;;iBAGc,WAAW,UAAU,YAAY;EAChD;EACA,MAAM,UAAU;EAChB,MAAM;EACN;EACA;EACA,UAAU;EACV,aAAa;EACb,aAAa,gBAAgB;EAC7B;;;;;;;;;;YAWU;;EAEV"}
|
package/dist/track/types.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { StandardEvents, UserProvidedData as UserProvidedData$1 } from "./gtag.mjs";
|
|
2
|
-
//#region src/track/types.d.ts
|
|
3
2
|
export type AllowedPropertyValues = string | number | boolean | null;
|
|
4
3
|
export type EventName = Lowercase<string> | 'CLS' | 'FCP' | 'INP' | 'LCP' | 'TTFB';
|
|
5
4
|
/**
|
|
@@ -320,6 +319,5 @@ export type TrackEventResponse = {
|
|
|
320
319
|
/** The event's id, the one the pixels and the conversions APIs deduplicate on. */
|
|
321
320
|
id: string;
|
|
322
321
|
}[];
|
|
323
|
-
//#endregion
|
|
324
322
|
export {};
|
|
325
323
|
//# sourceMappingURL=types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":["GAUserProvidedData"],"sources":["../../src/track/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":["GAUserProvidedData"],"sources":["../../src/track/types.ts"],"mappings":";YAEY;YACA,YAAY;;;;;;;;;;;;;;;;;;;;iBAsBP;;KAGZ,SAAS;EAA2B;;;;;;;YAO7B,0BACF,iBACN,cAAc,uBAAuB;;;;;;YAO7B,UAAU,UAAU,YAAY,aAAa,sBACrD,UAAU,oBACR,IACA,oBACF,gBAAgB,iBACd,IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgCW;;;;;;;KAQZ,oBAAoB,KAAK,gBAAgB,wBAC1C,sBAAsB;YAGd,gBAAgB,UAAU,YAAY,aAAa,gBAAgB,iBAC3E,eAAe,KAAK,oBAAoB,KACxC,gBAAgB,wBACd,sBAAsB,KAGtB,8BAEE,OAAO,mBAAmB;YAEtB;YACA;iBAEK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe,yBAAyBA;EACxC;EACA;EACA;EACA;EACA;IAAa;IAAc;IAAe;;EAE1C;EACA;;;;;;;;;;;YAYU,qBAAqB,UAAU,WACzC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;iBAGe;;EAEf;EACA;;iBAGe;EACf;EACA;EACA;;;;;;;;;;iBAWe;EACf;EACA;EACA;;;;;;;EAOA;;;;;;EAMA;;;;;;;;;;;;;iBAce;EAEf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;EAMA;;EAEA;;EAEA;;EAEA;EAEA;EACA;EACA;EACA;;;;;;;;EAQA;;;;;;EAMA;EACA;EACA;EACA;;EAEA;;EAEA;EAEA;;EAEA;EAEA;;EAEA;;EAEA;;EAEA;EAEA;;;;;EAKA;EAEA;;EAEA;;EAEA;EAEA;EACA;EACA;EACA;EACA;EACA;;;;;;;iBAQe;;EAEf;;;;;;;;;;;;EAqCA;;;;;;EAuDA;;EAMA;;EAEA;;EAEA;;EAEA;;EAUA;;EAEA;;iBAGe,kBACP,cAAc,YAAY,SAAS,iBAAiB,UAAU,iBAAiB;EACvF;GACC;;iBAGc,WAAW,UAAU,YAAY;EAChD;EACA,MAAM,UAAU;EAChB,MAAM;EACN;EACA;EACA,UAAU;EACV,aAAa;EACb,aAAa,gBAAgB;EAC7B;;;;;;;;;;YAWU;;EAEV"}
|
package/dist/track/uetq.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// src/track/uetq.ts
|
|
3
3
|
/** GA4 `Item` → UET `items[]` entry. Undefined fields are left for the caller to strip. */
|
|
4
4
|
function mapItems(items) {
|
|
5
5
|
if (!items || items.length === 0) return void 0;
|
|
@@ -73,7 +73,6 @@ function mapUETEvent(name, properties, eventId) {
|
|
|
73
73
|
params.ecomm_category = string(p.ecomm_category);
|
|
74
74
|
return [name, params];
|
|
75
75
|
}
|
|
76
|
-
//#endregion
|
|
77
76
|
exports.mapItems = mapItems;
|
|
78
77
|
exports.mapUETEvent = mapUETEvent;
|
|
79
78
|
|
package/dist/track/uetq.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Item } from "./gtag.cjs";
|
|
2
2
|
import { EventName, TrackName, TrackProperties } from "./types.cjs";
|
|
3
|
-
//#region src/track/uetq.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Microsoft Advertising Universal Event Tracking (UET) — the `uetq` queue that `bat.js` drains.
|
|
6
5
|
*
|
|
@@ -106,5 +105,4 @@ export declare function mapItems(items?: Item[]): undefined | UETItem[];
|
|
|
106
105
|
* browser tracker does not forward it — see `sendUETEvent`.
|
|
107
106
|
*/
|
|
108
107
|
export declare function mapUETEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, eventId?: string): [string, UETEventParams];
|
|
109
|
-
//#endregion
|
|
110
108
|
//# sourceMappingURL=uetq.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uetq.d.cts","names":[],"sources":["../../src/track/uetq.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"uetq.d.cts","names":[],"sources":["../../src/track/uetq.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;YAuBY;;iBAUK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;iBAQe;EACf;EACA;;;iBAIe;;EAEf;EACA;EACA;EACA;;EAEA;;EAEA;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB;EACA;EACA,MAAM;;YAGI;EACV;;;;;;;EAOA;;;;;;iBAOe;EACf,KAAK,kBAAkB,gBAAgB,SAAS;EAChD,KAAK;EACL,KAAK,gBAAgB;IAAU,MAAM;;EACrC,KAAK,oBAAoB,4BAA4B,SAAS;;;wBAIhD,SAAS,QAAQ,qBAAqB;;;;;;;;;;;;;wBAuDtC,YAAY,UAAU,WACpC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B,4BACU"}
|
package/dist/track/uetq.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Item } from "./gtag.mjs";
|
|
2
2
|
import { EventName, TrackName, TrackProperties } from "./types.mjs";
|
|
3
|
-
//#region src/track/uetq.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Microsoft Advertising Universal Event Tracking (UET) — the `uetq` queue that `bat.js` drains.
|
|
6
5
|
*
|
|
@@ -106,5 +105,4 @@ export declare function mapItems(items?: Item[]): undefined | UETItem[];
|
|
|
106
105
|
* browser tracker does not forward it — see `sendUETEvent`.
|
|
107
106
|
*/
|
|
108
107
|
export declare function mapUETEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, eventId?: string): [string, UETEventParams];
|
|
109
|
-
//#endregion
|
|
110
108
|
//# sourceMappingURL=uetq.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uetq.d.mts","names":[],"sources":["../../src/track/uetq.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"uetq.d.mts","names":[],"sources":["../../src/track/uetq.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;YAuBY;;iBAUK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;iBAQe;EACf;EACA;;;iBAIe;;EAEf;EACA;EACA;EACA;;EAEA;;EAEA;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB;EACA;EACA,MAAM;;YAGI;EACV;;;;;;;EAOA;;;;;;iBAOe;EACf,KAAK,kBAAkB,gBAAgB,SAAS;EAChD,KAAK;EACL,KAAK,gBAAgB;IAAU,MAAM;;EACrC,KAAK,oBAAoB,4BAA4B,SAAS;;;wBAIhD,SAAS,QAAQ,qBAAqB;;;;;;;;;;;;;wBAuDtC,YAAY,UAAU,WACpC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B,4BACU"}
|
package/dist/track/uetq.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/track/uetq.ts
|
|
2
2
|
/** GA4 `Item` → UET `items[]` entry. Undefined fields are left for the caller to strip. */
|
|
3
3
|
function mapItems(items) {
|
|
4
4
|
if (!items || items.length === 0) return void 0;
|
|
@@ -72,7 +72,6 @@ function mapUETEvent(name, properties, eventId) {
|
|
|
72
72
|
params.ecomm_category = string(p.ecomm_category);
|
|
73
73
|
return [name, params];
|
|
74
74
|
}
|
|
75
|
-
//#endregion
|
|
76
75
|
export { mapItems, mapUETEvent };
|
|
77
76
|
|
|
78
77
|
//# sourceMappingURL=uetq.mjs.map
|
package/dist/utils/field.cjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// src/utils/field.ts
|
|
3
3
|
function getFirst(field) {
|
|
4
4
|
if (!field) return void 0;
|
|
5
5
|
if (Array.isArray(field)) return field.at(0);
|
|
6
6
|
return field;
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
exports.getFirst = getFirst;
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=field.cjs.map
|
package/dist/utils/field.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.cts","names":[],"sources":["../../src/utils/field.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"field.d.cts","names":[],"sources":["../../src/utils/field.ts"],"mappings":"A,wBAAgB,SAAS,GAAG,OAAO,IAAI,kBAAe"}
|
package/dist/utils/field.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.mts","names":[],"sources":["../../src/utils/field.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"field.d.mts","names":[],"sources":["../../src/utils/field.ts"],"mappings":"A,wBAAgB,SAAS,GAAG,OAAO,IAAI,kBAAe"}
|
package/dist/utils/field.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// src/utils/redact-url.ts
|
|
3
3
|
/**
|
|
4
4
|
* Query parameter names that carry a one-time credential or a secret: OAuth's `code`/`state` and
|
|
5
5
|
* tokens, a Stripe Checkout `session_id`, API keys, one-time passwords. Compared lower-cased.
|
|
@@ -41,7 +41,6 @@ function redactUrl(url) {
|
|
|
41
41
|
const hash = hashAt === -1 ? "" : url.slice(hashAt);
|
|
42
42
|
return redactAfter(head, "?") + redactAfter(hash, hash.includes("?") ? "?" : "#");
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
exports.REDACTED_URL_PARAMS = REDACTED_URL_PARAMS;
|
|
46
45
|
exports.redactUrl = redactUrl;
|
|
47
46
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/utils/redact-url.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Query parameter names that carry a one-time credential or a secret: OAuth's `code`/`state` and
|
|
4
3
|
* tokens, a Stripe Checkout `session_id`, API keys, one-time passwords. Compared lower-cased.
|
|
@@ -12,5 +11,4 @@ export declare const REDACTED_URL_PARAMS: readonly string[];
|
|
|
12
11
|
* `URLSearchParams` form (`a b` as `a+b`); a string with no query and no hash is returned as is.
|
|
13
12
|
*/
|
|
14
13
|
export declare function redactUrl(url: string): string;
|
|
15
|
-
//#endregion
|
|
16
14
|
//# sourceMappingURL=redact-url.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redact-url.d.cts","names":[],"sources":["../../src/utils/redact-url.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"redact-url.d.cts","names":[],"sources":["../../src/utils/redact-url.ts"],"mappings":";;;;qBAIa;;;;;;;;wBAqCG,UAAU"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/utils/redact-url.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Query parameter names that carry a one-time credential or a secret: OAuth's `code`/`state` and
|
|
4
3
|
* tokens, a Stripe Checkout `session_id`, API keys, one-time passwords. Compared lower-cased.
|
|
@@ -12,5 +11,4 @@ export declare const REDACTED_URL_PARAMS: readonly string[];
|
|
|
12
11
|
* `URLSearchParams` form (`a b` as `a+b`); a string with no query and no hash is returned as is.
|
|
13
12
|
*/
|
|
14
13
|
export declare function redactUrl(url: string): string;
|
|
15
|
-
//#endregion
|
|
16
14
|
//# sourceMappingURL=redact-url.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redact-url.d.mts","names":[],"sources":["../../src/utils/redact-url.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"redact-url.d.mts","names":[],"sources":["../../src/utils/redact-url.ts"],"mappings":";;;;qBAIa;;;;;;;;wBAqCG,UAAU"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/redact-url.ts
|
|
2
2
|
/**
|
|
3
3
|
* Query parameter names that carry a one-time credential or a secret: OAuth's `code`/`state` and
|
|
4
4
|
* tokens, a Stripe Checkout `session_id`, API keys, one-time passwords. Compared lower-cased.
|
|
@@ -40,7 +40,6 @@ function redactUrl(url) {
|
|
|
40
40
|
const hash = hashAt === -1 ? "" : url.slice(hashAt);
|
|
41
41
|
return redactAfter(head, "?") + redactAfter(hash, hash.includes("?") ? "?" : "#");
|
|
42
42
|
}
|
|
43
|
-
//#endregion
|
|
44
43
|
export { REDACTED_URL_PARAMS, redactUrl };
|
|
45
44
|
|
|
46
45
|
//# sourceMappingURL=redact-url.mjs.map
|
package/dist/utils/sha256.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// src/utils/sha256.ts
|
|
3
3
|
/**
|
|
4
4
|
* SHA-256 hex digest, lowercase, computed in the browser with SubtleCrypto — the format every
|
|
5
5
|
* ad platform expects for a hashed identifier, and the same digest the server-side senders
|
|
@@ -13,7 +13,6 @@ async function sha256(value) {
|
|
|
13
13
|
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
14
14
|
return Array.from(new Uint8Array(digest)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
exports.sha256 = sha256;
|
|
18
17
|
|
|
19
18
|
//# sourceMappingURL=sha256.cjs.map
|
package/dist/utils/sha256.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/utils/sha256.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* SHA-256 hex digest, lowercase, computed in the browser with SubtleCrypto — the format every
|
|
4
3
|
* ad platform expects for a hashed identifier, and the same digest the server-side senders
|
|
@@ -8,5 +7,4 @@
|
|
|
8
7
|
* (an insecure context), so callers decide what to send without the hash.
|
|
9
8
|
*/
|
|
10
9
|
export declare function sha256(value: string): Promise<string>;
|
|
11
|
-
//#endregion
|
|
12
10
|
//# sourceMappingURL=sha256.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sha256.d.cts","names":[],"sources":["../../src/utils/sha256.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sha256.d.cts","names":[],"sources":["../../src/utils/sha256.ts"],"mappings":";;;;;;;;wBAQsB,OAAO,gBAAgB"}
|
package/dist/utils/sha256.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/utils/sha256.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* SHA-256 hex digest, lowercase, computed in the browser with SubtleCrypto — the format every
|
|
4
3
|
* ad platform expects for a hashed identifier, and the same digest the server-side senders
|
|
@@ -8,5 +7,4 @@
|
|
|
8
7
|
* (an insecure context), so callers decide what to send without the hash.
|
|
9
8
|
*/
|
|
10
9
|
export declare function sha256(value: string): Promise<string>;
|
|
11
|
-
//#endregion
|
|
12
10
|
//# sourceMappingURL=sha256.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sha256.d.mts","names":[],"sources":["../../src/utils/sha256.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sha256.d.mts","names":[],"sources":["../../src/utils/sha256.ts"],"mappings":";;;;;;;;wBAQsB,OAAO,gBAAgB"}
|
package/dist/utils/sha256.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/sha256.ts
|
|
2
2
|
/**
|
|
3
3
|
* SHA-256 hex digest, lowercase, computed in the browser with SubtleCrypto — the format every
|
|
4
4
|
* ad platform expects for a hashed identifier, and the same digest the server-side senders
|
|
@@ -12,7 +12,6 @@ async function sha256(value) {
|
|
|
12
12
|
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
13
13
|
return Array.from(new Uint8Array(digest)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { sha256 };
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=sha256.mjs.map
|
package/dist/visitor/id.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_setup_index = require("../setup/index.cjs");
|
|
3
3
|
const require_constants_storage = require("../constants/storage.cjs");
|
|
4
4
|
let uuid = require("uuid");
|
|
5
|
-
|
|
5
|
+
// src/visitor/id.ts
|
|
6
6
|
/**
|
|
7
7
|
* This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so
|
|
8
8
|
* it exists the moment the page loads. The first events, and the beacon of a visit left within a
|
|
@@ -19,7 +19,6 @@ function visitorId() {
|
|
|
19
19
|
require_setup_index.config.storage.setItem(require_constants_storage.keys.visitor_id, id);
|
|
20
20
|
return id;
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
exports.visitorId = visitorId;
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=id.cjs.map
|
package/dist/visitor/id.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.cjs","names":["config","keys","uuidv7"],"sources":["../../src/visitor/id.ts"],"sourcesContent":["import { v7 as uuidv7 } from 'uuid';\nimport { keys } from '../constants/storage';\nimport { config } from '../setup/index';\n\n/**\n * This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so\n * it exists the moment the page loads. The first events, and the beacon of a visit left within a\n * second, go out without waiting for a round trip; the server creates the visitor from its first\n * events. An id a server issued to an older client is kept as it is: the visitor continues.\n *\n * Needs a server that creates visitors from events (see the README, \"Visitors\"); one that still\n * only creates them on `POST /visitors` rejects the events of a new visitor.\n */\nexport function visitorId(): string {\n const stored = config.storage.getItem(keys.visitor_id);\n if (stored && stored !== 'undefined') return stored;\n const id = uuidv7();\n config.storage.setItem(keys.visitor_id, id);\n return id;\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,YAAoB;CAClC,MAAM,SAASA,oBAAAA,OAAO,QAAQ,QAAQC,0BAAAA,KAAK,UAAU;
|
|
1
|
+
{"version":3,"file":"id.cjs","names":["config","keys","uuidv7"],"sources":["../../src/visitor/id.ts"],"sourcesContent":["import { v7 as uuidv7 } from 'uuid';\nimport { keys } from '../constants/storage';\nimport { config } from '../setup/index';\n\n/**\n * This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so\n * it exists the moment the page loads. The first events, and the beacon of a visit left within a\n * second, go out without waiting for a round trip; the server creates the visitor from its first\n * events. An id a server issued to an older client is kept as it is: the visitor continues.\n *\n * Needs a server that creates visitors from events (see the README, \"Visitors\"); one that still\n * only creates them on `POST /visitors` rejects the events of a new visitor.\n */\nexport function visitorId(): string {\n const stored = config.storage.getItem(keys.visitor_id);\n // An old client stored the string 'undefined' as the id (it wrote an unset id): not an id, so it\n // is replaced below with a new one, which also clears the bad value from storage for good.\n if (stored && stored !== 'undefined') return stored;\n const id = uuidv7();\n config.storage.setItem(keys.visitor_id, id);\n return id;\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,YAAoB;CAClC,MAAM,SAASA,oBAAAA,OAAO,QAAQ,QAAQC,0BAAAA,KAAK,UAAU;CAGrD,IAAI,UAAU,WAAW,aAAa,OAAO;CAC7C,MAAM,MAAA,GAAKC,KAAAA,GAAAA,CAAO;CAClB,oBAAA,OAAO,QAAQ,QAAQD,0BAAAA,KAAK,YAAY,EAAE;CAC1C,OAAO;AACT"}
|
package/dist/visitor/id.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/visitor/id.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so
|
|
4
3
|
* it exists the moment the page loads. The first events, and the beacon of a visit left within a
|
|
@@ -9,5 +8,4 @@
|
|
|
9
8
|
* only creates them on `POST /visitors` rejects the events of a new visitor.
|
|
10
9
|
*/
|
|
11
10
|
export declare function visitorId(): string;
|
|
12
|
-
//#endregion
|
|
13
11
|
//# sourceMappingURL=id.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.d.cts","names":[],"sources":["../../src/visitor/id.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"id.d.cts","names":[],"sources":["../../src/visitor/id.ts"],"mappings":";;;;;;;;;wBAagB"}
|
package/dist/visitor/id.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/visitor/id.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so
|
|
4
3
|
* it exists the moment the page loads. The first events, and the beacon of a visit left within a
|
|
@@ -9,5 +8,4 @@
|
|
|
9
8
|
* only creates them on `POST /visitors` rejects the events of a new visitor.
|
|
10
9
|
*/
|
|
11
10
|
export declare function visitorId(): string;
|
|
12
|
-
//#endregion
|
|
13
11
|
//# sourceMappingURL=id.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.d.mts","names":[],"sources":["../../src/visitor/id.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"id.d.mts","names":[],"sources":["../../src/visitor/id.ts"],"mappings":";;;;;;;;;wBAagB"}
|
package/dist/visitor/id.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { config } from "../setup/index.mjs";
|
|
2
2
|
import { keys } from "../constants/storage.mjs";
|
|
3
3
|
import { v7 } from "uuid";
|
|
4
|
-
|
|
4
|
+
// src/visitor/id.ts
|
|
5
5
|
/**
|
|
6
6
|
* This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so
|
|
7
7
|
* it exists the moment the page loads. The first events, and the beacon of a visit left within a
|
|
@@ -18,7 +18,6 @@ function visitorId() {
|
|
|
18
18
|
config.storage.setItem(keys.visitor_id, id);
|
|
19
19
|
return id;
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { visitorId };
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=id.mjs.map
|
package/dist/visitor/id.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.mjs","names":["uuidv7"],"sources":["../../src/visitor/id.ts"],"sourcesContent":["import { v7 as uuidv7 } from 'uuid';\nimport { keys } from '../constants/storage';\nimport { config } from '../setup/index';\n\n/**\n * This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so\n * it exists the moment the page loads. The first events, and the beacon of a visit left within a\n * second, go out without waiting for a round trip; the server creates the visitor from its first\n * events. An id a server issued to an older client is kept as it is: the visitor continues.\n *\n * Needs a server that creates visitors from events (see the README, \"Visitors\"); one that still\n * only creates them on `POST /visitors` rejects the events of a new visitor.\n */\nexport function visitorId(): string {\n const stored = config.storage.getItem(keys.visitor_id);\n if (stored && stored !== 'undefined') return stored;\n const id = uuidv7();\n config.storage.setItem(keys.visitor_id, id);\n return id;\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,YAAoB;CAClC,MAAM,SAAS,OAAO,QAAQ,QAAQ,KAAK,UAAU;
|
|
1
|
+
{"version":3,"file":"id.mjs","names":["uuidv7"],"sources":["../../src/visitor/id.ts"],"sourcesContent":["import { v7 as uuidv7 } from 'uuid';\nimport { keys } from '../constants/storage';\nimport { config } from '../setup/index';\n\n/**\n * This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so\n * it exists the moment the page loads. The first events, and the beacon of a visit left within a\n * second, go out without waiting for a round trip; the server creates the visitor from its first\n * events. An id a server issued to an older client is kept as it is: the visitor continues.\n *\n * Needs a server that creates visitors from events (see the README, \"Visitors\"); one that still\n * only creates them on `POST /visitors` rejects the events of a new visitor.\n */\nexport function visitorId(): string {\n const stored = config.storage.getItem(keys.visitor_id);\n // An old client stored the string 'undefined' as the id (it wrote an unset id): not an id, so it\n // is replaced below with a new one, which also clears the bad value from storage for good.\n if (stored && stored !== 'undefined') return stored;\n const id = uuidv7();\n config.storage.setItem(keys.visitor_id, id);\n return id;\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,YAAoB;CAClC,MAAM,SAAS,OAAO,QAAQ,QAAQ,KAAK,UAAU;CAGrD,IAAI,UAAU,WAAW,aAAa,OAAO;CAC7C,MAAM,KAAKA,GAAO;CAClB,OAAO,QAAQ,QAAQ,KAAK,YAAY,EAAE;CAC1C,OAAO;AACT"}
|
package/dist/visitor/index.cjs
CHANGED
|
@@ -2,14 +2,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_setup_index = require("../setup/index.cjs");
|
|
3
3
|
const require_visitor_id = require("./id.cjs");
|
|
4
4
|
const require_track_index = require("../track/index.cjs");
|
|
5
|
-
|
|
5
|
+
// src/visitor/index.ts
|
|
6
6
|
/**
|
|
7
7
|
* The event that binds the visitor to the user who signed in on it: the server sets the visitor's
|
|
8
8
|
* `user_id` and `distinct_id` from its `user_id` property, in the transaction that stores the
|
|
9
9
|
* batch — which also creates the visitor when it is new, so the binding can never arrive before it.
|
|
10
10
|
*/
|
|
11
11
|
const IDENTIFY_EVENT = "identify";
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* The user this page has identified the visitor as: identify once per user, not per call. Cleared
|
|
14
|
+
* on sign-out, so the same user signing back in on this page is identified again.
|
|
15
|
+
*/
|
|
13
16
|
let identified;
|
|
14
17
|
/**
|
|
15
18
|
* Hands the signed-in user to the analytics: the third-party user setters (gtag, the pixels) now,
|
|
@@ -18,16 +21,22 @@ let identified;
|
|
|
18
21
|
* event it goes with the next batch or the page-hide beacon; `user_data` is handed to the setters
|
|
19
22
|
* only, never stored with the event.
|
|
20
23
|
*
|
|
21
|
-
*
|
|
24
|
+
* Without a `user_id` (missing, or `''`) it signs the visitor out: `setVisitor({})` is
|
|
25
|
+
* sign-out. Nothing goes to the server, the setters get `distinct_id: null` (PostHog resets its
|
|
26
|
+
* identity on it), and the next sign-in is identified again even if it is the same user. Still
|
|
27
|
+
* `track('logout')` as usual — that is an ordinary event, and resets nothing.
|
|
28
|
+
*
|
|
29
|
+
* Synchronous and never throws: sign-in and sign-out must not fail on analytics.
|
|
22
30
|
*/
|
|
23
31
|
function setVisitor(dto) {
|
|
24
|
-
if (dto.user_id
|
|
32
|
+
if (!dto.user_id) identified = void 0;
|
|
33
|
+
else if (dto.user_id !== identified) {
|
|
25
34
|
identified = dto.user_id;
|
|
26
35
|
require_track_index.track(IDENTIFY_EVENT, { user_id: dto.user_id }, { enableThirdPartyTracking: false });
|
|
27
36
|
}
|
|
28
37
|
const identity = {
|
|
29
38
|
...dto,
|
|
30
|
-
distinct_id: dto.user_id
|
|
39
|
+
distinct_id: dto.user_id || null
|
|
31
40
|
};
|
|
32
41
|
require_setup_index.config.thirdPartyUserSetters.forEach((setter) => {
|
|
33
42
|
try {
|
|
@@ -37,7 +46,6 @@ function setVisitor(dto) {
|
|
|
37
46
|
}
|
|
38
47
|
});
|
|
39
48
|
}
|
|
40
|
-
//#endregion
|
|
41
49
|
exports.IDENTIFY_EVENT = IDENTIFY_EVENT;
|
|
42
50
|
exports.setVisitor = setVisitor;
|
|
43
51
|
exports.visitorId = require_visitor_id.visitorId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/visitor/index.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport { config } from '../setup/index';\nimport { track } from '../track/index';\n\nexport { visitorId } from './id';\n\n/**\n * The event that binds the visitor to the user who signed in on it: the server sets the visitor's\n * `user_id` and `distinct_id` from its `user_id` property, in the transaction that stores the\n * batch — which also creates the visitor when it is new, so the binding can never arrive before it.\n */\nexport const IDENTIFY_EVENT = 'identify';\n\n
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/visitor/index.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport { config } from '../setup/index';\nimport { track } from '../track/index';\n\nexport { visitorId } from './id';\n\n/**\n * The event that binds the visitor to the user who signed in on it: the server sets the visitor's\n * `user_id` and `distinct_id` from its `user_id` property, in the transaction that stores the\n * batch — which also creates the visitor when it is new, so the binding can never arrive before it.\n */\nexport const IDENTIFY_EVENT = 'identify';\n\n/**\n * The user this page has identified the visitor as: identify once per user, not per call. Cleared\n * on sign-out, so the same user signing back in on this page is identified again.\n */\nlet identified: string | undefined;\n\n/**\n * Hands the signed-in user to the analytics: the third-party user setters (gtag, the pixels) now,\n * and the server through an `identify` event, sent when the user differs from the one this page\n * last identified — a host calls this on every page load once someone is signed in. Like any\n * event it goes with the next batch or the page-hide beacon; `user_data` is handed to the setters\n * only, never stored with the event.\n *\n * Without a `user_id` (missing, or `''`) it signs the visitor out: `setVisitor({})` is\n * sign-out. Nothing goes to the server, the setters get `distinct_id: null` (PostHog resets its\n * identity on it), and the next sign-in is identified again even if it is the same user. Still\n * `track('logout')` as usual — that is an ordinary event, and resets nothing.\n *\n * Synchronous and never throws: sign-in and sign-out must not fail on analytics.\n */\nexport function setVisitor(dto: Omit<UpdateVisitorDTO, 'tags'>) {\n if (!dto.user_id) {\n identified = undefined;\n } else if (dto.user_id !== identified) {\n identified = dto.user_id;\n track(IDENTIFY_EVENT, { user_id: dto.user_id }, { enableThirdPartyTracking: false });\n }\n\n // Once bound, the server's person key for the visitor is the user's id, so the setters are told\n // that rather than waiting for the server to say it.\n const identity = { ...dto, distinct_id: dto.user_id || null };\n config.thirdPartyUserSetters.forEach((setter) => {\n try {\n setter(identity);\n } catch (e: unknown) {\n // One third-party script does not get to stop the others.\n if (e instanceof Error) console.log(e.message);\n }\n });\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,iBAAiB;;;;;AAM9B,IAAI;;;;;;;;;;;;;;;AAgBJ,SAAgB,WAAW,KAAqC;CAC9D,IAAI,CAAC,IAAI,SACP,aAAa,KAAA;MACR,IAAI,IAAI,YAAY,YAAY;EACrC,aAAa,IAAI;EACjB,oBAAA,MAAM,gBAAgB,EAAE,SAAS,IAAI,QAAQ,GAAG,EAAE,0BAA0B,MAAM,CAAC;CACrF;CAIA,MAAM,WAAW;EAAE,GAAG;EAAK,aAAa,IAAI,WAAW;CAAK;CAC5D,oBAAA,OAAO,sBAAsB,SAAS,WAAW;EAC/C,IAAI;GACF,OAAO,QAAQ;EACjB,SAAS,GAAY;GAEnB,IAAI,aAAa,OAAO,QAAQ,IAAI,EAAE,OAAO;EAC/C;CACF,CAAC;AACH"}
|
package/dist/visitor/index.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { UpdateVisitorDTO } from "../schema/index.cjs";
|
|
2
2
|
import { visitorId } from "./id.cjs";
|
|
3
|
-
//#region src/visitor/index.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* The event that binds the visitor to the user who signed in on it: the server sets the visitor's
|
|
6
5
|
* `user_id` and `distinct_id` from its `user_id` property, in the transaction that stores the
|
|
@@ -14,9 +13,13 @@ export declare const IDENTIFY_EVENT = "identify";
|
|
|
14
13
|
* event it goes with the next batch or the page-hide beacon; `user_data` is handed to the setters
|
|
15
14
|
* only, never stored with the event.
|
|
16
15
|
*
|
|
17
|
-
*
|
|
16
|
+
* Without a `user_id` (missing, or `''`) it signs the visitor out: `setVisitor({})` is
|
|
17
|
+
* sign-out. Nothing goes to the server, the setters get `distinct_id: null` (PostHog resets its
|
|
18
|
+
* identity on it), and the next sign-in is identified again even if it is the same user. Still
|
|
19
|
+
* `track('logout')` as usual — that is an ordinary event, and resets nothing.
|
|
20
|
+
*
|
|
21
|
+
* Synchronous and never throws: sign-in and sign-out must not fail on analytics.
|
|
18
22
|
*/
|
|
19
23
|
export declare function setVisitor(dto: Omit<UpdateVisitorDTO, 'tags'>): void;
|
|
20
|
-
//#endregion
|
|
21
24
|
export { visitorId };
|
|
22
25
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/visitor/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/visitor/index.ts"],"mappings":";;;;;;;qBAWa;;;;;;;;;;;;;;;wBAsBG,WAAW,KAAK,KAAK"}
|
package/dist/visitor/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { UpdateVisitorDTO } from "../schema/index.mjs";
|
|
2
2
|
import { visitorId } from "./id.mjs";
|
|
3
|
-
//#region src/visitor/index.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* The event that binds the visitor to the user who signed in on it: the server sets the visitor's
|
|
6
5
|
* `user_id` and `distinct_id` from its `user_id` property, in the transaction that stores the
|
|
@@ -14,9 +13,13 @@ export declare const IDENTIFY_EVENT = "identify";
|
|
|
14
13
|
* event it goes with the next batch or the page-hide beacon; `user_data` is handed to the setters
|
|
15
14
|
* only, never stored with the event.
|
|
16
15
|
*
|
|
17
|
-
*
|
|
16
|
+
* Without a `user_id` (missing, or `''`) it signs the visitor out: `setVisitor({})` is
|
|
17
|
+
* sign-out. Nothing goes to the server, the setters get `distinct_id: null` (PostHog resets its
|
|
18
|
+
* identity on it), and the next sign-in is identified again even if it is the same user. Still
|
|
19
|
+
* `track('logout')` as usual — that is an ordinary event, and resets nothing.
|
|
20
|
+
*
|
|
21
|
+
* Synchronous and never throws: sign-in and sign-out must not fail on analytics.
|
|
18
22
|
*/
|
|
19
23
|
export declare function setVisitor(dto: Omit<UpdateVisitorDTO, 'tags'>): void;
|
|
20
|
-
//#endregion
|
|
21
24
|
export { visitorId };
|
|
22
25
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/visitor/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/visitor/index.ts"],"mappings":";;;;;;;qBAWa;;;;;;;;;;;;;;;wBAsBG,WAAW,KAAK,KAAK"}
|
package/dist/visitor/index.mjs
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { config } from "../setup/index.mjs";
|
|
2
2
|
import { visitorId } from "./id.mjs";
|
|
3
3
|
import { track } from "../track/index.mjs";
|
|
4
|
-
|
|
4
|
+
// src/visitor/index.ts
|
|
5
5
|
/**
|
|
6
6
|
* The event that binds the visitor to the user who signed in on it: the server sets the visitor's
|
|
7
7
|
* `user_id` and `distinct_id` from its `user_id` property, in the transaction that stores the
|
|
8
8
|
* batch — which also creates the visitor when it is new, so the binding can never arrive before it.
|
|
9
9
|
*/
|
|
10
10
|
const IDENTIFY_EVENT = "identify";
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* The user this page has identified the visitor as: identify once per user, not per call. Cleared
|
|
13
|
+
* on sign-out, so the same user signing back in on this page is identified again.
|
|
14
|
+
*/
|
|
12
15
|
let identified;
|
|
13
16
|
/**
|
|
14
17
|
* Hands the signed-in user to the analytics: the third-party user setters (gtag, the pixels) now,
|
|
@@ -17,16 +20,22 @@ let identified;
|
|
|
17
20
|
* event it goes with the next batch or the page-hide beacon; `user_data` is handed to the setters
|
|
18
21
|
* only, never stored with the event.
|
|
19
22
|
*
|
|
20
|
-
*
|
|
23
|
+
* Without a `user_id` (missing, or `''`) it signs the visitor out: `setVisitor({})` is
|
|
24
|
+
* sign-out. Nothing goes to the server, the setters get `distinct_id: null` (PostHog resets its
|
|
25
|
+
* identity on it), and the next sign-in is identified again even if it is the same user. Still
|
|
26
|
+
* `track('logout')` as usual — that is an ordinary event, and resets nothing.
|
|
27
|
+
*
|
|
28
|
+
* Synchronous and never throws: sign-in and sign-out must not fail on analytics.
|
|
21
29
|
*/
|
|
22
30
|
function setVisitor(dto) {
|
|
23
|
-
if (dto.user_id
|
|
31
|
+
if (!dto.user_id) identified = void 0;
|
|
32
|
+
else if (dto.user_id !== identified) {
|
|
24
33
|
identified = dto.user_id;
|
|
25
34
|
track(IDENTIFY_EVENT, { user_id: dto.user_id }, { enableThirdPartyTracking: false });
|
|
26
35
|
}
|
|
27
36
|
const identity = {
|
|
28
37
|
...dto,
|
|
29
|
-
distinct_id: dto.user_id
|
|
38
|
+
distinct_id: dto.user_id || null
|
|
30
39
|
};
|
|
31
40
|
config.thirdPartyUserSetters.forEach((setter) => {
|
|
32
41
|
try {
|
|
@@ -36,7 +45,6 @@ function setVisitor(dto) {
|
|
|
36
45
|
}
|
|
37
46
|
});
|
|
38
47
|
}
|
|
39
|
-
//#endregion
|
|
40
48
|
export { IDENTIFY_EVENT, setVisitor, visitorId };
|
|
41
49
|
|
|
42
50
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/visitor/index.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport { config } from '../setup/index';\nimport { track } from '../track/index';\n\nexport { visitorId } from './id';\n\n/**\n * The event that binds the visitor to the user who signed in on it: the server sets the visitor's\n * `user_id` and `distinct_id` from its `user_id` property, in the transaction that stores the\n * batch — which also creates the visitor when it is new, so the binding can never arrive before it.\n */\nexport const IDENTIFY_EVENT = 'identify';\n\n
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/visitor/index.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport { config } from '../setup/index';\nimport { track } from '../track/index';\n\nexport { visitorId } from './id';\n\n/**\n * The event that binds the visitor to the user who signed in on it: the server sets the visitor's\n * `user_id` and `distinct_id` from its `user_id` property, in the transaction that stores the\n * batch — which also creates the visitor when it is new, so the binding can never arrive before it.\n */\nexport const IDENTIFY_EVENT = 'identify';\n\n/**\n * The user this page has identified the visitor as: identify once per user, not per call. Cleared\n * on sign-out, so the same user signing back in on this page is identified again.\n */\nlet identified: string | undefined;\n\n/**\n * Hands the signed-in user to the analytics: the third-party user setters (gtag, the pixels) now,\n * and the server through an `identify` event, sent when the user differs from the one this page\n * last identified — a host calls this on every page load once someone is signed in. Like any\n * event it goes with the next batch or the page-hide beacon; `user_data` is handed to the setters\n * only, never stored with the event.\n *\n * Without a `user_id` (missing, or `''`) it signs the visitor out: `setVisitor({})` is\n * sign-out. Nothing goes to the server, the setters get `distinct_id: null` (PostHog resets its\n * identity on it), and the next sign-in is identified again even if it is the same user. Still\n * `track('logout')` as usual — that is an ordinary event, and resets nothing.\n *\n * Synchronous and never throws: sign-in and sign-out must not fail on analytics.\n */\nexport function setVisitor(dto: Omit<UpdateVisitorDTO, 'tags'>) {\n if (!dto.user_id) {\n identified = undefined;\n } else if (dto.user_id !== identified) {\n identified = dto.user_id;\n track(IDENTIFY_EVENT, { user_id: dto.user_id }, { enableThirdPartyTracking: false });\n }\n\n // Once bound, the server's person key for the visitor is the user's id, so the setters are told\n // that rather than waiting for the server to say it.\n const identity = { ...dto, distinct_id: dto.user_id || null };\n config.thirdPartyUserSetters.forEach((setter) => {\n try {\n setter(identity);\n } catch (e: unknown) {\n // One third-party script does not get to stop the others.\n if (e instanceof Error) console.log(e.message);\n }\n });\n}\n"],"mappings":";;;;;;;;;AAWA,MAAa,iBAAiB;;;;;AAM9B,IAAI;;;;;;;;;;;;;;;AAgBJ,SAAgB,WAAW,KAAqC;CAC9D,IAAI,CAAC,IAAI,SACP,aAAa,KAAA;MACR,IAAI,IAAI,YAAY,YAAY;EACrC,aAAa,IAAI;EACjB,MAAM,gBAAgB,EAAE,SAAS,IAAI,QAAQ,GAAG,EAAE,0BAA0B,MAAM,CAAC;CACrF;CAIA,MAAM,WAAW;EAAE,GAAG;EAAK,aAAa,IAAI,WAAW;CAAK;CAC5D,OAAO,sBAAsB,SAAS,WAAW;EAC/C,IAAI;GACF,OAAO,QAAQ;EACjB,SAAS,GAAY;GAEnB,IAAI,aAAa,OAAO,QAAQ,IAAI,EAAE,OAAO;EAC/C;CACF,CAAC;AACH"}
|
package/dist/visitor/types.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Environment, Platform, TrackTags } from "../track/types.cjs";
|
|
2
2
|
import { UpdateVisitorDTO } from "../schema/index.cjs";
|
|
3
|
-
//#region src/visitor/types.d.ts
|
|
4
3
|
export type VisitorProperties = Record<Lowercase<string>, string | number | boolean | null>;
|
|
5
4
|
export interface Visitor {
|
|
6
5
|
id: string;
|
|
@@ -22,5 +21,4 @@ export interface Visitor {
|
|
|
22
21
|
*/
|
|
23
22
|
export type VisitorIdentity = UpdateVisitorDTO & Pick<Visitor, 'distinct_id'>;
|
|
24
23
|
export type ThirdPartyUserSetter = (identity: VisitorIdentity) => void;
|
|
25
|
-
//#endregion
|
|
26
24
|
//# sourceMappingURL=types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/visitor/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/visitor/types.ts"],"mappings":";;YAGY,oBAAoB,OAAO;iBAEtB;EACf;;;;;;;EAOA;EACA;EACA,UAAU;EACV,aAAa;EACb,MAAM;;;;;;YAOI,kBAAkB,mBAAmB,KAAK;YAE1C,wBAAwB,UAAU"}
|