@leanbase.com/js 0.1.3 → 0.2.0-alpha.0

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.
Files changed (137) hide show
  1. package/LICENSE +37 -0
  2. package/dist/autocapture-utils.d.ts +17 -0
  3. package/dist/autocapture.d.ts +35 -0
  4. package/dist/config.d.ts +5 -0
  5. package/dist/constants.d.ts +54 -0
  6. package/dist/entrypoints/main.cjs.d.ts +4 -0
  7. package/dist/entrypoints/module.es.d.ts +4 -0
  8. package/dist/extensions/rageclick.d.ts +9 -0
  9. package/dist/iife.d.ts +19 -0
  10. package/dist/index.d.ts +2 -779
  11. package/dist/leanbase-logger.d.ts +6 -0
  12. package/dist/leanbase-persistence.d.ts +64 -0
  13. package/dist/leanbase.d.ts +49 -0
  14. package/dist/leanbase.iife.js +1 -4747
  15. package/dist/leanbase.iife.js.map +1 -1
  16. package/dist/main.js +2 -0
  17. package/dist/main.js.map +1 -0
  18. package/dist/module.d.ts +780 -0
  19. package/dist/module.js +2 -0
  20. package/dist/module.js.map +1 -0
  21. package/dist/page-view.d.ts +29 -0
  22. package/dist/scroll-manager.d.ts +21 -0
  23. package/dist/session-props.d.ts +32 -0
  24. package/dist/sessionid.d.ts +50 -0
  25. package/dist/storage.d.ts +24 -0
  26. package/{src/types.ts → dist/types.d.ts} +145 -235
  27. package/dist/utils/blocked-uas.d.ts +17 -0
  28. package/dist/utils/element-utils.d.ts +5 -0
  29. package/dist/utils/event-utils.d.ts +22 -0
  30. package/dist/utils/index.d.ts +44 -0
  31. package/dist/utils/request-utils.d.ts +12 -0
  32. package/dist/utils/simple-event-emitter.d.ts +6 -0
  33. package/dist/utils/user-agent-utils.d.ts +18 -0
  34. package/dist/uuidv7.d.ts +43 -0
  35. package/dist/version.d.ts +1 -0
  36. package/lib/autocapture-utils.d.ts +17 -0
  37. package/{src/autocapture-utils.ts → lib/autocapture-utils.js} +196 -280
  38. package/lib/autocapture-utils.js.map +1 -0
  39. package/lib/autocapture.d.ts +35 -0
  40. package/lib/autocapture.js +311 -0
  41. package/lib/autocapture.js.map +1 -0
  42. package/lib/config.d.ts +5 -0
  43. package/lib/config.js +7 -0
  44. package/lib/config.js.map +1 -0
  45. package/lib/constants.d.ts +54 -0
  46. package/{src/constants.ts → lib/constants.js} +50 -57
  47. package/lib/constants.js.map +1 -0
  48. package/lib/entrypoints/main.cjs.d.ts +4 -0
  49. package/lib/entrypoints/main.cjs.js +3 -0
  50. package/lib/entrypoints/main.cjs.js.map +1 -0
  51. package/lib/entrypoints/module.es.d.ts +4 -0
  52. package/lib/entrypoints/module.es.js +3 -0
  53. package/lib/entrypoints/module.es.js.map +1 -0
  54. package/lib/extensions/rageclick.d.ts +9 -0
  55. package/lib/extensions/rageclick.js +27 -0
  56. package/lib/extensions/rageclick.js.map +1 -0
  57. package/lib/iife.d.ts +19 -0
  58. package/lib/iife.js +67 -0
  59. package/lib/iife.js.map +1 -0
  60. package/{src/index.ts → lib/index.d.ts} +2 -2
  61. package/lib/index.js +2 -0
  62. package/lib/index.js.map +1 -0
  63. package/lib/leanbase-logger.d.ts +6 -0
  64. package/lib/leanbase-logger.js +25 -0
  65. package/lib/leanbase-logger.js.map +1 -0
  66. package/lib/leanbase-persistence.d.ts +64 -0
  67. package/lib/leanbase-persistence.js +287 -0
  68. package/lib/leanbase-persistence.js.map +1 -0
  69. package/lib/leanbase.d.ts +49 -0
  70. package/lib/leanbase.js +294 -0
  71. package/lib/leanbase.js.map +1 -0
  72. package/lib/page-view.d.ts +29 -0
  73. package/lib/page-view.js +81 -0
  74. package/lib/page-view.js.map +1 -0
  75. package/lib/scroll-manager.d.ts +21 -0
  76. package/lib/scroll-manager.js +79 -0
  77. package/lib/scroll-manager.js.map +1 -0
  78. package/lib/session-props.d.ts +32 -0
  79. package/lib/session-props.js +73 -0
  80. package/lib/session-props.js.map +1 -0
  81. package/lib/sessionid.d.ts +50 -0
  82. package/{src/sessionid.ts → lib/sessionid.js} +128 -204
  83. package/lib/sessionid.js.map +1 -0
  84. package/lib/storage.d.ts +24 -0
  85. package/{src/storage.ts → lib/storage.js} +182 -225
  86. package/lib/storage.js.map +1 -0
  87. package/lib/types.d.ts +544 -0
  88. package/lib/types.js +7 -0
  89. package/lib/types.js.map +1 -0
  90. package/lib/utils/blocked-uas.d.ts +17 -0
  91. package/{src/utils/blocked-uas.ts → lib/utils/blocked-uas.js} +19 -48
  92. package/lib/utils/blocked-uas.js.map +1 -0
  93. package/lib/utils/element-utils.d.ts +5 -0
  94. package/{src/utils/element-utils.ts → lib/utils/element-utils.js} +13 -17
  95. package/lib/utils/element-utils.js.map +1 -0
  96. package/lib/utils/event-utils.d.ts +22 -0
  97. package/lib/utils/event-utils.js +258 -0
  98. package/lib/utils/event-utils.js.map +1 -0
  99. package/lib/utils/index.d.ts +44 -0
  100. package/lib/utils/index.js +183 -0
  101. package/lib/utils/index.js.map +1 -0
  102. package/lib/utils/request-utils.d.ts +12 -0
  103. package/lib/utils/request-utils.js +107 -0
  104. package/lib/utils/request-utils.js.map +1 -0
  105. package/lib/utils/simple-event-emitter.d.ts +6 -0
  106. package/lib/utils/simple-event-emitter.js +24 -0
  107. package/lib/utils/simple-event-emitter.js.map +1 -0
  108. package/lib/utils/user-agent-utils.d.ts +18 -0
  109. package/lib/utils/user-agent-utils.js +369 -0
  110. package/lib/utils/user-agent-utils.js.map +1 -0
  111. package/lib/uuidv7.d.ts +43 -0
  112. package/{src/uuidv7.ts → lib/uuidv7.js} +103 -131
  113. package/lib/uuidv7.js.map +1 -0
  114. package/lib/version.d.ts +1 -0
  115. package/lib/version.js +2 -0
  116. package/lib/version.js.map +1 -0
  117. package/package.json +56 -45
  118. package/dist/index.cjs +0 -3034
  119. package/dist/index.cjs.map +0 -1
  120. package/dist/index.mjs +0 -3032
  121. package/dist/index.mjs.map +0 -1
  122. package/src/autocapture.ts +0 -415
  123. package/src/config.ts +0 -8
  124. package/src/extensions/rageclick.ts +0 -34
  125. package/src/iife.ts +0 -87
  126. package/src/leanbase-logger.ts +0 -26
  127. package/src/leanbase-persistence.ts +0 -374
  128. package/src/leanbase.ts +0 -424
  129. package/src/page-view.ts +0 -124
  130. package/src/scroll-manager.ts +0 -103
  131. package/src/session-props.ts +0 -114
  132. package/src/utils/event-utils.ts +0 -304
  133. package/src/utils/index.ts +0 -222
  134. package/src/utils/request-utils.ts +0 -128
  135. package/src/utils/simple-event-emitter.ts +0 -27
  136. package/src/utils/user-agent-utils.ts +0 -357
  137. package/src/version.ts +0 -1
