@leanbase.com/js 0.2.0-alpha.0 → 0.2.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/dist/consent.d.ts +25 -0
- package/dist/leanbase.d.ts +5 -1
- package/dist/leanbase.iife.js +1 -1
- package/dist/leanbase.iife.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +84 -8
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +55 -7
- package/dist/utils/index.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/lib/consent.d.ts +25 -0
- package/lib/consent.js +101 -0
- package/lib/consent.js.map +1 -0
- package/lib/leanbase.d.ts +5 -1
- package/lib/leanbase.js +68 -3
- package/lib/leanbase.js.map +1 -1
- package/lib/types.d.ts +55 -7
- package/lib/types.js.map +1 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +9 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +4 -6
package/dist/types.d.ts
CHANGED
|
@@ -125,15 +125,15 @@ export interface LeanbaseConfig extends Partial<PostHogCoreOptions> {
|
|
|
125
125
|
* An object containing the `distinctID`, `isIdentifiedID`, and `featureFlags` keys,
|
|
126
126
|
* where `distinctID` is a string, and `featureFlags` is an object of key-value pairs.
|
|
127
127
|
*
|
|
128
|
-
* Since there is a delay between initializing
|
|
128
|
+
* Since there is a delay between initializing Leanbase and fetching feature flags,
|
|
129
129
|
* feature flags are not always available immediately.
|
|
130
130
|
* This makes them unusable if you want to do something like redirecting a user
|
|
131
131
|
* to a different page based on a feature flag.
|
|
132
132
|
*
|
|
133
133
|
* You can, therefore, fetch the feature flags in your server and pre-fill them here,
|
|
134
|
-
* allowing
|
|
134
|
+
* allowing Leanbase to know the feature flag values immediately.
|
|
135
135
|
*
|
|
136
|
-
* After the SDK fetches feature flags from
|
|
136
|
+
* After the SDK fetches feature flags from Leanbase, it will use those flag values instead of bootstrapped ones.
|
|
137
137
|
*
|
|
138
138
|
* @default {}
|
|
139
139
|
*/
|
|
@@ -238,19 +238,19 @@ export interface LeanbaseConfig extends Partial<PostHogCoreOptions> {
|
|
|
238
238
|
* Enables cookieless mode. In this mode, Leanbase will not set any cookies, or use session or local storage. User
|
|
239
239
|
* identity is handled by generating a privacy-preserving hash on Leanbase's servers.
|
|
240
240
|
* - 'always' - enable cookieless mode immediately on startup, use this if you do not intend to show a cookie banner
|
|
241
|
-
* - 'on_reject' - enable cookieless mode only if the user rejects cookies, use this if you want to show a cookie banner. If the user accepts cookies, cookieless mode will not be used, and
|
|
241
|
+
* - 'on_reject' - enable cookieless mode only if the user rejects cookies, use this if you want to show a cookie banner. If the user accepts cookies, cookieless mode will not be used, and Leanbase will use cookies and local storage as usual.
|
|
242
242
|
*
|
|
243
243
|
* Note that you MUST enable cookieless mode in your Leanbase project's settings, otherwise all your cookieless events will be ignored. We plan to remove this requirement in the future.
|
|
244
244
|
* */
|
|
245
245
|
cookieless_mode?: 'always' | 'on_reject';
|
|
246
246
|
/**
|
|
247
|
-
* Determines whether
|
|
247
|
+
* Determines whether Leanbase should save referrer information.
|
|
248
248
|
*
|
|
249
249
|
* @default true
|
|
250
250
|
*/
|
|
251
251
|
save_referrer: boolean;
|
|
252
252
|
/**
|
|
253
|
-
* Determines whether
|
|
253
|
+
* Determines whether Leanbase should save marketing parameters.
|
|
254
254
|
* These are `utm_*` paramaters and friends.
|
|
255
255
|
*
|
|
256
256
|
* @see {CAMPAIGN_PARAMS} from './utils/event-utils' - Default campaign parameters like utm_source, utm_medium, etc.
|
|
@@ -271,7 +271,7 @@ export interface LeanbaseConfig extends Partial<PostHogCoreOptions> {
|
|
|
271
271
|
scroll_root_selector?: string | string[];
|
|
272
272
|
/**
|
|
273
273
|
* Determines if users should be opted out of user agent filtering such as googlebot or other bots.
|
|
274
|
-
* If this is set to `true`,
|
|
274
|
+
* If this is set to `true`, Leanbase will set `$browser_type` to either `bot` or `browser` for all events,
|
|
275
275
|
* but will process all events as if they were from a browser.
|
|
276
276
|
*
|
|
277
277
|
* @default false
|
|
@@ -283,6 +283,54 @@ export interface LeanbaseConfig extends Partial<PostHogCoreOptions> {
|
|
|
283
283
|
* @default 65535
|
|
284
284
|
*/
|
|
285
285
|
properties_string_max_length: number;
|
|
286
|
+
/**
|
|
287
|
+
* Determines whether Leanbase should respect the Do Not Track header when computing
|
|
288
|
+
* consent in `ConsentManager`.
|
|
289
|
+
*
|
|
290
|
+
* @see `ConsentManager`
|
|
291
|
+
* @default false
|
|
292
|
+
*/
|
|
293
|
+
respect_dnt: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Determines if users should be opted out of Leanbase tracking by default,
|
|
296
|
+
* requiring additional logic to opt them into capturing by calling `leanbase.opt_in_capturing()`.
|
|
297
|
+
*
|
|
298
|
+
* @default false
|
|
299
|
+
*/
|
|
300
|
+
opt_out_capturing_by_default: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* Determines where we'll save the information about whether users are opted out of capturing.
|
|
303
|
+
*
|
|
304
|
+
* @default 'localStorage'
|
|
305
|
+
*/
|
|
306
|
+
opt_out_capturing_persistence_type: 'localStorage' | 'cookie';
|
|
307
|
+
/**
|
|
308
|
+
* Determines if users should be opted out of Leanbase data storage by this Leanbase instance by default,
|
|
309
|
+
* requiring additional logic to opt them into capturing by calling `leanbase.opt_in_capturing()`.
|
|
310
|
+
*
|
|
311
|
+
* @default false
|
|
312
|
+
*/
|
|
313
|
+
opt_out_persistence_by_default?: boolean;
|
|
314
|
+
/** @deprecated Use `consent_persistence_name` instead. This will be removed in a future major version. **/
|
|
315
|
+
opt_out_capturing_cookie_prefix: string | null;
|
|
316
|
+
/**
|
|
317
|
+
* Determines the key for the cookie / local storage used to store the information about whether users are opted in/out of capturing.
|
|
318
|
+
* When `null`, we used a key based on your token.
|
|
319
|
+
*
|
|
320
|
+
* @default null
|
|
321
|
+
* @see `ConsentManager._storageKey`
|
|
322
|
+
*/
|
|
323
|
+
consent_persistence_name: string | null;
|
|
324
|
+
/**
|
|
325
|
+
* Function to get the device ID.
|
|
326
|
+
* This doesn't usually need to be set, but can be useful if you want to use a custom device ID.
|
|
327
|
+
*
|
|
328
|
+
* @param uuid - The UUID we would use for the device ID.
|
|
329
|
+
* @returns The device ID.
|
|
330
|
+
*
|
|
331
|
+
* @default (uuid) => uuid
|
|
332
|
+
*/
|
|
333
|
+
getDeviceId: (uuid: string) => string;
|
|
286
334
|
/**
|
|
287
335
|
* A function to be called once the Leanbase scripts have loaded successfully.
|
|
288
336
|
*
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const AbortController: {
|
|
|
22
22
|
prototype: AbortController;
|
|
23
23
|
} | undefined;
|
|
24
24
|
export declare const userAgent: string | undefined;
|
|
25
|
+
export declare const assignableWindow: any;
|
|
25
26
|
export { win as window };
|
|
26
27
|
export declare function eachArray<E = any>(obj: E[] | null | undefined, iterator: (value: E, key: number) => void | Breaker, thisArg?: any): void;
|
|
27
28
|
/**
|
|
@@ -42,3 +43,4 @@ export declare function addEventListener(element: Window | Document | Element |
|
|
|
42
43
|
export declare const stripEmptyProperties: (p: Properties) => Properties;
|
|
43
44
|
export declare function isCrossDomainCookie(documentLocation: Location | undefined): boolean;
|
|
44
45
|
export declare function copyAndTruncateStrings<T extends Record<string, any> = Record<string, any>>(object: T, maxStringLength: number | null): T;
|
|
46
|
+
export declare function find<T>(value: T[], predicate: (value: T) => boolean): T | undefined;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.2.
|
|
1
|
+
export declare const version = "0.2.1";
|
package/lib/consent.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Leanbase } from './leanbase';
|
|
2
|
+
export declare enum ConsentStatus {
|
|
3
|
+
PENDING = -1,
|
|
4
|
+
DENIED = 0,
|
|
5
|
+
GRANTED = 1
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* ConsentManager provides tools for managing user consent as configured by the application.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ConsentManager {
|
|
11
|
+
private _instance;
|
|
12
|
+
private _persistentStore?;
|
|
13
|
+
constructor(_instance: Leanbase);
|
|
14
|
+
private get _config();
|
|
15
|
+
get consent(): ConsentStatus;
|
|
16
|
+
isOptedOut(): boolean;
|
|
17
|
+
isOptedIn(): boolean;
|
|
18
|
+
isExplicitlyOptedOut(): boolean;
|
|
19
|
+
optInOut(isOptedIn: boolean): void;
|
|
20
|
+
reset(): void;
|
|
21
|
+
private get _storageKey();
|
|
22
|
+
private get _storedConsent();
|
|
23
|
+
private get _storage();
|
|
24
|
+
private _getDnt;
|
|
25
|
+
}
|
package/lib/consent.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { find } from './utils';
|
|
2
|
+
import { assignableWindow, navigator } from './utils';
|
|
3
|
+
import { cookieStore, localStore } from './storage';
|
|
4
|
+
import { isNoLike, isYesLike } from '@posthog/core';
|
|
5
|
+
const OPT_OUT_PREFIX = '__lb_opt_in_out_';
|
|
6
|
+
export var ConsentStatus;
|
|
7
|
+
(function (ConsentStatus) {
|
|
8
|
+
ConsentStatus[ConsentStatus["PENDING"] = -1] = "PENDING";
|
|
9
|
+
ConsentStatus[ConsentStatus["DENIED"] = 0] = "DENIED";
|
|
10
|
+
ConsentStatus[ConsentStatus["GRANTED"] = 1] = "GRANTED";
|
|
11
|
+
})(ConsentStatus || (ConsentStatus = {}));
|
|
12
|
+
/**
|
|
13
|
+
* ConsentManager provides tools for managing user consent as configured by the application.
|
|
14
|
+
*/
|
|
15
|
+
export class ConsentManager {
|
|
16
|
+
constructor(_instance) {
|
|
17
|
+
this._instance = _instance;
|
|
18
|
+
}
|
|
19
|
+
get _config() {
|
|
20
|
+
return this._instance.config;
|
|
21
|
+
}
|
|
22
|
+
get consent() {
|
|
23
|
+
if (this._getDnt()) {
|
|
24
|
+
return ConsentStatus.DENIED;
|
|
25
|
+
}
|
|
26
|
+
return this._storedConsent;
|
|
27
|
+
}
|
|
28
|
+
isOptedOut() {
|
|
29
|
+
if (this._config.cookieless_mode === 'always') {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
// we are opted out if:
|
|
33
|
+
// * consent is explicitly denied
|
|
34
|
+
// * consent is pending, and we are configured to opt out by default
|
|
35
|
+
// * consent is pending, and we are in cookieless mode "on_reject"
|
|
36
|
+
return (this.consent === ConsentStatus.DENIED ||
|
|
37
|
+
(this.consent === ConsentStatus.PENDING &&
|
|
38
|
+
(this._config.opt_out_capturing_by_default || this._config.cookieless_mode === 'on_reject')));
|
|
39
|
+
}
|
|
40
|
+
isOptedIn() {
|
|
41
|
+
return !this.isOptedOut();
|
|
42
|
+
}
|
|
43
|
+
isExplicitlyOptedOut() {
|
|
44
|
+
return this.consent === ConsentStatus.DENIED;
|
|
45
|
+
}
|
|
46
|
+
optInOut(isOptedIn) {
|
|
47
|
+
this._storage._set(this._storageKey, isOptedIn ? 1 : 0, this._config.cookie_expiration, this._config.cross_subdomain_cookie, this._config.secure_cookie);
|
|
48
|
+
}
|
|
49
|
+
reset() {
|
|
50
|
+
this._storage._remove(this._storageKey, this._config.cross_subdomain_cookie);
|
|
51
|
+
}
|
|
52
|
+
get _storageKey() {
|
|
53
|
+
const { token, opt_out_capturing_cookie_prefix, consent_persistence_name } = this._instance.config;
|
|
54
|
+
if (consent_persistence_name) {
|
|
55
|
+
return consent_persistence_name;
|
|
56
|
+
}
|
|
57
|
+
else if (opt_out_capturing_cookie_prefix) {
|
|
58
|
+
// Deprecated, but we still support it for backwards compatibility.
|
|
59
|
+
// This was deprecated because it differed in behaviour from storage.ts, and appends the token.
|
|
60
|
+
// This meant it was not possible to share the same consent state across multiple PostHog instances,
|
|
61
|
+
// and made it harder for people to migrate from other systems.
|
|
62
|
+
return opt_out_capturing_cookie_prefix + token;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return OPT_OUT_PREFIX + token;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
get _storedConsent() {
|
|
69
|
+
const value = this._storage._get(this._storageKey);
|
|
70
|
+
// be somewhat permissive in what we accept as yes/opt-in, to make it easier for people to migrate from other systems
|
|
71
|
+
return isYesLike(value) ? ConsentStatus.GRANTED : isNoLike(value) ? ConsentStatus.DENIED : ConsentStatus.PENDING;
|
|
72
|
+
}
|
|
73
|
+
get _storage() {
|
|
74
|
+
if (!this._persistentStore) {
|
|
75
|
+
const persistenceType = this._config.opt_out_capturing_persistence_type;
|
|
76
|
+
this._persistentStore = persistenceType === 'localStorage' ? localStore : cookieStore;
|
|
77
|
+
const otherStorage = persistenceType === 'localStorage' ? cookieStore : localStore;
|
|
78
|
+
if (otherStorage._get(this._storageKey)) {
|
|
79
|
+
if (!this._persistentStore._get(this._storageKey)) {
|
|
80
|
+
// This indicates we have moved to a new storage format so we migrate the value over
|
|
81
|
+
this.optInOut(isYesLike(otherStorage._get(this._storageKey)));
|
|
82
|
+
}
|
|
83
|
+
otherStorage._remove(this._storageKey, this._config.cross_subdomain_cookie);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return this._persistentStore;
|
|
87
|
+
}
|
|
88
|
+
_getDnt() {
|
|
89
|
+
if (!this._config.respect_dnt) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
return !!find([
|
|
93
|
+
navigator?.doNotTrack, // standard
|
|
94
|
+
navigator?.['msDoNotTrack'],
|
|
95
|
+
assignableWindow['doNotTrack'],
|
|
96
|
+
], (dntValue) => {
|
|
97
|
+
return isYesLike(dntValue);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=consent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent.js","sourceRoot":"","sources":["../src/consent.ts"],"names":[],"mappings":"AAAA,OAAO,E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7,12 @@ import { SessionIdManager } from './sessionid';
|
|
|
7
7
|
import { SessionPropsManager } from './session-props';
|
|
8
8
|
import { PageViewManager } from './page-view';
|
|
9
9
|
import { ScrollManager } from './scroll-manager';
|
|
10
|
+
import { ConsentManager } from './consent';
|
|
10
11
|
export declare class Leanbase extends PostHogCore {
|
|
11
12
|
config: LeanbaseConfig;
|
|
12
13
|
scrollManager: ScrollManager;
|
|
13
14
|
pageViewManager: PageViewManager;
|
|
15
|
+
consent: ConsentManager;
|
|
14
16
|
replayAutocapture?: Autocapture;
|
|
15
17
|
persistence?: LeanbasePersistence;
|
|
16
18
|
sessionPersistence?: LeanbasePersistence;
|
|
@@ -22,7 +24,7 @@ export declare class Leanbase extends PostHogCore {
|
|
|
22
24
|
initialPageviewCaptured: boolean;
|
|
23
25
|
visibilityStateListener: (() => void) | null;
|
|
24
26
|
constructor(token: string, config?: Partial<LeanbaseConfig>);
|
|
25
|
-
init(token: string, config: Partial<LeanbaseConfig>):
|
|
27
|
+
init(token: string, config: Partial<LeanbaseConfig>): this;
|
|
26
28
|
captureInitialPageview(): void;
|
|
27
29
|
capturePageLeave(): void;
|
|
28
30
|
loadRemoteConfig(): Promise<void>;
|
|
@@ -36,6 +38,7 @@ export declare class Leanbase extends PostHogCore {
|
|
|
36
38
|
setPersistedProperty<T>(key: PostHogPersistedProperty, value: T | null): void;
|
|
37
39
|
calculateEventProperties(eventName: string, eventProperties: PostHogEventProperties, timestamp: Date, uuid: string, readOnly?: boolean): Properties;
|
|
38
40
|
isIdentified(): boolean;
|
|
41
|
+
isCapturing(): boolean;
|
|
39
42
|
/**
|
|
40
43
|
* Add additional set_once properties to the event when creating a person profile. This allows us to create the
|
|
41
44
|
* profile with mostly-accurate properties, despite earlier events not setting them. We do this by storing them in
|
|
@@ -46,4 +49,5 @@ export declare class Leanbase extends PostHogCore {
|
|
|
46
49
|
capture(event: string, properties?: PostHogEventProperties, options?: LeanbaseCaptureOptions): void;
|
|
47
50
|
identify(distinctId?: string, properties?: PostHogEventProperties, options?: LeanbaseCaptureOptions): void;
|
|
48
51
|
destroy(): void;
|
|
52
|
+
private _isPersistenceDisabled;
|
|
49
53
|
}
|
package/lib/leanbase.js
CHANGED
|
@@ -4,12 +4,15 @@ import { addEventListener, copyAndTruncateStrings, document, extend, isCrossDoma
|
|
|
4
4
|
import Config from './config';
|
|
5
5
|
import { Autocapture } from './autocapture';
|
|
6
6
|
import { logger } from './leanbase-logger';
|
|
7
|
-
import { COOKIELESS_MODE_FLAG_PROPERTY, USER_STATE } from './constants';
|
|
7
|
+
import { COOKIELESS_MODE_FLAG_PROPERTY, COOKIELESS_SENTINEL_VALUE, USER_STATE } from './constants';
|
|
8
8
|
import { getEventProperties } from './utils/event-utils';
|
|
9
|
+
import { SessionIdManager } from './sessionid';
|
|
10
|
+
import { SessionPropsManager } from './session-props';
|
|
9
11
|
import { uuidv7 } from './uuidv7';
|
|
10
12
|
import { PageViewManager } from './page-view';
|
|
11
13
|
import { ScrollManager } from './scroll-manager';
|
|
12
14
|
import { isLikelyBot } from './utils/blocked-uas';
|
|
15
|
+
import { ConsentManager } from './consent';
|
|
13
16
|
const defaultConfig = () => ({
|
|
14
17
|
host: 'https://i.leanbase.co',
|
|
15
18
|
token: '',
|
|
@@ -34,6 +37,13 @@ const defaultConfig = () => ({
|
|
|
34
37
|
save_referrer: true,
|
|
35
38
|
opt_out_useragent_filter: false,
|
|
36
39
|
properties_string_max_length: 65535,
|
|
40
|
+
opt_out_capturing_by_default: false,
|
|
41
|
+
opt_out_persistence_by_default: false,
|
|
42
|
+
opt_out_capturing_persistence_type: 'localStorage',
|
|
43
|
+
consent_persistence_name: null,
|
|
44
|
+
opt_out_capturing_cookie_prefix: null,
|
|
45
|
+
respect_dnt: false,
|
|
46
|
+
getDeviceId: (uuid) => uuid,
|
|
37
47
|
loaded: () => { },
|
|
38
48
|
});
|
|
39
49
|
export class Leanbase extends PostHogCore {
|
|
@@ -49,6 +59,7 @@ export class Leanbase extends PostHogCore {
|
|
|
49
59
|
this.initialPageviewCaptured = false;
|
|
50
60
|
this.scrollManager = new ScrollManager(this);
|
|
51
61
|
this.pageViewManager = new PageViewManager(this);
|
|
62
|
+
this.consent = new ConsentManager(this);
|
|
52
63
|
this.init(token, mergedConfig);
|
|
53
64
|
}
|
|
54
65
|
init(token, config) {
|
|
@@ -56,7 +67,18 @@ export class Leanbase extends PostHogCore {
|
|
|
56
67
|
token,
|
|
57
68
|
}));
|
|
58
69
|
this.isLoaded = true;
|
|
70
|
+
const persistenceDisabled = this._isPersistenceDisabled();
|
|
59
71
|
this.persistence = new LeanbasePersistence(this.config);
|
|
72
|
+
this.sessionPersistence =
|
|
73
|
+
this.config.persistence === 'sessionStorage' || this.config.persistence === 'memory'
|
|
74
|
+
? this.persistence
|
|
75
|
+
: new LeanbasePersistence({ ...this.config, persistence: 'sessionStorage' }, persistenceDisabled);
|
|
76
|
+
const startInCookielessMode = this.config.cookieless_mode === 'always' ||
|
|
77
|
+
(this.config.cookieless_mode === 'on_reject' && this.consent.isExplicitlyOptedOut());
|
|
78
|
+
if (!startInCookielessMode) {
|
|
79
|
+
this.sessionManager = new SessionIdManager(this);
|
|
80
|
+
this.sessionPropsManager = new SessionPropsManager(this, this.sessionManager, this.persistence);
|
|
81
|
+
}
|
|
60
82
|
this.replayAutocapture = new Autocapture(this);
|
|
61
83
|
this.replayAutocapture.startIfEnabled();
|
|
62
84
|
if (this.config.preloadFeatureFlags !== false) {
|
|
@@ -65,17 +87,45 @@ export class Leanbase extends PostHogCore {
|
|
|
65
87
|
this.config.loaded?.(this);
|
|
66
88
|
if (this.config.capture_pageview) {
|
|
67
89
|
setTimeout(() => {
|
|
68
|
-
if (this.config.cookieless_mode === 'always') {
|
|
90
|
+
if (this.consent.isOptedIn() || this.config.cookieless_mode === 'always') {
|
|
69
91
|
this.captureInitialPageview();
|
|
70
92
|
}
|
|
71
93
|
}, 1);
|
|
72
94
|
}
|
|
95
|
+
if (!this.config.disable_scroll_properties) {
|
|
96
|
+
this.scrollManager.startMeasuringScrollPosition();
|
|
97
|
+
}
|
|
98
|
+
// eslint-disable-next-line posthog-js/no-direct-undefined-check
|
|
99
|
+
if (this.config.bootstrap?.distinctId !== undefined) {
|
|
100
|
+
const uuid = this.config.getDeviceId(uuidv7());
|
|
101
|
+
const deviceID = this.config.bootstrap?.isIdentifiedId ? uuid : this.config.bootstrap.distinctId;
|
|
102
|
+
this.persistence.set_property(USER_STATE, this.config.bootstrap?.isIdentifiedId ? 'identified' : 'anonymous');
|
|
103
|
+
this.register({
|
|
104
|
+
distinct_id: this.config.bootstrap.distinctId,
|
|
105
|
+
$device_id: deviceID,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (startInCookielessMode) {
|
|
109
|
+
this.persistence.register_once({
|
|
110
|
+
distinct_id: COOKIELESS_SENTINEL_VALUE,
|
|
111
|
+
$device_id: null,
|
|
112
|
+
}, '');
|
|
113
|
+
}
|
|
114
|
+
if (!startInCookielessMode && !this.getDistinctId()) {
|
|
115
|
+
const uuid = uuidv7();
|
|
116
|
+
this.persistence.register_once({
|
|
117
|
+
distinct_id: uuid,
|
|
118
|
+
$device_id: uuid,
|
|
119
|
+
}, '');
|
|
120
|
+
this.persistence.set_property(USER_STATE, 'anonymous');
|
|
121
|
+
}
|
|
73
122
|
addEventListener(document, 'DOMContentLoaded', () => {
|
|
74
123
|
this.loadRemoteConfig();
|
|
75
124
|
});
|
|
76
125
|
addEventListener(window, 'onpagehide' in self ? 'pagehide' : 'unload', this.capturePageLeave.bind(this), {
|
|
77
126
|
passive: false,
|
|
78
127
|
});
|
|
128
|
+
return this;
|
|
79
129
|
}
|
|
80
130
|
captureInitialPageview() {
|
|
81
131
|
if (!document) {
|
|
@@ -165,7 +215,8 @@ export class Leanbase extends PostHogCore {
|
|
|
165
215
|
const startTimestamp = readOnly ? undefined : this.persistence?.remove_event_timer(eventName);
|
|
166
216
|
let properties = { ...eventProperties };
|
|
167
217
|
properties['token'] = this.config.token;
|
|
168
|
-
if (this.config.cookieless_mode == 'always' ||
|
|
218
|
+
if (this.config.cookieless_mode == 'always' ||
|
|
219
|
+
(this.config.cookieless_mode == 'on_reject' && this.consent.isExplicitlyOptedOut())) {
|
|
169
220
|
properties[COOKIELESS_MODE_FLAG_PROPERTY] = true;
|
|
170
221
|
}
|
|
171
222
|
if (eventName === '$snapshot') {
|
|
@@ -212,6 +263,9 @@ export class Leanbase extends PostHogCore {
|
|
|
212
263
|
return (this.persistence?.get_property(USER_STATE) === 'identified' ||
|
|
213
264
|
this.sessionPersistence?.get_property(USER_STATE) === 'identified');
|
|
214
265
|
}
|
|
266
|
+
isCapturing() {
|
|
267
|
+
return this.consent.isOptedIn();
|
|
268
|
+
}
|
|
215
269
|
/**
|
|
216
270
|
* Add additional set_once properties to the event when creating a person profile. This allows us to create the
|
|
217
271
|
* profile with mostly-accurate properties, despite earlier events not setting them. We do this by storing them in
|
|
@@ -238,6 +292,9 @@ export class Leanbase extends PostHogCore {
|
|
|
238
292
|
if (!this.isLoaded || !this.sessionPersistence || !this.persistence) {
|
|
239
293
|
return;
|
|
240
294
|
}
|
|
295
|
+
if (!this.isCapturing()) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
241
298
|
if (isUndefined(event) || !isString(event)) {
|
|
242
299
|
logger.error('No event name provided to posthog.capture');
|
|
243
300
|
return;
|
|
@@ -290,5 +347,13 @@ export class Leanbase extends PostHogCore {
|
|
|
290
347
|
destroy() {
|
|
291
348
|
this.persistence?.clear();
|
|
292
349
|
}
|
|
350
|
+
_isPersistenceDisabled() {
|
|
351
|
+
if (this.config.cookieless_mode === 'always') {
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
const isOptedOut = this.consent.isOptedOut();
|
|
355
|
+
const defaultPersistenceDisabled = this.config.opt_out_persistence_by_default || this.config.cookieless_mode === 'on_reject';
|
|
356
|
+
return this.config.disable_persistence || (isOptedOut && !!defaultPersistenceDisabled);
|
|
357
|
+
}
|
|
293
358
|
}
|
|
294
359
|
//# sourceMappingURL=leanbase.js.map
|
package/lib/leanbase.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leanbase.js","sourceRoot":"","sources":["../src/leanbase.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,WAAW,GACd,MAAM,eAAe,CAAA;AActB,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EACH,gBAAgB,EAChB,sBAAsB,EACtB,QAAQ,EACR,MAAM,EACN,mBAAmB,EACnB,SAAS,EACT,SAAS,GACZ,MAAM,SAAS,CAAA;AAChB,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,6BAA6B,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEjD,MAAM,aAAa,GAAG,GAAmB,EAAE,CAAC,CAAC;IACzC,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE,EAAE;IACT,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,qBAAqB;IAClC,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,qBAAqB;IACxC,gBAAgB,EAAE,EAAE;IACpB,2BAA2B,EAAE,KAAK;IAClC,iBAAiB,EAAE,GAAG;IACtB,sBAAsB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U,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;IAED,OAAO;QACH,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,CAAA;IAC7B,CAAC;IAEO,sBAAsB;QAC1B,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,KAAK,QAAQ,EAAE,CAAC;YAC3C,OAAO,IAAI,CAAA;QACf,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAA;QAC5C,MAAM,0BAA0B,GAC5B,IAAI,CAAC,MAAM,CAAC,8BAA8B,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,KAAK,WAAW,CAAA;QAE7F,OAAO,IAAI,CAAC,MAAM,CAAC,mBAAmB,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC,0BAA0B,CAAC,CAAA;IAC1F,CAAC;CACJ"}
|
package/lib/types.d.ts
CHANGED
|
@@ -125,15 +125,15 @@ export interface LeanbaseConfig extends Partial<PostHogCoreOptions> {
|
|
|
125
125
|
* An object containing the `distinctID`, `isIdentifiedID`, and `featureFlags` keys,
|
|
126
126
|
* where `distinctID` is a string, and `featureFlags` is an object of key-value pairs.
|
|
127
127
|
*
|
|
128
|
-
* Since there is a delay between initializing
|
|
128
|
+
* Since there is a delay between initializing Leanbase and fetching feature flags,
|
|
129
129
|
* feature flags are not always available immediately.
|
|
130
130
|
* This makes them unusable if you want to do something like redirecting a user
|
|
131
131
|
* to a different page based on a feature flag.
|
|
132
132
|
*
|
|
133
133
|
* You can, therefore, fetch the feature flags in your server and pre-fill them here,
|
|
134
|
-
* allowing
|
|
134
|
+
* allowing Leanbase to know the feature flag values immediately.
|
|
135
135
|
*
|
|
136
|
-
* After the SDK fetches feature flags from
|
|
136
|
+
* After the SDK fetches feature flags from Leanbase, it will use those flag values instead of bootstrapped ones.
|
|
137
137
|
*
|
|
138
138
|
* @default {}
|
|
139
139
|
*/
|
|
@@ -238,19 +238,19 @@ export interface LeanbaseConfig extends Partial<PostHogCoreOptions> {
|
|
|
238
238
|
* Enables cookieless mode. In this mode, Leanbase will not set any cookies, or use session or local storage. User
|
|
239
239
|
* identity is handled by generating a privacy-preserving hash on Leanbase's servers.
|
|
240
240
|
* - 'always' - enable cookieless mode immediately on startup, use this if you do not intend to show a cookie banner
|
|
241
|
-
* - 'on_reject' - enable cookieless mode only if the user rejects cookies, use this if you want to show a cookie banner. If the user accepts cookies, cookieless mode will not be used, and
|
|
241
|
+
* - 'on_reject' - enable cookieless mode only if the user rejects cookies, use this if you want to show a cookie banner. If the user accepts cookies, cookieless mode will not be used, and Leanbase will use cookies and local storage as usual.
|
|
242
242
|
*
|
|
243
243
|
* Note that you MUST enable cookieless mode in your Leanbase project's settings, otherwise all your cookieless events will be ignored. We plan to remove this requirement in the future.
|
|
244
244
|
* */
|
|
245
245
|
cookieless_mode?: 'always' | 'on_reject';
|
|
246
246
|
/**
|
|
247
|
-
* Determines whether
|
|
247
|
+
* Determines whether Leanbase should save referrer information.
|
|
248
248
|
*
|
|
249
249
|
* @default true
|
|
250
250
|
*/
|
|
251
251
|
save_referrer: boolean;
|
|
252
252
|
/**
|
|
253
|
-
* Determines whether
|
|
253
|
+
* Determines whether Leanbase should save marketing parameters.
|
|
254
254
|
* These are `utm_*` paramaters and friends.
|
|
255
255
|
*
|
|
256
256
|
* @see {CAMPAIGN_PARAMS} from './utils/event-utils' - Default campaign parameters like utm_source, utm_medium, etc.
|
|
@@ -271,7 +271,7 @@ export interface LeanbaseConfig extends Partial<PostHogCoreOptions> {
|
|
|
271
271
|
scroll_root_selector?: string | string[];
|
|
272
272
|
/**
|
|
273
273
|
* Determines if users should be opted out of user agent filtering such as googlebot or other bots.
|
|
274
|
-
* If this is set to `true`,
|
|
274
|
+
* If this is set to `true`, Leanbase will set `$browser_type` to either `bot` or `browser` for all events,
|
|
275
275
|
* but will process all events as if they were from a browser.
|
|
276
276
|
*
|
|
277
277
|
* @default false
|
|
@@ -283,6 +283,54 @@ export interface LeanbaseConfig extends Partial<PostHogCoreOptions> {
|
|
|
283
283
|
* @default 65535
|
|
284
284
|
*/
|
|
285
285
|
properties_string_max_length: number;
|
|
286
|
+
/**
|
|
287
|
+
* Determines whether Leanbase should respect the Do Not Track header when computing
|
|
288
|
+
* consent in `ConsentManager`.
|
|
289
|
+
*
|
|
290
|
+
* @see `ConsentManager`
|
|
291
|
+
* @default false
|
|
292
|
+
*/
|
|
293
|
+
respect_dnt: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Determines if users should be opted out of Leanbase tracking by default,
|
|
296
|
+
* requiring additional logic to opt them into capturing by calling `leanbase.opt_in_capturing()`.
|
|
297
|
+
*
|
|
298
|
+
* @default false
|
|
299
|
+
*/
|
|
300
|
+
opt_out_capturing_by_default: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* Determines where we'll save the information about whether users are opted out of capturing.
|
|
303
|
+
*
|
|
304
|
+
* @default 'localStorage'
|
|
305
|
+
*/
|
|
306
|
+
opt_out_capturing_persistence_type: 'localStorage' | 'cookie';
|
|
307
|
+
/**
|
|
308
|
+
* Determines if users should be opted out of Leanbase data storage by this Leanbase instance by default,
|
|
309
|
+
* requiring additional logic to opt them into capturing by calling `leanbase.opt_in_capturing()`.
|
|
310
|
+
*
|
|
311
|
+
* @default false
|
|
312
|
+
*/
|
|
313
|
+
opt_out_persistence_by_default?: boolean;
|
|
314
|
+
/** @deprecated Use `consent_persistence_name` instead. This will be removed in a future major version. **/
|
|
315
|
+
opt_out_capturing_cookie_prefix: string | null;
|
|
316
|
+
/**
|
|
317
|
+
* Determines the key for the cookie / local storage used to store the information about whether users are opted in/out of capturing.
|
|
318
|
+
* When `null`, we used a key based on your token.
|
|
319
|
+
*
|
|
320
|
+
* @default null
|
|
321
|
+
* @see `ConsentManager._storageKey`
|
|
322
|
+
*/
|
|
323
|
+
consent_persistence_name: string | null;
|
|
324
|
+
/**
|
|
325
|
+
* Function to get the device ID.
|
|
326
|
+
* This doesn't usually need to be set, but can be useful if you want to use a custom device ID.
|
|
327
|
+
*
|
|
328
|
+
* @param uuid - The UUID we would use for the device ID.
|
|
329
|
+
* @returns The device ID.
|
|
330
|
+
*
|
|
331
|
+
* @default (uuid) => uuid
|
|
332
|
+
*/
|
|
333
|
+
getDeviceId: (uuid: string) => string;
|
|
286
334
|
/**
|
|
287
335
|
* A function to be called once the Leanbase scripts have loaded successfully.
|
|
288
336
|
*
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAA;AA+ZzD,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,iCAAkB,CAAA;IAClB,gCAAiB,CAAA;AACrB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB"}
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const AbortController: {
|
|
|
22
22
|
prototype: AbortController;
|
|
23
23
|
} | undefined;
|
|
24
24
|
export declare const userAgent: string | undefined;
|
|
25
|
+
export declare const assignableWindow: any;
|
|
25
26
|
export { win as window };
|
|
26
27
|
export declare function eachArray<E = any>(obj: E[] | null | undefined, iterator: (value: E, key: number) => void | Breaker, thisArg?: any): void;
|
|
27
28
|
/**
|
|
@@ -42,3 +43,4 @@ export declare function addEventListener(element: Window | Document | Element |
|
|
|
42
43
|
export declare const stripEmptyProperties: (p: Properties) => Properties;
|
|
43
44
|
export declare function isCrossDomainCookie(documentLocation: Location | undefined): boolean;
|
|
44
45
|
export declare function copyAndTruncateStrings<T extends Record<string, any> = Record<string, any>>(object: T, maxStringLength: number | null): T;
|
|
46
|
+
export declare function find<T>(value: T[], predicate: (value: T) => boolean): T | undefined;
|
package/lib/utils/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export const fetch = global?.fetch;
|
|
|
12
12
|
export const XMLHttpRequest = global?.XMLHttpRequest && 'withCredentials' in new global.XMLHttpRequest() ? global.XMLHttpRequest : undefined;
|
|
13
13
|
export const AbortController = global?.AbortController;
|
|
14
14
|
export const userAgent = navigator?.userAgent;
|
|
15
|
+
export const assignableWindow = win ?? {};
|
|
15
16
|
export { win as window };
|
|
16
17
|
export function eachArray(obj, iterator, thisArg) {
|
|
17
18
|
if (isArray(obj)) {
|
|
@@ -180,4 +181,12 @@ export function copyAndTruncateStrings(object, maxStringLength) {
|
|
|
180
181
|
return value;
|
|
181
182
|
});
|
|
182
183
|
}
|
|
184
|
+
export function find(value, predicate) {
|
|
185
|
+
for (let i = 0; i < value.length; i++) {
|
|
186
|
+
if (predicate(value[i])) {
|
|
187
|
+
return value[i];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
183
192
|
//# sourceMappingURL=index.js.map
|