posthog-js 1.98.2 → 1.100.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.
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/es.js +1 -1
- package/dist/es.js.map +1 -1
- package/dist/module.d.ts +5 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/page-view.d.ts +4 -0
- package/lib/src/page-view.js +60 -9
- package/lib/src/page-view.js.map +1 -1
- package/lib/src/posthog-core.js +3 -3
- package/lib/src/posthog-core.js.map +1 -1
- package/lib/src/types.d.ts +2 -1
- package/lib/src/types.js.map +1 -1
- package/package.json +1 -1
package/lib/package.json
CHANGED
package/lib/src/page-view.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PostHog } from './posthog-core';
|
|
1
2
|
interface PageViewData {
|
|
2
3
|
pathname: string;
|
|
3
4
|
maxScrollHeight?: number;
|
|
@@ -23,6 +24,8 @@ interface PageViewEventProperties extends ScrollProperties {
|
|
|
23
24
|
export declare class PageViewManager {
|
|
24
25
|
_pageViewData: PageViewData | undefined;
|
|
25
26
|
_hasSeenPageView: boolean;
|
|
27
|
+
_instance: PostHog;
|
|
28
|
+
constructor(instance: PostHog);
|
|
26
29
|
_createPageViewData(): PageViewData;
|
|
27
30
|
doPageView(): PageViewEventProperties;
|
|
28
31
|
doPageLeave(): PageViewEventProperties;
|
|
@@ -30,6 +33,7 @@ export declare class PageViewManager {
|
|
|
30
33
|
_updateScrollData: () => void;
|
|
31
34
|
startMeasuringScrollPosition(): void;
|
|
32
35
|
stopMeasuringScrollPosition(): void;
|
|
36
|
+
_scrollElement(): Element | null | undefined;
|
|
33
37
|
_scrollHeight(): number;
|
|
34
38
|
_scrollY(): number;
|
|
35
39
|
_contentHeight(): number;
|
package/lib/src/page-view.js
CHANGED
|
@@ -9,9 +9,21 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __values = (this && this.__values) || function(o) {
|
|
13
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
14
|
+
if (m) return m.call(o);
|
|
15
|
+
if (o && typeof o.length === "number") return {
|
|
16
|
+
next: function () {
|
|
17
|
+
if (o && i >= o.length) o = void 0;
|
|
18
|
+
return { value: o && o[i++], done: !o };
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
22
|
+
};
|
|
12
23
|
import { window } from './utils/globals';
|
|
24
|
+
import { _isArray } from './utils/type-utils';
|
|
13
25
|
var PageViewManager = /** @class */ (function () {
|
|
14
|
-
function PageViewManager() {
|
|
26
|
+
function PageViewManager(instance) {
|
|
15
27
|
var _this = this;
|
|
16
28
|
this._hasSeenPageView = false;
|
|
17
29
|
this._updateScrollData = function () {
|
|
@@ -31,6 +43,7 @@ var PageViewManager = /** @class */ (function () {
|
|
|
31
43
|
pageViewData.maxContentY = Math.max(contentY, (_c = pageViewData.maxContentY) !== null && _c !== void 0 ? _c : 0);
|
|
32
44
|
pageViewData.maxContentHeight = Math.max(contentHeight, (_d = pageViewData.maxContentHeight) !== null && _d !== void 0 ? _d : 0);
|
|
33
45
|
};
|
|
46
|
+
this._instance = instance;
|
|
34
47
|
}
|
|
35
48
|
PageViewManager.prototype._createPageViewData = function () {
|
|
36
49
|
var _a;
|
|
@@ -97,8 +110,11 @@ var PageViewManager = /** @class */ (function () {
|
|
|
97
110
|
};
|
|
98
111
|
};
|
|
99
112
|
PageViewManager.prototype.startMeasuringScrollPosition = function () {
|
|
100
|
-
|
|
101
|
-
|
|
113
|
+
// setting the third argument to `true` means that we will receive scroll events for other scrollable elements
|
|
114
|
+
// on the page, not just the window
|
|
115
|
+
// see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#usecapture
|
|
116
|
+
window === null || window === void 0 ? void 0 : window.addEventListener('scroll', this._updateScrollData, true);
|
|
117
|
+
window === null || window === void 0 ? void 0 : window.addEventListener('scrollend', this._updateScrollData, true);
|
|
102
118
|
window === null || window === void 0 ? void 0 : window.addEventListener('resize', this._updateScrollData);
|
|
103
119
|
};
|
|
104
120
|
PageViewManager.prototype.stopMeasuringScrollPosition = function () {
|
|
@@ -106,19 +122,54 @@ var PageViewManager = /** @class */ (function () {
|
|
|
106
122
|
window === null || window === void 0 ? void 0 : window.removeEventListener('scrollend', this._updateScrollData);
|
|
107
123
|
window === null || window === void 0 ? void 0 : window.removeEventListener('resize', this._updateScrollData);
|
|
108
124
|
};
|
|
125
|
+
PageViewManager.prototype._scrollElement = function () {
|
|
126
|
+
var e_1, _a;
|
|
127
|
+
if (this._instance.config.scroll_root_selector) {
|
|
128
|
+
var selectors = _isArray(this._instance.config.scroll_root_selector)
|
|
129
|
+
? this._instance.config.scroll_root_selector
|
|
130
|
+
: [this._instance.config.scroll_root_selector];
|
|
131
|
+
try {
|
|
132
|
+
for (var selectors_1 = __values(selectors), selectors_1_1 = selectors_1.next(); !selectors_1_1.done; selectors_1_1 = selectors_1.next()) {
|
|
133
|
+
var selector = selectors_1_1.value;
|
|
134
|
+
var element = window === null || window === void 0 ? void 0 : window.document.querySelector(selector);
|
|
135
|
+
if (element) {
|
|
136
|
+
return element;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
141
|
+
finally {
|
|
142
|
+
try {
|
|
143
|
+
if (selectors_1_1 && !selectors_1_1.done && (_a = selectors_1.return)) _a.call(selectors_1);
|
|
144
|
+
}
|
|
145
|
+
finally { if (e_1) throw e_1.error; }
|
|
146
|
+
}
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
return window === null || window === void 0 ? void 0 : window.document.documentElement;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
109
153
|
PageViewManager.prototype._scrollHeight = function () {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
: 0;
|
|
154
|
+
var element = this._scrollElement();
|
|
155
|
+
return element ? Math.max(0, element.scrollHeight - element.clientHeight) : 0;
|
|
113
156
|
};
|
|
114
157
|
PageViewManager.prototype._scrollY = function () {
|
|
115
|
-
|
|
158
|
+
if (this._instance.config.scroll_root_selector) {
|
|
159
|
+
var element = this._scrollElement();
|
|
160
|
+
return (element && element.scrollTop) || 0;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
return window ? window.scrollY || window.pageYOffset || window.document.documentElement.scrollTop || 0 : 0;
|
|
164
|
+
}
|
|
116
165
|
};
|
|
117
166
|
PageViewManager.prototype._contentHeight = function () {
|
|
118
|
-
|
|
167
|
+
var element = this._scrollElement();
|
|
168
|
+
return (element === null || element === void 0 ? void 0 : element.scrollHeight) || 0;
|
|
119
169
|
};
|
|
120
170
|
PageViewManager.prototype._contentY = function () {
|
|
121
|
-
var
|
|
171
|
+
var element = this._scrollElement();
|
|
172
|
+
var clientHeight = (element === null || element === void 0 ? void 0 : element.clientHeight) || 0;
|
|
122
173
|
return this._scrollY() + clientHeight;
|
|
123
174
|
};
|
|
124
175
|
return PageViewManager;
|
package/lib/src/page-view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-view.js","sourceRoot":"","sources":["../../src/page-view.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AA+BxC;IAAA;QAAA,iBAsIC;QApIG,qBAAgB,GAAG,KAAK,CAAA;QAkFxB,sBAAiB,GAAG;;YAChB,IAAI,CAAC,KAAI,CAAC,aAAa,EAAE;gBACrB,KAAI,CAAC,aAAa,GAAG,KAAI,CAAC,mBAAmB,EAAE,CAAA;aAClD;YACD,IAAM,YAAY,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YAAY,KAAI,CAAC,CAAA;IAC7D,CAAC;IAED,mCAAS,GAAT;QACI,IAAM,YAAY,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAC,eAAe,CAAC,YAAY,KAAI,CAAC,CAAA;QACvE,OAAO,IAAI,CAAC,QAAQ,EAAE,GAAG,YAAY,CAAA;IACzC,CAAC;IACL,sBAAC;AAAD,CAAC,AAtID,IAsIC;;AAED,SAAS,KAAK,CAAC,CAAS,EAAE,GAAW,EAAE,GAAW;IAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import { window } from './utils/globals'\n\ninterface PageViewData {\n pathname: string\n // scroll is how far down the page the user has scrolled,\n // content is how far down the page the user can view content\n // (e.g. if the page is 1000 tall, but the user's screen is only 500 tall,\n // and they don't scroll at all, then scroll is 0 and content is 500)\n maxScrollHeight?: number\n maxScrollY?: number\n lastScrollY?: number\n maxContentHeight?: number\n maxContentY?: number\n lastContentY?: number\n}\n\ninterface ScrollProperties {\n $prev_pageview_last_scroll?: number\n $prev_pageview_last_scroll_percentage?: number\n $prev_pageview_max_scroll?: number\n $prev_pageview_max_scroll_percentage?: number\n $prev_pageview_last_content?: number\n $prev_pageview_last_content_percentage?: number\n $prev_pageview_max_content?: number\n $prev_pageview_max_content_percentage?: number\n}\n\ninterface PageViewEventProperties extends ScrollProperties {\n $prev_pageview_pathname?: string\n}\n\nexport class PageViewManager {\n _pageViewData: PageViewData | undefined\n _hasSeenPageView = false\n\n _createPageViewData(): PageViewData {\n return {\n pathname: window?.location.pathname ?? '',\n }\n }\n\n doPageView(): PageViewEventProperties {\n let prevPageViewData: PageViewData | undefined\n // if there were events created before the first PageView, we would have created a\n // pageViewData for them. If this happened, we don't want to create a new pageViewData\n if (!this._hasSeenPageView) {\n this._hasSeenPageView = true\n prevPageViewData = undefined\n if (!this._pageViewData) {\n this._pageViewData = this._createPageViewData()\n }\n } else {\n prevPageViewData = this._pageViewData\n this._pageViewData = this._createPageViewData()\n }\n\n // update the scroll properties for the new page, but wait until the next tick\n // of the event loop\n setTimeout(this._updateScrollData, 0)\n\n return {\n $prev_pageview_pathname: prevPageViewData?.pathname,\n ...this._calculatePrevPageScrollProperties(prevPageViewData),\n }\n }\n\n doPageLeave(): PageViewEventProperties {\n const prevPageViewData = this._pageViewData\n return {\n $prev_pageview_pathname: prevPageViewData?.pathname,\n ...this._calculatePrevPageScrollProperties(prevPageViewData),\n }\n }\n\n _calculatePrevPageScrollProperties(prevPageViewData: PageViewData | undefined): ScrollProperties {\n if (\n !prevPageViewData ||\n prevPageViewData.maxScrollHeight == null ||\n prevPageViewData.lastScrollY == null ||\n prevPageViewData.maxScrollY == null ||\n prevPageViewData.maxContentHeight == null ||\n prevPageViewData.lastContentY == null ||\n prevPageViewData.maxContentY == null\n ) {\n return {}\n }\n\n let { maxScrollHeight, lastScrollY, maxScrollY, maxContentHeight, lastContentY, maxContentY } = prevPageViewData\n\n // Use ceil, so that e.g. scrolling 999.5px of a 1000px page is considered 100% scrolled\n maxScrollHeight = Math.ceil(maxScrollHeight)\n lastScrollY = Math.ceil(lastScrollY)\n maxScrollY = Math.ceil(maxScrollY)\n maxContentHeight = Math.ceil(maxContentHeight)\n lastContentY = Math.ceil(lastContentY)\n maxContentY = Math.ceil(maxContentY)\n\n // if the maximum scroll height is near 0, then the percentage is 1\n const lastScrollPercentage = maxScrollHeight <= 1 ? 1 : clamp(lastScrollY / maxScrollHeight, 0, 1)\n const maxScrollPercentage = maxScrollHeight <= 1 ? 1 : clamp(maxScrollY / maxScrollHeight, 0, 1)\n const lastContentPercentage = maxContentHeight <= 1 ? 1 : clamp(lastContentY / maxContentHeight, 0, 1)\n const maxContentPercentage = maxContentHeight <= 1 ? 1 : clamp(maxContentY / maxContentHeight, 0, 1)\n\n return {\n $prev_pageview_last_scroll: lastScrollY,\n $prev_pageview_last_scroll_percentage: lastScrollPercentage,\n $prev_pageview_max_scroll: maxScrollY,\n $prev_pageview_max_scroll_percentage: maxScrollPercentage,\n $prev_pageview_last_content: lastContentY,\n $prev_pageview_last_content_percentage: lastContentPercentage,\n $prev_pageview_max_content: maxContentY,\n $prev_pageview_max_content_percentage: maxContentPercentage,\n }\n }\n\n _updateScrollData = () => {\n if (!this._pageViewData) {\n this._pageViewData = this._createPageViewData()\n }\n const pageViewData = this._pageViewData\n\n const scrollY = this._scrollY()\n const scrollHeight = this._scrollHeight()\n const contentY = this._contentY()\n const contentHeight = this._contentHeight()\n\n pageViewData.lastScrollY = scrollY\n pageViewData.maxScrollY = Math.max(scrollY, pageViewData.maxScrollY ?? 0)\n pageViewData.maxScrollHeight = Math.max(scrollHeight, pageViewData.maxScrollHeight ?? 0)\n\n pageViewData.lastContentY = contentY\n pageViewData.maxContentY = Math.max(contentY, pageViewData.maxContentY ?? 0)\n pageViewData.maxContentHeight = Math.max(contentHeight, pageViewData.maxContentHeight ?? 0)\n }\n\n startMeasuringScrollPosition() {\n window?.addEventListener('scroll', this._updateScrollData)\n window?.addEventListener('scrollend', this._updateScrollData)\n window?.addEventListener('resize', this._updateScrollData)\n }\n\n stopMeasuringScrollPosition() {\n window?.removeEventListener('scroll', this._updateScrollData)\n window?.removeEventListener('scrollend', this._updateScrollData)\n window?.removeEventListener('resize', this._updateScrollData)\n }\n\n _scrollHeight(): number {\n return window\n ? Math.max(0, window.document.documentElement.scrollHeight - window.document.documentElement.clientHeight)\n : 0\n }\n\n _scrollY(): number {\n return window ? window.scrollY || window.pageYOffset || window.document.documentElement.scrollTop || 0 : 0\n }\n\n _contentHeight(): number {\n return window?.document.documentElement.scrollHeight || 0\n }\n\n _contentY(): number {\n const clientHeight = window?.document.documentElement.clientHeight || 0\n return this._scrollY() + clientHeight\n }\n}\n\nfunction clamp(x: number, min: number, max: number) {\n return Math.max(min, Math.min(x, max))\n}\n"]}
|
|
1
|
+
{"version":3,"file":"page-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,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;SAC7G;IACL,CAAC;IAED,wCAAc,GAAd;QACI,IAAM,OAAO,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;QACrC,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,KAAI,CAAC,CAAA;IACrC,CAAC;IAED,mCAAS,GAAT;QACI,IAAM,OAAO,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;QACrC,IAAM,YAAY,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,KAAI,CAAC,CAAA;QAC/C,OAAO,IAAI,CAAC,QAAQ,EAAE,GAAG,YAAY,CAAA;IACzC,CAAC;IACL,sBAAC;AAAD,CAAC,AArKD,IAqKC;;AAED,SAAS,KAAK,CAAC,CAAS,EAAE,GAAW,EAAE,GAAW;IAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import { window } from './utils/globals'\nimport { PostHog } from './posthog-core'\nimport { _isArray } from './utils/type-utils'\n\ninterface PageViewData {\n pathname: string\n // scroll is how far down the page the user has scrolled,\n // content is how far down the page the user can view content\n // (e.g. if the page is 1000 tall, but the user's screen is only 500 tall,\n // and they don't scroll at all, then scroll is 0 and content is 500)\n maxScrollHeight?: number\n maxScrollY?: number\n lastScrollY?: number\n maxContentHeight?: number\n maxContentY?: number\n lastContentY?: number\n}\n\ninterface ScrollProperties {\n $prev_pageview_last_scroll?: number\n $prev_pageview_last_scroll_percentage?: number\n $prev_pageview_max_scroll?: number\n $prev_pageview_max_scroll_percentage?: number\n $prev_pageview_last_content?: number\n $prev_pageview_last_content_percentage?: number\n $prev_pageview_max_content?: number\n $prev_pageview_max_content_percentage?: number\n}\n\ninterface PageViewEventProperties extends ScrollProperties {\n $prev_pageview_pathname?: string\n}\n\nexport class PageViewManager {\n _pageViewData: PageViewData | undefined\n _hasSeenPageView = false\n _instance: PostHog\n\n constructor(instance: PostHog) {\n this._instance = instance\n }\n\n _createPageViewData(): PageViewData {\n return {\n pathname: window?.location.pathname ?? '',\n }\n }\n\n doPageView(): PageViewEventProperties {\n let prevPageViewData: PageViewData | undefined\n // if there were events created before the first PageView, we would have created a\n // pageViewData for them. If this happened, we don't want to create a new pageViewData\n if (!this._hasSeenPageView) {\n this._hasSeenPageView = true\n prevPageViewData = undefined\n if (!this._pageViewData) {\n this._pageViewData = this._createPageViewData()\n }\n } else {\n prevPageViewData = this._pageViewData\n this._pageViewData = this._createPageViewData()\n }\n\n // update the scroll properties for the new page, but wait until the next tick\n // of the event loop\n setTimeout(this._updateScrollData, 0)\n\n return {\n $prev_pageview_pathname: prevPageViewData?.pathname,\n ...this._calculatePrevPageScrollProperties(prevPageViewData),\n }\n }\n\n doPageLeave(): PageViewEventProperties {\n const prevPageViewData = this._pageViewData\n return {\n $prev_pageview_pathname: prevPageViewData?.pathname,\n ...this._calculatePrevPageScrollProperties(prevPageViewData),\n }\n }\n\n _calculatePrevPageScrollProperties(prevPageViewData: PageViewData | undefined): ScrollProperties {\n if (\n !prevPageViewData ||\n prevPageViewData.maxScrollHeight == null ||\n prevPageViewData.lastScrollY == null ||\n prevPageViewData.maxScrollY == null ||\n prevPageViewData.maxContentHeight == null ||\n prevPageViewData.lastContentY == null ||\n prevPageViewData.maxContentY == null\n ) {\n return {}\n }\n\n let { maxScrollHeight, lastScrollY, maxScrollY, maxContentHeight, lastContentY, maxContentY } = prevPageViewData\n\n // Use ceil, so that e.g. scrolling 999.5px of a 1000px page is considered 100% scrolled\n maxScrollHeight = Math.ceil(maxScrollHeight)\n lastScrollY = Math.ceil(lastScrollY)\n maxScrollY = Math.ceil(maxScrollY)\n maxContentHeight = Math.ceil(maxContentHeight)\n lastContentY = Math.ceil(lastContentY)\n maxContentY = Math.ceil(maxContentY)\n\n // if the maximum scroll height is near 0, then the percentage is 1\n const lastScrollPercentage = maxScrollHeight <= 1 ? 1 : clamp(lastScrollY / maxScrollHeight, 0, 1)\n const maxScrollPercentage = maxScrollHeight <= 1 ? 1 : clamp(maxScrollY / maxScrollHeight, 0, 1)\n const lastContentPercentage = maxContentHeight <= 1 ? 1 : clamp(lastContentY / maxContentHeight, 0, 1)\n const maxContentPercentage = maxContentHeight <= 1 ? 1 : clamp(maxContentY / maxContentHeight, 0, 1)\n\n return {\n $prev_pageview_last_scroll: lastScrollY,\n $prev_pageview_last_scroll_percentage: lastScrollPercentage,\n $prev_pageview_max_scroll: maxScrollY,\n $prev_pageview_max_scroll_percentage: maxScrollPercentage,\n $prev_pageview_last_content: lastContentY,\n $prev_pageview_last_content_percentage: lastContentPercentage,\n $prev_pageview_max_content: maxContentY,\n $prev_pageview_max_content_percentage: maxContentPercentage,\n }\n }\n\n _updateScrollData = () => {\n if (!this._pageViewData) {\n this._pageViewData = this._createPageViewData()\n }\n const pageViewData = this._pageViewData\n\n const scrollY = this._scrollY()\n const scrollHeight = this._scrollHeight()\n const contentY = this._contentY()\n const contentHeight = this._contentHeight()\n\n pageViewData.lastScrollY = scrollY\n pageViewData.maxScrollY = Math.max(scrollY, pageViewData.maxScrollY ?? 0)\n pageViewData.maxScrollHeight = Math.max(scrollHeight, pageViewData.maxScrollHeight ?? 0)\n\n pageViewData.lastContentY = contentY\n pageViewData.maxContentY = Math.max(contentY, pageViewData.maxContentY ?? 0)\n pageViewData.maxContentHeight = Math.max(contentHeight, pageViewData.maxContentHeight ?? 0)\n }\n\n startMeasuringScrollPosition() {\n // setting the third argument to `true` means that we will receive scroll events for other scrollable elements\n // on the page, not just the window\n // see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#usecapture\n window?.addEventListener('scroll', this._updateScrollData, true)\n window?.addEventListener('scrollend', this._updateScrollData, true)\n window?.addEventListener('resize', this._updateScrollData)\n }\n\n stopMeasuringScrollPosition() {\n window?.removeEventListener('scroll', this._updateScrollData)\n window?.removeEventListener('scrollend', this._updateScrollData)\n window?.removeEventListener('resize', this._updateScrollData)\n }\n\n _scrollElement(): Element | null | undefined {\n if (this._instance.config.scroll_root_selector) {\n const selectors = _isArray(this._instance.config.scroll_root_selector)\n ? this._instance.config.scroll_root_selector\n : [this._instance.config.scroll_root_selector]\n for (const selector of selectors) {\n const element = window?.document.querySelector(selector)\n if (element) {\n return element\n }\n }\n return undefined\n } else {\n return window?.document.documentElement\n }\n }\n\n _scrollHeight(): number {\n const element = this._scrollElement()\n return element ? Math.max(0, element.scrollHeight - element.clientHeight) : 0\n }\n\n _scrollY(): number {\n if (this._instance.config.scroll_root_selector) {\n const element = this._scrollElement()\n return (element && element.scrollTop) || 0\n } else {\n return window ? window.scrollY || window.pageYOffset || window.document.documentElement.scrollTop || 0 : 0\n }\n }\n\n _contentHeight(): number {\n const element = this._scrollElement()\n return element?.scrollHeight || 0\n }\n\n _contentY(): number {\n const element = this._scrollElement()\n const clientHeight = element?.clientHeight || 0\n return this._scrollY() + clientHeight\n }\n}\n\nfunction clamp(x: number, min: number, max: number) {\n return Math.max(min, Math.min(x, max))\n}\n"]}
|
package/lib/src/posthog-core.js
CHANGED
|
@@ -212,7 +212,7 @@ var create_phlib = function (token, config, name, createComplete) {
|
|
|
212
212
|
instance.toolbar.maybeLoadToolbar();
|
|
213
213
|
instance.sessionRecording = new SessionRecording(instance);
|
|
214
214
|
instance.sessionRecording.startRecordingIfEnabled();
|
|
215
|
-
if (instance.config.
|
|
215
|
+
if (!instance.config.disable_scroll_properties) {
|
|
216
216
|
instance.pageViewManager.startMeasuringScrollPosition();
|
|
217
217
|
}
|
|
218
218
|
instance.__autocapture = instance.config.autocapture;
|
|
@@ -287,7 +287,7 @@ var PostHog = /** @class */ (function () {
|
|
|
287
287
|
this.elementsChainAsString = false;
|
|
288
288
|
this.featureFlags = new PostHogFeatureFlags(this);
|
|
289
289
|
this.toolbar = new Toolbar(this);
|
|
290
|
-
this.pageViewManager = new PageViewManager();
|
|
290
|
+
this.pageViewManager = new PageViewManager(this);
|
|
291
291
|
this.surveys = new PostHogSurveys(this);
|
|
292
292
|
this.rateLimiter = new RateLimiter();
|
|
293
293
|
// NOTE: See the property definition for deprecation notice
|
|
@@ -853,7 +853,7 @@ var PostHog = /** @class */ (function () {
|
|
|
853
853
|
var sessionProps = this.sessionPropsManager.getSessionProps();
|
|
854
854
|
properties = _extend(properties, sessionProps);
|
|
855
855
|
}
|
|
856
|
-
if (this.config.
|
|
856
|
+
if (!this.config.disable_scroll_properties) {
|
|
857
857
|
var performanceProperties = {};
|
|
858
858
|
if (event_name === '$pageview') {
|
|
859
859
|
performanceProperties = this.pageViewManager.doPageView();
|