@@ -42,39 +42,32 @@ export const DEFAULT_BLOCKED_UA_STRS = [
42
42
  'yahoo! slurp',
43
43
  'yandexbot',
44
44
  'zoombot',
45
-
46
45
  // Bot-like words, maybe we should block `bot` entirely?
47
46
  'bot.htm',
48
47
  'bot.php',
49
48
  '(bot;',
50
49
  'bot/',
51
50
  'crawler',
52
-
53
51
  // Ahrefs: https://ahrefs.com/seo/glossary/ahrefsbot
54
52
  'ahrefsbot',
55
53
  'ahrefssiteaudit',
56
-
57
54
  // Semrush bots: https://www.semrush.com/bot/
58
55
  'semrushbot',
59
56
  'siteauditbot',
60
57
  'splitsignalbot',
61
-
62
58
  // AI Crawlers
63
59
  'gptbot',
64
60
  'oai-searchbot',
65
61
  'chatgpt-user',
66
62
  'perplexitybot',
67
-
68
63
  // Uptime-like stuff
69
64
  'better uptime bot',
70
65
  'sentryuptimebot',
71
66
  'uptimerobot',
72
-
73
67
  // headless browsers
74
68
  'headlesschrome',
75
69
  'cypress',
76
70
  // we don't block electron here, as many customers use posthog-js in electron apps
77
-
78
71
  // a whole bunch of goog-specific crawlers
79
72
  // https://developers.google.com/search/docs/advanced/crawling/overview-google-crawlers
80
73
  'google-hoteladsverifier',
@@ -93,70 +86,48 @@ export const DEFAULT_BLOCKED_UA_STRS = [
93
86
  'storebot-google',
94
87
  'google-inspectiontool',
95
88
  'bytespider',
96
- ]
97
-
89
+ ];
98
90
  /**
99
91
  * Block various web spiders from executing our JS and sending false capturing data
100
92
  */
