@datalyr/web 1.6.5 → 1.7.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/README.md +18 -3
- package/dist/config.d.ts +40 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.test.d.ts +2 -0
- package/dist/config.test.d.ts.map +1 -0
- package/dist/container.d.ts +10 -0
- package/dist/container.d.ts.map +1 -1
- package/dist/datalyr.cjs.js +76 -6
- package/dist/datalyr.cjs.js.map +1 -1
- package/dist/datalyr.esm.js +76 -6
- package/dist/datalyr.esm.js.map +1 -1
- package/dist/datalyr.esm.min.js +1 -1
- package/dist/datalyr.esm.min.js.map +1 -1
- package/dist/datalyr.js +76 -6
- package/dist/datalyr.js.map +1 -1
- package/dist/datalyr.min.js +1 -1
- package/dist/datalyr.min.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @datalyr/web
|
|
2
2
|
|
|
3
|
-
Browser SDK for event tracking, user identity, and attribution. Version 1.
|
|
3
|
+
Browser SDK for event tracking, user identity, and attribution. Version 1.7.0.
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
@@ -116,7 +116,7 @@ Every event includes:
|
|
|
116
116
|
workspace_id: 'wk_xxxxx',
|
|
117
117
|
source: 'web',
|
|
118
118
|
timestamp: '2024-01-15T10:30:00Z',
|
|
119
|
-
sdk_version: '1.
|
|
119
|
+
sdk_version: '1.7.0',
|
|
120
120
|
sdk_name: 'datalyr-web-sdk'
|
|
121
121
|
}
|
|
122
122
|
```
|
|
@@ -187,7 +187,7 @@ datalyr.init({
|
|
|
187
187
|
// Auto-Identify (opt-in)
|
|
188
188
|
autoIdentify?: boolean, // Default: false - Automatically identify users
|
|
189
189
|
autoIdentifyForms?: boolean, // Default: true - Capture email from forms (when autoIdentify enabled)
|
|
190
|
-
autoIdentifyAPI?: boolean, // Default:
|
|
190
|
+
autoIdentifyAPI?: boolean, // Default: false - Capture email from API responses (off: same-origin scan can mis-identify; opt in explicitly)
|
|
191
191
|
autoIdentifyShopify?: boolean, // Default: true - Capture email from Shopify endpoints (when autoIdentify enabled)
|
|
192
192
|
autoIdentifyTrustedDomains?: string[], // Default: [] - Additional domains to trust for API capture
|
|
193
193
|
|
|
@@ -198,6 +198,21 @@ datalyr.init({
|
|
|
198
198
|
|
|
199
199
|
---
|
|
200
200
|
|
|
201
|
+
## Remote config (Identity Bridge)
|
|
202
|
+
|
|
203
|
+
These options can be controlled from the dashboard (**Settings → Identity & Attribution**) with **no code change** — they're delivered to the SDK at runtime in the `/container-scripts` response and merged in:
|
|
204
|
+
|
|
205
|
+
- `autoIdentify`, `autoIdentifyForms`, `autoIdentifyAPI`, `autoIdentifyShopify`
|
|
206
|
+
- `shopifyCartAttributes`
|
|
207
|
+
- `checkoutChampDomains`
|
|
208
|
+
- `respectGlobalPrivacyControl`, `respectDoNotTrack`, `privacyMode`
|
|
209
|
+
|
|
210
|
+
**Precedence, per key:** built-in default ← dashboard ← explicit `init()`. An explicit value in `init()` always wins, so you can pin a value in code and still manage everything else from the dashboard. Changes propagate in ~5 minutes (edge-cached). An older worker that doesn't send the `config` envelope is a no-op — built-in defaults stand.
|
|
211
|
+
|
|
212
|
+
> `platform` is **not** remote-configurable — set it at install time via the `data-platform` attribute. The CheckoutChamp behaviors run before the remote config loads, so a dashboard-set platform wouldn't drive them.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
201
216
|
## API Reference
|
|
202
217
|
|
|
203
218
|
### Event Tracking
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remote SDK config (Auto Identity Bridge).
|
|
3
|
+
*
|
|
4
|
+
* The `/container-scripts` response carries a `config` object — the workspace
|
|
5
|
+
* `sdk_config` with server-computed defaults already applied (e.g. auto-identify
|
|
6
|
+
* OFF for sensitive/health verticals). This module folds that remote config
|
|
7
|
+
* UNDER the caller's explicit init() options, so the dashboard controls behavior
|
|
8
|
+
* with zero snippet edits while explicit code always wins.
|
|
9
|
+
*
|
|
10
|
+
* Precedence per key: explicit init() value > remote config > built-in default
|
|
11
|
+
*/
|
|
12
|
+
import type { DatalyrConfig } from './types';
|
|
13
|
+
/** Subset of DatalyrConfig the worker may deliver via the config envelope. */
|
|
14
|
+
export interface SdkRemoteConfig {
|
|
15
|
+
autoIdentify?: boolean;
|
|
16
|
+
autoIdentifyForms?: boolean;
|
|
17
|
+
autoIdentifyAPI?: boolean;
|
|
18
|
+
autoIdentifyShopify?: boolean;
|
|
19
|
+
shopifyCartAttributes?: boolean;
|
|
20
|
+
checkoutChampDomains?: string[];
|
|
21
|
+
respectGlobalPrivacyControl?: boolean;
|
|
22
|
+
respectDoNotTrack?: boolean;
|
|
23
|
+
privacyMode?: 'standard' | 'strict';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Fold `remote` into `config` IN PLACE. Precedence per key:
|
|
27
|
+
* explicit init() value > remote (dashboard) > built-in default
|
|
28
|
+
*
|
|
29
|
+
* `explicitKeys` = the keys the CALLER passed to init() (before built-in
|
|
30
|
+
* defaults were merged in). For any remote key NOT in that set, remote
|
|
31
|
+
* OVERRIDES the built-in default. This is essential because some keys
|
|
32
|
+
* (respectDoNotTrack, respectGlobalPrivacyControl, privacyMode) get a built-in
|
|
33
|
+
* default at init() and are therefore never `undefined` — a naive
|
|
34
|
+
* "fill-if-undefined" would silently ignore the dashboard for them.
|
|
35
|
+
*
|
|
36
|
+
* No-op when there's no remote config (older worker / container disabled /
|
|
37
|
+
* failed fetch) — built-in defaults then stand.
|
|
38
|
+
*/
|
|
39
|
+
export declare function applyRemoteConfig(config: DatalyrConfig, remote?: SdkRemoteConfig | null, explicitKeys?: ReadonlySet<string>): void;
|
|
40
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAMhC,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;CACrC;AAeD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,aAAa,EACrB,MAAM,CAAC,EAAE,eAAe,GAAG,IAAI,EAC/B,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,IAAI,CAUN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.test.d.ts","sourceRoot":"","sources":["../src/config.test.ts"],"names":[],"mappings":""}
|
package/dist/container.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Container Script Manager
|
|
3
3
|
* Loads and manages third-party tracking scripts and pixels
|
|
4
4
|
*/
|
|
5
|
+
import type { SdkRemoteConfig } from './config';
|
|
5
6
|
/**
|
|
6
7
|
* Identity snapshot read at the moment a third-party pixel initializes.
|
|
7
8
|
* Aligns the browser Pixel's advanced matching with what CAPI sends server-side
|
|
@@ -57,6 +58,10 @@ export declare class ContainerManager {
|
|
|
57
58
|
private loadedScripts;
|
|
58
59
|
private sessionLoadedScripts;
|
|
59
60
|
private pixels;
|
|
61
|
+
/** SDK runtime config from the /container-scripts `config` envelope (the
|
|
62
|
+
* dashboard sdk_config + server-computed defaults). undefined if the worker
|
|
63
|
+
* doesn't send it — caller then falls back to built-in defaults. */
|
|
64
|
+
private remoteConfig?;
|
|
60
65
|
private workspaceId;
|
|
61
66
|
private endpoint;
|
|
62
67
|
private debug;
|
|
@@ -75,6 +80,11 @@ export declare class ContainerManager {
|
|
|
75
80
|
* Initialize container and load scripts
|
|
76
81
|
*/
|
|
77
82
|
init(): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* The SDK runtime config delivered by /container-scripts, or undefined if the
|
|
85
|
+
* response omitted it. The SDK merges this under explicit init() options.
|
|
86
|
+
*/
|
|
87
|
+
getRemoteConfig(): SdkRemoteConfig | undefined;
|
|
78
88
|
/**
|
|
79
89
|
* Load scripts by trigger type
|
|
80
90
|
*/
|
package/dist/container.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAC;IAC9D,SAAS,EAAE,QAAQ,GAAG,eAAe,GAAG,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B;;OAEG;IACH,OAAO,CAAC,aAAa;IA0BrB;;OAEG;IACH,OAAO,CAAC,GAAG;CAKZ"}
|
package/dist/datalyr.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @datalyr/web v1.
|
|
2
|
+
* @datalyr/web v1.7.0
|
|
3
3
|
* Datalyr Web SDK - Modern attribution tracking for web applications
|
|
4
4
|
* (c) 2026 Datalyr Inc.
|
|
5
5
|
* Released under the MIT License
|
|
@@ -2404,9 +2404,10 @@ class ContainerManager {
|
|
|
2404
2404
|
throw new Error(`Failed to fetch container scripts: ${response.status}`);
|
|
2405
2405
|
}
|
|
2406
2406
|
const data = yield response.json();
|
|
2407
|
-
// Store scripts and
|
|
2407
|
+
// Store scripts, pixels, and the SDK runtime config envelope.
|
|
2408
2408
|
this.scripts = data.scripts || [];
|
|
2409
2409
|
this.pixels = data.pixels || null;
|
|
2410
|
+
this.remoteConfig = (data.config && typeof data.config === 'object') ? data.config : undefined;
|
|
2410
2411
|
// Initialize pixels if configured. Awaited so advanced-matching hashes
|
|
2411
2412
|
// are resolved before the first dl.track() flushes through trackToPixels
|
|
2412
2413
|
// (otherwise fbq('init') would lag fbq('track') in fast-path tracks).
|
|
@@ -2436,6 +2437,13 @@ class ContainerManager {
|
|
|
2436
2437
|
}
|
|
2437
2438
|
});
|
|
2438
2439
|
}
|
|
2440
|
+
/**
|
|
2441
|
+
* The SDK runtime config delivered by /container-scripts, or undefined if the
|
|
2442
|
+
* response omitted it. The SDK merges this under explicit init() options.
|
|
2443
|
+
*/
|
|
2444
|
+
getRemoteConfig() {
|
|
2445
|
+
return this.remoteConfig;
|
|
2446
|
+
}
|
|
2439
2447
|
/**
|
|
2440
2448
|
* Load scripts by trigger type
|
|
2441
2449
|
*/
|
|
@@ -3093,7 +3101,7 @@ class AutoIdentifyManager {
|
|
|
3093
3101
|
this.config = {
|
|
3094
3102
|
enabled: config.enabled !== false,
|
|
3095
3103
|
captureFromForms: config.captureFromForms !== false,
|
|
3096
|
-
captureFromAPI: config.captureFromAPI
|
|
3104
|
+
captureFromAPI: config.captureFromAPI === true, // default OFF: same-origin response-scan can mis-identify (e.g. admin views)
|
|
3097
3105
|
captureFromShopify: config.captureFromShopify !== false,
|
|
3098
3106
|
trustedDomains: config.trustedDomains || [],
|
|
3099
3107
|
debug: config.debug || false
|
|
@@ -3502,12 +3510,57 @@ class AutoIdentifyManager {
|
|
|
3502
3510
|
}
|
|
3503
3511
|
}
|
|
3504
3512
|
|
|
3513
|
+
/** Keys the remote config is allowed to fill on DatalyrConfig. */
|
|
3514
|
+
const REMOTE_KEYS = [
|
|
3515
|
+
'autoIdentify',
|
|
3516
|
+
'autoIdentifyForms',
|
|
3517
|
+
'autoIdentifyAPI',
|
|
3518
|
+
'autoIdentifyShopify',
|
|
3519
|
+
'shopifyCartAttributes',
|
|
3520
|
+
'checkoutChampDomains',
|
|
3521
|
+
'respectGlobalPrivacyControl',
|
|
3522
|
+
'respectDoNotTrack',
|
|
3523
|
+
'privacyMode',
|
|
3524
|
+
];
|
|
3525
|
+
/**
|
|
3526
|
+
* Fold `remote` into `config` IN PLACE. Precedence per key:
|
|
3527
|
+
* explicit init() value > remote (dashboard) > built-in default
|
|
3528
|
+
*
|
|
3529
|
+
* `explicitKeys` = the keys the CALLER passed to init() (before built-in
|
|
3530
|
+
* defaults were merged in). For any remote key NOT in that set, remote
|
|
3531
|
+
* OVERRIDES the built-in default. This is essential because some keys
|
|
3532
|
+
* (respectDoNotTrack, respectGlobalPrivacyControl, privacyMode) get a built-in
|
|
3533
|
+
* default at init() and are therefore never `undefined` — a naive
|
|
3534
|
+
* "fill-if-undefined" would silently ignore the dashboard for them.
|
|
3535
|
+
*
|
|
3536
|
+
* No-op when there's no remote config (older worker / container disabled /
|
|
3537
|
+
* failed fetch) — built-in defaults then stand.
|
|
3538
|
+
*/
|
|
3539
|
+
function applyRemoteConfig(config, remote, explicitKeys) {
|
|
3540
|
+
if (!remote)
|
|
3541
|
+
return;
|
|
3542
|
+
const target = config;
|
|
3543
|
+
for (const key of REMOTE_KEYS) {
|
|
3544
|
+
const remoteVal = remote[key];
|
|
3545
|
+
if (remoteVal === undefined || remoteVal === null)
|
|
3546
|
+
continue;
|
|
3547
|
+
// Explicit init() always wins; otherwise remote overrides the built-in default.
|
|
3548
|
+
if (explicitKeys === null || explicitKeys === void 0 ? void 0 : explicitKeys.has(key))
|
|
3549
|
+
continue;
|
|
3550
|
+
target[key] = remoteVal;
|
|
3551
|
+
}
|
|
3552
|
+
}
|
|
3553
|
+
|
|
3505
3554
|
/**
|
|
3506
3555
|
* Datalyr Web SDK
|
|
3507
3556
|
* Modern attribution tracking for web applications
|
|
3508
3557
|
*/
|
|
3509
3558
|
class Datalyr {
|
|
3510
3559
|
constructor() {
|
|
3560
|
+
// Keys the caller passed to init() (before built-in defaults were merged).
|
|
3561
|
+
// Lets the remote-config merge override built-in defaults while always
|
|
3562
|
+
// deferring to an explicit init() value. See applyRemoteConfig.
|
|
3563
|
+
this.explicitConfigKeys = new Set();
|
|
3511
3564
|
this.superProperties = {};
|
|
3512
3565
|
this.userProperties = {};
|
|
3513
3566
|
this.optedOut = false;
|
|
@@ -3530,6 +3583,10 @@ class Datalyr {
|
|
|
3530
3583
|
if (!config.workspaceId) {
|
|
3531
3584
|
throw new Error('[Datalyr] workspaceId is required');
|
|
3532
3585
|
}
|
|
3586
|
+
// Snapshot the keys the caller explicitly set, BEFORE built-in defaults are
|
|
3587
|
+
// merged in — so the remote-config merge can override built-in defaults
|
|
3588
|
+
// while still deferring to anything the caller passed explicitly.
|
|
3589
|
+
this.explicitConfigKeys = new Set(Object.keys(config));
|
|
3533
3590
|
// Set default config values
|
|
3534
3591
|
this.config = Object.assign({ endpoint: 'https://ingest.datalyr.com', debug: false, batchSize: 10, flushInterval: 5000, flushAt: 10, criticalEvents: undefined, highPriorityEvents: undefined, sessionTimeout: 60 * 60 * 1000, trackSessions: true, attributionWindow: 90 * 24 * 60 * 60 * 1000, trackedParams: [], respectDoNotTrack: false, respectGlobalPrivacyControl: true, privacyMode: 'standard', cookieDomain: 'auto', cookieExpires: 365, secureCookie: 'auto', sameSite: 'Lax', cookiePrefix: '__dl_', enablePerformanceTracking: true, enableFingerprinting: true, maxRetries: 5, retryDelay: 1000, maxOfflineQueueSize: 100, trackSPA: true, trackPageViews: true, fallbackEndpoints: [], plugins: [] }, config);
|
|
3535
3592
|
// platform:'shopify' implies cart-attribute sync: stamp visitor_id + Meta
|
|
@@ -3606,6 +3663,7 @@ class Datalyr {
|
|
|
3606
3663
|
return this.initializationPromise;
|
|
3607
3664
|
}
|
|
3608
3665
|
this.initializationPromise = (() => __awaiter(this, void 0, void 0, function* () {
|
|
3666
|
+
var _a;
|
|
3609
3667
|
try {
|
|
3610
3668
|
// SEC-03 Fix: Initialize encryption for PII data
|
|
3611
3669
|
const deviceId = this.identity.getAnonymousId();
|
|
@@ -3651,6 +3709,16 @@ class Datalyr {
|
|
|
3651
3709
|
this.fireCheckoutChampPurchasePixel();
|
|
3652
3710
|
}
|
|
3653
3711
|
}
|
|
3712
|
+
// Fold the remote /container-scripts config UNDER explicit init()
|
|
3713
|
+
// overrides (precedence: defaults <- remote <- explicit). No-op if the
|
|
3714
|
+
// container is disabled or the worker didn't send `config`. This is what
|
|
3715
|
+
// makes the dashboard toggles take effect with no snippet edits.
|
|
3716
|
+
applyRemoteConfig(this.config, (_a = this.container) === null || _a === void 0 ? void 0 : _a.getRemoteConfig(), this.explicitConfigKeys);
|
|
3717
|
+
// Privacy-strict turns auto-identify (email capture) OFF regardless of
|
|
3718
|
+
// the dashboard/remote value — privacy wins over the bridge.
|
|
3719
|
+
if (this.config.privacyMode === 'strict') {
|
|
3720
|
+
this.config.autoIdentify = false;
|
|
3721
|
+
}
|
|
3654
3722
|
// autoIdentify default for the CC bridge:
|
|
3655
3723
|
// - platform === 'checkoutchamp' (CC funnel pages) OR
|
|
3656
3724
|
// - checkoutChampDomains set (Shopify storefronts feeding a CC funnel)
|
|
@@ -3661,8 +3729,10 @@ class Datalyr {
|
|
|
3661
3729
|
if (ccBridgeActive && this.config.autoIdentify === undefined) {
|
|
3662
3730
|
this.config.autoIdentify = true;
|
|
3663
3731
|
}
|
|
3664
|
-
// Initialize auto-identify
|
|
3665
|
-
|
|
3732
|
+
// Initialize auto-identify when enabled (explicit or remote) AND
|
|
3733
|
+
// tracking is allowed. The shouldTrack() gate keeps capture from even
|
|
3734
|
+
// setting up its form/API interceptors for opted-out / DNT / GPC users.
|
|
3735
|
+
if (this.config.autoIdentify === true && this.shouldTrack()) {
|
|
3666
3736
|
this.autoIdentify = new AutoIdentifyManager({
|
|
3667
3737
|
enabled: true,
|
|
3668
3738
|
captureFromForms: this.config.autoIdentifyForms,
|
|
@@ -3688,7 +3758,7 @@ class Datalyr {
|
|
|
3688
3758
|
// Lets server-side order webhooks recover the browser visitor + Meta click
|
|
3689
3759
|
// signals (the postback webhook reads these as note_attributes). Inert unless
|
|
3690
3760
|
// enabled; best-effort and never blocks init.
|
|
3691
|
-
if (this.config.shopifyCartAttributes === true) {
|
|
3761
|
+
if (this.config.shopifyCartAttributes === true && this.shouldTrack()) {
|
|
3692
3762
|
this.syncShopifyCartAttributes().catch((error) => {
|
|
3693
3763
|
this.log('Shopify cart attribute sync failed:', error);
|
|
3694
3764
|
});
|