@formo/analytics 1.32.0 → 1.33.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.
@@ -40,24 +40,35 @@ var DEFAULT_EXCLUDED_QUERY_PARAMS = [
40
40
  "privy_oauth_state",
41
41
  "privy_oauth_provider",
42
42
  ];
43
+ /**
44
+ * Default query parameter names checked (in order) for a referral code on the
45
+ * landing-page URL. The first parameter present supplies the `ref` traffic
46
+ * source. Consumers can override this list via `referral.queryParams`.
47
+ *
48
+ * Keep in sync with the ReferralOptions.queryParams @default in
49
+ * src/types/base.ts.
50
+ */
51
+ var DEFAULT_REFERRAL_PARAMS = [
52
+ 'ref',
53
+ 'referral',
54
+ 'refcode',
55
+ 'af',
56
+ 'referrer',
57
+ ];
43
58
  /**
44
59
  * Fields that should be excluded from page event properties parsing
45
60
  * These are either:
46
61
  * - Already captured in event context (UTM params, referral params, click IDs)
47
62
  * - Semantic event properties that should not be overridden by URL params
48
63
  */
49
- var PAGE_PROPERTIES_EXCLUDED_FIELDS = new Set(__spreadArray(__spreadArray([
64
+ var PAGE_PROPERTIES_EXCLUDED_FIELDS = new Set(__spreadArray(__spreadArray(__spreadArray([
50
65
  // Context fields (already captured in event context)
51
66
  'utm_source',
52
67
  'utm_medium',
53
68
  'utm_campaign',
54
69
  'utm_term',
55
- 'utm_content',
56
- 'ref',
57
- 'referral',
58
- 'refcode',
59
- 'referrer'
60
- ], CLICK_ID_PARAMS, true), [
70
+ 'utm_content'
71
+ ], DEFAULT_REFERRAL_PARAMS, true), CLICK_ID_PARAMS, true), [
61
72
  // Semantic event properties (should not be overridden by URL params)
62
73
  'category',
63
74
  'name',
@@ -66,5 +77,5 @@ var PAGE_PROPERTIES_EXCLUDED_FIELDS = new Set(__spreadArray(__spreadArray([
66
77
  'hash',
67
78
  'query',
68
79
  ], false));
69
- export { CHANNEL, VERSION, CLICK_ID_PARAMS, DEFAULT_EXCLUDED_QUERY_PARAMS, PAGE_PROPERTIES_EXCLUDED_FIELDS, };
80
+ export { CHANNEL, VERSION, CLICK_ID_PARAMS, DEFAULT_EXCLUDED_QUERY_PARAMS, DEFAULT_REFERRAL_PARAMS, PAGE_PROPERTIES_EXCLUDED_FIELDS, };
70
81
  //# sourceMappingURL=constants.js.map
@@ -72,6 +72,20 @@ export interface TrackingOptions {
72
72
  excludeHosts?: string[];
73
73
  excludePaths?: string[];
74
74
  excludeChains?: ChainID[];
75
+ /**
76
+ * IANA timezone names to opt out of tracking entirely. When the visitor's
77
+ * resolved timezone (via `Intl.DateTimeFormat().resolvedOptions().timeZone`)
78
+ * matches one of these, no events are enqueued or sent — including `identify`
79
+ * and `connect`. Matched case-insensitively against the full timezone string.
80
+ *
81
+ * Note: this is client-side, timezone-derived geolocation. It is best-effort
82
+ * and can be bypassed (a VPN does not change the browser timezone, and users
83
+ * can change their OS timezone). For authoritative jurisdiction blocking, use
84
+ * server-side IP geolocation at your ingest endpoint instead.
85
+ *
86
+ * @example ["Europe/London", "America/New_York"]
87
+ */
88
+ excludeTimezones?: string[];
75
89
  /**
76
90
  * Additional query parameter names to strip from forwarded and stored URLs,
77
91
  * on top of a built-in always-on denylist (currently `privy_oauth_code`,
@@ -124,8 +138,8 @@ export interface AutocaptureOptions {
124
138
  export interface ReferralOptions {
125
139
  /**
126
140
  * Custom query parameter names to check for referral codes
127
- * @default ["ref", "referral", "refcode"]
128
- * @example ["via", "referrer", "source"] - will check ?via=CODE, ?referrer=CODE, ?source=CODE
141
+ * @default ["ref", "referral", "refcode", "af", "referrer"]
142
+ * @example ["via", "partner", "source"] - will check ?via=CODE, ?partner=CODE, ?source=CODE
129
143
  */
130
144
  queryParams?: string[];
131
145
  /**
@@ -3,4 +3,5 @@ export * from "./base";
3
3
  export * from "./converter";
4
4
  export * from "./generate";
5
5
  export * from "./hash";
6
+ export * from "./timezone";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -3,4 +3,5 @@ export * from "./base";
3
3
  export * from "./converter";
4
4
  export * from "./generate";
5
5
  export * from "./hash";
6
+ export * from "./timezone";
6
7
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Resolve the current IANA timezone (e.g. "Europe/London") via the Intl API.
3
+ * Returns "" when the timezone cannot be resolved (e.g. Intl unavailable).
4
+ */
5
+ declare const getTimezone: () => string;
6
+ export { getTimezone };
7
+ //# sourceMappingURL=timezone.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { logger } from "../logger";
2
+ /**
3
+ * Resolve the current IANA timezone (e.g. "Europe/London") via the Intl API.
4
+ * Returns "" when the timezone cannot be resolved (e.g. Intl unavailable).
5
+ */
6
+ var getTimezone = function () {
7
+ try {
8
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || "";
9
+ }
10
+ catch (error) {
11
+ logger.error("Error resolving timezone:", error);
12
+ return "";
13
+ }
14
+ };
15
+ export { getTimezone };
16
+ //# sourceMappingURL=timezone.js.map