101
- export const isBlockedUA = function (ua: string, customBlockedUserAgents: string[]): boolean {
93
+ export const isBlockedUA = function (ua, customBlockedUserAgents) {
102
94
  if (!ua) {
103
- return false
95
+ return false;
104
96
  }
105
-
106
- const uaLower = ua.toLowerCase()
97
+ const uaLower = ua.toLowerCase();
107
98
  return DEFAULT_BLOCKED_UA_STRS.concat(customBlockedUserAgents || []).some((blockedUA) => {
108
- const blockedUaLower = blockedUA.toLowerCase()
109
-
99
+ const blockedUaLower = blockedUA.toLowerCase();
110
100
  // can't use includes because IE 11 :/
111
- return uaLower.indexOf(blockedUaLower) !== -1
112
- })
113
- }
114
-
115
- // There's more in the type, but this is all we use. It's currently experimental, see
116
- // https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgentData
117
- // if you're reading this in the future, when it's no longer experimental, please remove this type and use an official one.
118
- // Be extremely defensive here to ensure backwards and *forwards* compatibility, and remove this defensiveness in the
119
- // future when it is safe to do so.
120
- export interface NavigatorUAData {
121
- brands?: {
122
- brand: string
123
- version: string
124
- }[]
125
- }
126
- declare global {
127
- interface Navigator {
128
- userAgentData?: NavigatorUAData
129
- }
130
- }
131
-
132
- export const isLikelyBot = function (navigator: Navigator | undefined, customBlockedUserAgents: string[]): boolean {
101
+ return uaLower.indexOf(blockedUaLower) !== -1;
102
+ });
103
+ };
104
+ export const isLikelyBot = function (navigator, customBlockedUserAgents) {
133
105
  if (!navigator) {
134
- return false
106
+ return false;
135
107
  }
136
- const ua = navigator.userAgent
108
+ const ua = navigator.userAgent;
137
109
  if (ua) {
138
110
  if (isBlockedUA(ua, customBlockedUserAgents)) {
139
- return true
111
+ return true;
140
112
  }
141
113
  }
142
114
  try {
143
115
  // eslint-disable-next-line compat/compat
144
- const uaData = navigator?.userAgentData as NavigatorUAData
116
+ const uaData = navigator?.userAgentData;
145
117
  if (uaData?.brands && uaData.brands.some((brandObj) => isBlockedUA(brandObj?.brand, customBlockedUserAgents))) {
146
- return true
118
+ return true;
147
119
  }
148
- } catch {
120
+ }
121
+ catch {
149
122
  // ignore the error, we were using experimental browser features
150
123
  }
151
-
152
- return !!navigator.webdriver
153
-
124
+ return !!navigator.webdriver;
154
125
  // There's some more enhancements we could make in this area, e.g. it's possible to check if Chrome dev tools are
155
126
  // open, which will detect some bots that are trying to mask themselves and might get past the checks above.
156
127
  // However, this would give false positives for actual humans who have dev tools open.
157
-
158
128
  // We could also use the data in navigator.userAgentData.getHighEntropyValues() to detect bots, but we should wait
159
129
  // until this stops being experimental. The MDN docs imply that this might eventually require user permission.
160
130
  // See https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/getHighEntropyValues
161
131
  // It would be very bad if posthog-js caused a permission prompt to appear on every page load.
162
- }
132
+ };
133
+ //# sourceMappingURL=blocked-uas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocked-uas.js","sourceRoot":"","sources":["../../src/utils/blocked-uas.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACnC,4BAA4B;IAC5B,WAAW;IACX,kBAAkB;IAClB,qBAAqB,EAAE,6GAA6G;IACpI,UAAU;IACV,iBAAiB;IACjB,WAAW;IACX,sBAAsB;IACtB,aAAa;IACb,SAAS;IACT,aAAa;IACb,mBAAmB;IACnB,eAAe;IACf,UAAU;IACV,aAAa;IACb,kBAAkB;IAClB,iBAAiB;IACjB,wBAAwB;IACxB,SAAS;IACT,aAAa;IACb,UAAU;IACV,aAAa;IACb,oBAAoB;IACpB,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,WAAW;IACX,WAAW;IACX,UAAU;IACV,gBAAgB;IAChB,UAAU;IACV,UAAU;IACV,UAAU;IACV,OAAO;IACP,gBAAgB;IAChB,UAAU;IACV,YAAY;IACZ,mBAAmB;IACnB,WAAW;IACX,cAAc;IACd,WAAW;IACX,SAAS;IAET,wDAAwD;IACxD,SAAS;IACT,SAAS;IACT,OAAO;IACP,MAAM;IACN,SAAS;IAET,oDAAoD;IACpD,WAAW;IACX,iBAA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EAAE,CAAC;YAC3C,OAAO,IAAI,CAAA;QACf,CAAC;IACL,CAAC;IACD,IAAI,CAAC;QACD,yCAAyC;QACzC,MAAM,MAAM,GAAG,SAAS,EAAE,aAAgC,CAAA;QAC1D,IAAI,MAAM,EAAE,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC;YAC5G,OAAO,IAAI,CAAA;QACf,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACL,gEAAgE;IACpE,CAAC;IAED,OAAO,CAAC,CAAC,SAAS,CAAC,SAAS,CAAA;IAE5B,iHAAiH;IACjH,4GAA4G;IAC5G,sFAAsF;IAEtF,kHAAkH;IAClH,8GAA8G;IAC9G,4FAA4F;IAC5F,8FAA8F;AAClG,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ export declare function isElementInToolbar(el: EventTarget | null): boolean;
2
+ export declare function isElementNode(el: Node | Element | undefined | null): el is Element;
3
+ export declare function isTag(el: Element | undefined | null, tag: string): el is HTMLElement;
4
+ export declare function isTextNode(el: Element | undefined | null): el is HTMLElement;
5
+ export declare function isDocumentFragment(el: Element | ParentNode | undefined | null): el is DocumentFragment;
@@ -1,22 +1,19 @@
1
- import { TOOLBAR_CONTAINER_CLASS, TOOLBAR_ID } from '../constants'
2
-
3
- export function isElementInToolbar(el: EventTarget | null): boolean {
1
+ import { TOOLBAR_CONTAINER_CLASS, TOOLBAR_ID } from '../constants';
2
+ export function isElementInToolbar(el) {
4
3
  if (el instanceof Element) {
5
4
  // closest isn't available in IE11, but we'll polyfill when bundling
6
- return el.id === TOOLBAR_ID || !!el.closest?.('.' + TOOLBAR_CONTAINER_CLASS)
5
+ return el.id === TOOLBAR_ID || !!el.closest?.('.' + TOOLBAR_CONTAINER_CLASS);
7
6
  }
8
- return false
7
+ return false;
9
8
  }
10
-
11
9
  /*
12
10
  * Check whether an element has nodeType Node.ELEMENT_NODE
13
11
  * @param {Element} el - element to check
14
12
  * @returns {boolean} whether el is of the correct nodeType
15
13
  */
16
- export function isElementNode(el: Node | Element | undefined | null): el is Element {
17
- return !!el && el.nodeType === 1 // Node.ELEMENT_NODE - use integer constant for browser portability
14
+ export function isElementNode(el) {
15
+ return !!el && el.nodeType === 1; // Node.ELEMENT_NODE - use integer constant for browser portability
18
16
  }
19
-
20
17
  /*
21
18
  * Check whether an element is of a given tag type.
22
19
  * Due to potential reference discrepancies (such as the webcomponents.js polyfill),
@@ -27,24 +24,23 @@ export function isElementNode(el: Node | Element | undefined | null): el is Elem
27
24
  * @param {string} tag - tag name (e.g., "div")
28
25
  * @returns {boolean} whether el is of the given tag type
29
26
  */
30
- export function isTag(el: Element | undefined | null, tag: string): el is HTMLElement {
31
- return !!el && !!el.tagName && el.tagName.toLowerCase() === tag.toLowerCase()
27
+ export function isTag(el, tag) {
28
+ return !!el && !!el.tagName && el.tagName.toLowerCase() === tag.toLowerCase();
32
29
  }
33
-
34
30
  /*
35
31
  * Check whether an element has nodeType Node.TEXT_NODE
36
32
  * @param {Element} el - element to check
37
33
  * @returns {boolean} whether el is of the correct nodeType
38
34
  */
39
- export function isTextNode(el: Element | undefined | null): el is HTMLElement {
40
- return !!el && el.nodeType === 3 // Node.TEXT_NODE - use integer constant for browser portability
35
+ export function isTextNode(el) {
36
+ return !!el && el.nodeType === 3; // Node.TEXT_NODE - use integer constant for browser portability
41
37
  }
42
-
43
38
  /*
44
39
  * Check whether an element has nodeType Node.DOCUMENT_FRAGMENT_NODE
45
40
  * @param {Element} el - element to check
46
41
  * @returns {boolean} whether el is of the correct nodeType
47
42
  */
48
- export function isDocumentFragment(el: Element | ParentNode | undefined | null): el is DocumentFragment {
49
- return !!el && el.nodeType === 11 // Node.DOCUMENT_FRAGMENT_NODE - use integer constant for browser portability
43
+ export function isDocumentFragment(el) {
44
+ return !!el && el.nodeType === 11; // Node.DOCUMENT_FRAGMENT_NODE - use integer constant for browser portability
50
45
  }
46
+ //# sourceMappingURL=element-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-utils.js","sourceRoot":"","sources":["../../src/utils/element-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAElE,MAAM,UAAU,kBAAkB,CAAC,EAAsB;IACrD,IAAI,EAAE,YAAY,OAAO,EAAE,CAAC;QACxB,oEAAoE;QACpE,OAAO,EAAE,CAAC,EAAE,KAAK,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,GAAG,uBAAuB,CAAC,CAAA;IAChF,CAAC;IACD,OAAO,KAAK,CAAA;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,EAAqC;IAC/D,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,KAAK,CAAC,CAAA,CAAC,mEAAmE;AACxG,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,KAAK,CAAC,EAA8B,EAAE,GAAW;IAC7D,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,WAAW,EAAE,CAAA;AACjF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,EAA8B;IACrD,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,KAAK,CAAC,CAAA,CAAC,gEAAgE;AACrG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAA2C;IAC1E,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,KAAK,EAAE,CAAA,CAAC,6EAA6E;AACnH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Properties } from '../types';
2
+ export declare const PERSONAL_DATA_CAMPAIGN_PARAMS: string[];
3
+ export declare const CAMPAIGN_PARAMS: string[];
4
+ export declare const EVENT_TO_PERSON_PROPERTIES: string[];
5
+ export declare const MASKED = "<masked>";
6
+ export declare const COOKIE_CAMPAIGN_PARAMS: string[];
7
+ export declare function getCampaignParams(customTrackedParams?: string[], maskPersonalDataProperties?: boolean, customPersonalDataProperties?: string[] | undefined): Record<string, string>;
8
+ export declare function getSearchInfo(): Record<string, any>;
9
+ export declare function getBrowserLanguage(): string | undefined;
10
+ export declare function getBrowserLanguagePrefix(): string | undefined;
11
+ export declare function getReferrer(): string;
12
+ export declare function getReferringDomain(): string;
13
+ export declare function getReferrerInfo(): Record<string, any>;
14
+ export declare function getPersonInfo(maskPersonalDataProperties?: boolean, customPersonalDataProperties?: string[]): {
15
+ r: string;
16
+ u: string | undefined;
17
+ };
18
+ export declare function getPersonPropsFromInfo(info: Record<string, any>): Record<string, any>;
19
+ export declare function getInitialPersonPropsFromInfo(info: Record<string, any>): Record<string, any>;
20
+ export declare function getTimezone(): string | undefined;
21
+ export declare function getTimezoneOffset(): number | undefined;
22
+ export declare function getEventProperties(maskPersonalDataProperties?: boolean, customPersonalDataProperties?: string[]): Properties;
@@ -0,0 +1,258 @@
1
+ import { convertToURL, getQueryParam, maskQueryParams } from './request-utils';
2
+ import { isNull, stripLeadingDollar } from '@posthog/core';
3
+ import { each, extend, extendArray, stripEmptyProperties } from './index';
4
+ import { document, location, userAgent, window } from './';
5
+ import { detectBrowser, detectBrowserVersion, detectDevice, detectDeviceType, detectOS } from './user-agent-utils';
6
+ import { cookieStore } from '../storage';
7
+ import Config from '../config';
8
+ const URL_REGEX_PREFIX = 'https?://(.*)';
9
+ // CAMPAIGN_PARAMS and EVENT_TO_PERSON_PROPERTIES should be kept in sync with
10
+ // https://github.com/PostHog/posthog/blob/master/plugin-server/src/utils/db/utils.ts#L60
11
+ // The list of campaign parameters that could be considered personal data under e.g. GDPR.
12
+ // These can be masked in URLs and properties before being sent to posthog.
13
+ export const PERSONAL_DATA_CAMPAIGN_PARAMS = [
14
+ 'gclid', // google ads
15
+ 'gclsrc', // google ads 360
16
+ 'dclid', // google display ads
17
+ 'gbraid', // google ads, web to app
18
+ 'wbraid', // google ads, app to web
19
+ 'fbclid', // facebook
20
+ 'msclkid', // microsoft
21
+ 'twclid', // twitter
22
+ 'li_fat_id', // linkedin
23
+ 'igshid', // instagram
24
+ 'ttclid', // tiktok
25
+ 'rdt_cid', // reddit
26
+ 'epik', // pinterest
27
+ 'qclid', // quora
28
+ 'sccid', // snapchat
29
+ 'irclid', // impact
30
+ '_kx', // klaviyo
31
+ ];
32
+ export const CAMPAIGN_PARAMS = extendArray([
33
+ 'utm_source',
34
+ 'utm_medium',
35
+ 'utm_campaign',
36
+ 'utm_content',
37
+ 'utm_term',
38
+ 'gad_source', // google ads source
39
+ 'mc_cid', // mailchimp campaign id
40
+ ], PERSONAL_DATA_CAMPAIGN_PARAMS);
41
+ export const EVENT_TO_PERSON_PROPERTIES = [
42
+ // mobile params
43
+ '$app_build',
44
+ '$app_name',
45
+ '$app_namespace',
46
+ '$app_version',
47
+ // web params
48
+ '$browser',
49
+ '$browser_version',
50
+ '$device_type',
51
+ '$current_url',
52
+ '$pathname',
53
+ '$os',
54
+ '$os_name', // $os_name is a special case, it's treated as an alias of $os!
55
+ '$os_version',
56
+ '$referring_domain',
57
+ '$referrer',
58
+ '$screen_height',
59
+ '$screen_width',
60
+ '$viewport_height',
61
+ '$viewport_width',
62
+ '$raw_user_agent',
63
+ ];
64
+ export const MASKED = '<masked>';
65
+ // Campaign params that can be read from the cookie store
66
+ export const COOKIE_CAMPAIGN_PARAMS = [
67
+ 'li_fat_id', // linkedin
68
+ ];
69
+ export function getCampaignParams(customTrackedParams, maskPersonalDataProperties, customPersonalDataProperties) {
70
+ if (!document) {
71
+ return {};
72
+ }
73
+ const paramsToMask = maskPersonalDataProperties
74
+ ? extendArray([], PERSONAL_DATA_CAMPAIGN_PARAMS, customPersonalDataProperties || [])
75
+ : [];
76
+ // Initially get campaign params from the URL
77
+ const urlCampaignParams = _getCampaignParamsFromUrl(maskQueryParams(document.URL, paramsToMask, MASKED), customTrackedParams);
78
+ // But we can also get some of them from the cookie store
79
+ // For example: https://learn.microsoft.com/en-us/linkedin/marketing/conversions/enabling-first-party-cookies?view=li-lms-2025-05#reading-li_fat_id-from-cookies
80
+ const cookieCampaignParams = _getCampaignParamsFromCookie();
81
+ // Prefer the values found in the urlCampaignParams if possible
82
+ // `extend` will override the values if found in the second argument
83
+ return extend(cookieCampaignParams, urlCampaignParams);
84
+ }
85
+ function _getCampaignParamsFromUrl(url, customParams) {
86
+ const campaign_keywords = CAMPAIGN_PARAMS.concat(customParams || []);
87
+ const params = {};
88
+ each(campaign_keywords, function (kwkey) {
89
+ const kw = getQueryParam(url, kwkey);
90
+ params[kwkey] = kw ? kw : null;
91
+ });
92
+ return params;
93
+ }
94
+ function _getCampaignParamsFromCookie() {
95
+ const params = {};
96
+ each(COOKIE_CAMPAIGN_PARAMS, function (kwkey) {
97
+ const kw = cookieStore._get(kwkey);
98
+ params[kwkey] = kw ? kw : null;
99
+ });
100
+ return params;
101
+ }
102
+ function _getSearchEngine(referrer) {
103
+ if (!referrer) {
104
+ return null;
105
+ }
106
+ else {
107
+ if (referrer.search(URL_REGEX_PREFIX + 'google.([^/?]*)') === 0) {
108
+ return 'google';
109
+ }
110
+ else if (referrer.search(URL_REGEX_PREFIX + 'bing.com') === 0) {
111
+ return 'bing';
112
+ }
113
+ else if (referrer.search(URL_REGEX_PREFIX + 'yahoo.com') === 0) {
114
+ return 'yahoo';
115
+ }
116
+ else if (referrer.search(URL_REGEX_PREFIX + 'duckduckgo.com') === 0) {
117
+ return 'duckduckgo';
118
+ }
119
+ else {
120
+ return null;
121
+ }
122
+ }
123
+ }
124
+ function _getSearchInfoFromReferrer(referrer) {
125
+ const search = _getSearchEngine(referrer);
126
+ const param = search != 'yahoo' ? 'q' : 'p';
127
+ const ret = {};
128
+ if (!isNull(search)) {
129
+ ret['$search_engine'] = search;
130
+ const keyword = document ? getQueryParam(document.referrer, param) : '';
131
+ if (keyword.length) {
132
+ ret['ph_keyword'] = keyword;
133
+ }
134
+ }
135
+ return ret;
136
+ }
137
+ export function getSearchInfo() {
138
+ const referrer = document?.referrer;
139
+ if (!referrer) {
140
+ return {};
141
+ }
142
+ return _getSearchInfoFromReferrer(referrer);
143
+ }
144
+ export function getBrowserLanguage() {
145
+ return (navigator.language || // Any modern browser
146
+ navigator.userLanguage // IE11
147
+ );
148
+ }
149
+ export function getBrowserLanguagePrefix() {
150
+ const lang = getBrowserLanguage();
151
+ return typeof lang === 'string' ? lang.split('-')[0] : undefined;
152
+ }
153
+ export function getReferrer() {
154
+ return document?.referrer || '$direct';
155
+ }
156
+ export function getReferringDomain() {
157
+ if (!document?.referrer) {
158
+ return '$direct';
159
+ }
160
+ return convertToURL(document.referrer)?.host || '$direct';
161
+ }
162
+ export function getReferrerInfo() {
163
+ return {
164
+ $referrer: getReferrer(),
165
+ $referring_domain: getReferringDomain(),
166
+ };
167
+ }
168
+ export function getPersonInfo(maskPersonalDataProperties, customPersonalDataProperties) {
169
+ const paramsToMask = maskPersonalDataProperties
170
+ ? extendArray([], PERSONAL_DATA_CAMPAIGN_PARAMS, customPersonalDataProperties || [])
171
+ : [];
172
+ const url = location?.href.substring(0, 1000);
173
+ // we're being a bit more economical with bytes here because this is stored in the cookie
174
+ return {
175
+ r: getReferrer().substring(0, 1000),
176
+ u: url ? maskQueryParams(url, paramsToMask, MASKED) : undefined,
177
+ };
178
+ }
179
+ export function getPersonPropsFromInfo(info) {
180
+ const { r: referrer, u: url } = info;
181
+ const referring_domain = referrer == null ? undefined : referrer == '$direct' ? '$direct' : convertToURL(referrer)?.host;
182
+ const props = {
183
+ $referrer: referrer,
184
+ $referring_domain: referring_domain,
185
+ };
186
+ if (url) {
187
+ props['$current_url'] = url;
188
+ const location = convertToURL(url);
189
+ props['$host'] = location?.host;
190
+ props['$pathname'] = location?.pathname;
191
+ const campaignParams = _getCampaignParamsFromUrl(url);
192
+ extend(props, campaignParams);
193
+ }
194
+ if (referrer) {
195
+ const searchInfo = _getSearchInfoFromReferrer(referrer);
196
+ extend(props, searchInfo);
197
+ }
198
+ return props;
199
+ }
200
+ export function getInitialPersonPropsFromInfo(info) {
201
+ const personProps = getPersonPropsFromInfo(info);
202
+ const props = {};
203
+ each(personProps, function (val, key) {
204
+ props[`$initial_${stripLeadingDollar(key)}`] = val;
205
+ });
206
+ return props;
207
+ }
208
+ export function getTimezone() {
209
+ try {
210
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
211
+ }
212
+ catch {
213
+ return undefined;
214
+ }
215
+ }
216
+ export function getTimezoneOffset() {
217
+ try {
218
+ return new Date().getTimezoneOffset();
219
+ }
220
+ catch {
221
+ return undefined;
222
+ }
223
+ }
224
+ export function getEventProperties(maskPersonalDataProperties, customPersonalDataProperties) {
225
+ if (!userAgent) {
226
+ return {};
227
+ }
228
+ const paramsToMask = maskPersonalDataProperties
229
+ ? extendArray([], PERSONAL_DATA_CAMPAIGN_PARAMS, customPersonalDataProperties || [])
230
+ : [];
231
+ const [os_name, os_version] = detectOS(userAgent);
232
+ return extend(stripEmptyProperties({
233
+ $os: os_name,
234
+ $os_version: os_version,
235
+ $browser: detectBrowser(userAgent, navigator.vendor),
236
+ $device: detectDevice(userAgent),
237
+ $device_type: detectDeviceType(userAgent),
238
+ $timezone: getTimezone(),
239
+ $timezone_offset: getTimezoneOffset(),
240
+ }), {
241
+ $current_url: maskQueryParams(location?.href, paramsToMask, MASKED),
242
+ $host: location?.host,
243
+ $pathname: location?.pathname,
244
+ $raw_user_agent: userAgent.length > 1000 ? userAgent.substring(0, 997) + '...' : userAgent,
245
+ $browser_version: detectBrowserVersion(userAgent, navigator.vendor),
246
+ $browser_language: getBrowserLanguage(),
247
+ $browser_language_prefix: getBrowserLanguagePrefix(),
248
+ $screen_height: window?.screen.height,
249
+ $screen_width: window?.screen.width,
250
+ $viewport_height: window?.innerHeight,
251
+ $viewport_width: window?.innerWidth,
252
+ $lib: 'web',
253
+ $lib_version: Config.LIB_VERSION,
254
+ $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10),
255
+ $time: Date.now() / 1000, // epoch time in seconds
256
+ });
257
+ }
258
+ //# sourceMappingURL=event-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-utils.js","sourceRoot":"","sources":["../../src/utils/event-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC9E,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AACzE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,IAAI,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,MAAM,MAAM,WAAW,CAAA;AAG9B,MAAM,gBAAgB,GAAG,eAAe,CAAA;AAExC,6EAA6E;AAC7E,yFAAyF;AAEzF,0FAA0F;AAC1F,2EAA2E;AAC3E,MAAM,CAAC,MAAM,6BAA6B,GAAG;IACzC,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,iBAAiB;IAC3B,OAAO,EAAE,qBAAqB;IAC9B,QAAQ,EAAE,yBAAyB;IACnC,QAAQ,EAAE,yBAAyB;IACnC,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,WAAW;IACxB,QAAQ,EAAE,YAAY;IACtB,QAAQ,EAAE,SAAS;IACnB,SAAS,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K,EAAE,QAAQ,EAAE,IAAI;QACrB,SAAS,EAAE,QAAQ,EAAE,QAAQ;QAC7B,eAAe,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS;QAC1F,gBAAgB,EAAE,oBAAoB,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC;QACnE,iBAAiB,EAAE,kBAAkB,EAAE;QACvC,wBAAwB,EAAE,wBAAwB,EAAE;QACpD,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM;QACrC,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK;QACnC,gBAAgB,EAAE,MAAM,EAAE,WAAW;QACrC,eAAe,EAAE,MAAM,EAAE,UAAU;QACnC,IAAI,EAAE,KAAK;QACX,YAAY,EAAE,MAAM,CAAC,WAAW;QAChC,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC;QACrG,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,wBAAwB;KACrD,CACJ,CAAA;AACL,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { Properties } from '../types';
2
+ export type Breaker = {};
3
+ export declare const ArrayProto: any[];
4
+ export declare const nativeForEach: (callbackfn: (value: any, index: number, array: any[]) => void, thisArg?: any) => void;
5
+ export declare const nativeIndexOf: (searchElement: any, fromIndex?: number) => number;
6
+ declare const win: (Window & typeof globalThis) | undefined;
7
+ export declare const navigator: Navigator | undefined;
8
+ export declare const document: Document | undefined;
9
+ export declare const location: Location | undefined;
10
+ export declare const fetch: typeof globalThis.fetch | undefined;
11
+ export declare const XMLHttpRequest: {
12
+ new (): XMLHttpRequest;
13
+ prototype: XMLHttpRequest;
14
+ readonly UNSENT: 0;
15
+ readonly OPENED: 1;
16
+ readonly HEADERS_RECEIVED: 2;
17
+ readonly LOADING: 3;
18
+ readonly DONE: 4;
19
+ } | undefined;
20
+ export declare const AbortController: {
21
+ new (): AbortController;
22
+ prototype: AbortController;
23
+ } | undefined;
24
+ export declare const userAgent: string | undefined;
25
+ export { win as window };
26
+ export declare function eachArray<E = any>(obj: E[] | null | undefined, iterator: (value: E, key: number) => void | Breaker, thisArg?: any): void;
27
+ /**
28
+ * @param {*=} obj
29
+ * @param {function(...*)=} iterator
30
+ * @param {Object=} thisArg
31
+ */
32
+ export declare function each(obj: any, iterator: (value: any, key: any) => void | Breaker, thisArg?: any): void;
33
+ export declare const extend: (obj: Record<string, any>, ...args: Record<string, any>[]) => Record<string, any>;
34
+ export declare const extendArray: <T>(obj: T[], ...args: T[][]) => T[];
35
+ export declare const include: (obj: null | string | Array<any> | Record<string, any>, target: any) => boolean | Breaker;
36
+ /**
37
+ * Object.entries() polyfill
38
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
39
+ */
40
+ export declare function entries<T = any>(obj: Record<string, T>): [string, T][];
41
+ export declare function addEventListener(element: Window | Document | Element | undefined, event: string, callback: EventListener, options?: AddEventListenerOptions): void;
42
+ export declare const stripEmptyProperties: (p: Properties) => Properties;
43
+ export declare function isCrossDomainCookie(documentLocation: Location | undefined): boolean;
44
+ export declare function copyAndTruncateStrings<T extends Record<string, any> = Record<string, any>>(object: T, maxStringLength: number | null): T;