@temps-sdk/analytics-browser 0.0.7 → 0.0.9-beta.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/README.md CHANGED
@@ -30,7 +30,7 @@ After `init()`, a global `window.temps` handle is exposed for convenience.
30
30
  ```html
31
31
  <script
32
32
  defer
33
- src="https://cdn.jsdelivr.net/npm/@temps-sdk/analytics-browser@0.0.7/dist/temps.min.js"
33
+ src="https://cdn.jsdelivr.net/npm/@temps-sdk/analytics-browser@0.0.8/dist/temps.min.js"
34
34
  ></script>
35
35
  ```
36
36
 
@@ -43,7 +43,7 @@ All `data-*` attributes on the script tag map to `AnalyticsOptions`
43
43
  ```html
44
44
  <script
45
45
  defer
46
- src="https://cdn.jsdelivr.net/npm/@temps-sdk/analytics-browser@0.0.7/dist/temps.min.js"
46
+ src="https://cdn.jsdelivr.net/npm/@temps-sdk/analytics-browser@0.0.8/dist/temps.min.js"
47
47
  data-session-recording="true"
48
48
  ></script>
49
49
  ```
package/dist/auto.js CHANGED
@@ -9,7 +9,7 @@ import { init } from "./index";
9
9
  * Usage:
10
10
  * <script
11
11
  * defer
12
- * src="https://cdn.jsdelivr.net/npm/@temps-sdk/analytics-browser@0.0.7/dist/temps.min.js">
12
+ * src="https://cdn.jsdelivr.net/npm/@temps-sdk/analytics-browser@0.0.8/dist/temps.min.js">
13
13
  * </script>
14
14
  */
15
15
  function readDataset() {
@@ -34,6 +34,9 @@ function readDataset() {
34
34
  opts.ingestKey = ds.ingestKey;
35
35
  if (ds.domain)
36
36
  opts.domain = ds.domain;
37
+ // `data-cookieless="true"`: store nothing on the device (ADR 109 D3).
38
+ if (ds.cookieless)
39
+ opts.cookieless = ds.cookieless === "true";
37
40
  if (ds.disabled)
38
41
  opts.disabled = ds.disabled === "true";
39
42
  if (ds.ignoreLocalhost)
@@ -54,6 +57,19 @@ function readDataset() {
54
57
  opts.inactivityTimeout = Number(ds.inactivityTimeout);
55
58
  if (ds.engagementThreshold)
56
59
  opts.engagementThreshold = Number(ds.engagementThreshold);
60
+ // Outbound links, file downloads and 404 markers (ADR 109 D1), on by default.
61
+ if (ds.autoTrackOutboundLinks)
62
+ opts.autoTrackOutboundLinks = ds.autoTrackOutboundLinks === "true";
63
+ if (ds.autoTrackFileDownloads)
64
+ opts.autoTrackFileDownloads = ds.autoTrackFileDownloads === "true";
65
+ if (ds.fileDownloadExtensions) {
66
+ opts.fileDownloadExtensions = ds.fileDownloadExtensions
67
+ .split(",")
68
+ .map((s) => s.trim().replace(/^\./, ""))
69
+ .filter((s) => s.length > 0);
70
+ }
71
+ if (ds.autoTrackNotFound)
72
+ opts.autoTrackNotFound = ds.autoTrackNotFound === "true";
57
73
  if (ds.sessionRecording)
58
74
  opts.enableSessionRecording = ds.sessionRecording === "true";
59
75
  if (ds.sessionSampleRate)
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type AnalyticsApi, type AnalyticsOptions, type JsonValue } from "@temps-sdk/analytics-core";
1
+ import { type AnalyticsApi, type AnalyticsOptions, type IdentifyResult, type JsonValue } from "@temps-sdk/analytics-core";
2
2
  export * from "@temps-sdk/analytics-core";
3
3
  /**
4
4
  * Initialize Temps analytics. Safe to call multiple times — subsequent calls
@@ -11,6 +11,19 @@ export declare function getAnalytics(): AnalyticsApi;
11
11
  export declare function trackEvent(eventName: string, data?: Record<string, JsonValue>): Promise<void>;
12
12
  /** Convenience wrapper — throws if uninitialized. */
13
13
  export declare function trackPageview(): void;
14
+ /**
15
+ * Report the current page as missing (`not_found` event). Convenience
16
+ * wrapper — throws if uninitialized.
17
+ */
18
+ export declare function trackNotFound(data?: Record<string, JsonValue>): Promise<void>;
19
+ /**
20
+ * Attach your app's user id (and optional traits) to this visitor, e.g.
21
+ * after signup (`window.temps.identify(...)` from a script tag).
22
+ * Convenience wrapper — throws if uninitialized.
23
+ */
24
+ export declare function identify(userId: string, traits?: Record<string, JsonValue>): Promise<IdentifyResult>;
25
+ /** Forget the identity on sign-out. Convenience wrapper — throws if uninitialized. */
26
+ export declare function reset(): Promise<void>;
14
27
  /** Tear down the instance and remove listeners. */
15
28
  export declare function destroy(): void;
16
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACf,MAAM,2BAA2B,CAAC;AAEnC,cAAc,2BAA2B,CAAC;AAS1C;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,gBAAqB,GAAG,YAAY,CASjE;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,IAAI,YAAY,CAO3C;AAED,qDAAqD;AACrD,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,qDAAqD;AACrD,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,mDAAmD;AACnD,wBAAgB,OAAO,IAAI,IAAI,CAM9B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,2BAA2B,CAAC;AAEnC,cAAc,2BAA2B,CAAC;AAS1C;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,gBAAqB,GAAG,YAAY,CASjE;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,IAAI,YAAY,CAO3C;AAED,qDAAqD;AACrD,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,qDAAqD;AACrD,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7E;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACjC,OAAO,CAAC,cAAc,CAAC,CAEzB;AAED,sFAAsF;AACtF,wBAAgB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAErC;AAED,mDAAmD;AACnD,wBAAgB,OAAO,IAAI,IAAI,CAM9B"}
package/dist/index.js CHANGED
@@ -32,6 +32,25 @@ export function trackEvent(eventName, data) {
32
32
  export function trackPageview() {
33
33
  getAnalytics().trackPageview();
34
34
  }
35
+ /**
36
+ * Report the current page as missing (`not_found` event). Convenience
37
+ * wrapper — throws if uninitialized.
38
+ */
39
+ export function trackNotFound(data) {
40
+ return getAnalytics().trackNotFound(data);
41
+ }
42
+ /**
43
+ * Attach your app's user id (and optional traits) to this visitor, e.g.
44
+ * after signup (`window.temps.identify(...)` from a script tag).
45
+ * Convenience wrapper — throws if uninitialized.
46
+ */
47
+ export function identify(userId, traits) {
48
+ return getAnalytics().identify(userId, traits);
49
+ }
50
+ /** Forget the identity on sign-out. Convenience wrapper — throws if uninitialized. */
51
+ export function reset() {
52
+ return getAnalytics().reset();
53
+ }
35
54
  /** Tear down the instance and remove listeners. */
36
55
  export function destroy() {
37
56
  instance?.destroy();