flowgrid-sdk 1.2.1 → 1.4.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 +221 -250
- package/dist/237.flowgrid.min.js +2 -0
- package/dist/237.flowgrid.min.js.map +1 -0
- package/dist/546.flowgrid.min.js +3 -0
- package/dist/546.flowgrid.min.js.LICENSE.txt +14 -0
- package/dist/546.flowgrid.min.js.map +1 -0
- package/dist/EXAMPLE.d.ts +1 -0
- package/dist/EXAMPLE.js +55 -0
- package/dist/EXAMPLE.js.map +1 -0
- package/dist/browser.d.ts +46 -103
- package/dist/browser.js +102 -0
- package/dist/browser.js.map +1 -0
- package/dist/flowgrid.min.js +1 -1
- package/dist/flowgrid.min.js.map +1 -1
- package/dist/index.d.ts +7 -8
- package/dist/index.js +64 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/client/transport.d.ts +14 -4
- package/dist/lib/client/transport.js +432 -0
- package/dist/lib/client/transport.js.map +1 -0
- package/dist/lib/consent/index.d.ts +0 -5
- package/dist/lib/consent/index.js +32 -0
- package/dist/lib/consent/index.js.map +1 -0
- package/dist/lib/consent/manager.js +336 -0
- package/dist/lib/consent/manager.js.map +1 -0
- package/dist/lib/consent/types.d.ts +3 -20
- package/dist/lib/consent/types.js +10 -0
- package/dist/lib/consent/types.js.map +1 -0
- package/dist/lib/features/analytics/attribution.d.ts +6 -47
- package/dist/lib/features/analytics/attribution.js +181 -0
- package/dist/lib/features/analytics/attribution.js.map +1 -0
- package/dist/lib/features/analytics/events.d.ts +1 -28
- package/dist/lib/features/analytics/events.js +256 -0
- package/dist/lib/features/analytics/events.js.map +1 -0
- package/dist/lib/features/analytics/funnels.js +260 -0
- package/dist/lib/features/analytics/funnels.js.map +1 -0
- package/dist/lib/features/analytics/heatmaps.d.ts +12 -19
- package/dist/lib/features/analytics/heatmaps.js +258 -0
- package/dist/lib/features/analytics/heatmaps.js.map +1 -0
- package/dist/lib/features/analytics/identify.d.ts +1 -21
- package/dist/lib/features/analytics/identify.js +213 -0
- package/dist/lib/features/analytics/identify.js.map +1 -0
- package/dist/lib/features/analytics/index.d.ts +2 -0
- package/dist/lib/features/analytics/index.js +15 -0
- package/dist/lib/features/analytics/index.js.map +1 -0
- package/dist/lib/features/analytics/page-views.d.ts +13 -30
- package/dist/lib/features/analytics/page-views.js +268 -0
- package/dist/lib/features/analytics/page-views.js.map +1 -0
- package/dist/lib/features/analytics/performance.d.ts +18 -24
- package/dist/lib/features/analytics/performance.js +232 -0
- package/dist/lib/features/analytics/performance.js.map +1 -0
- package/dist/lib/features/analytics/replay.d.ts +170 -0
- package/dist/lib/features/analytics/replay.js +381 -0
- package/dist/lib/features/analytics/replay.js.map +1 -0
- package/dist/lib/features/analytics/retention.d.ts +1 -76
- package/dist/lib/features/analytics/retention.js +135 -0
- package/dist/lib/features/analytics/retention.js.map +1 -0
- package/dist/lib/features/analytics/sessions.d.ts +12 -37
- package/dist/lib/features/analytics/sessions.js +213 -0
- package/dist/lib/features/analytics/sessions.js.map +1 -0
- package/dist/lib/features/core/activation.d.ts +1 -24
- package/dist/lib/features/core/activation.js +175 -0
- package/dist/lib/features/core/activation.js.map +1 -0
- package/dist/lib/features/core/experiment.d.ts +53 -21
- package/dist/lib/features/core/experiment.js +554 -0
- package/dist/lib/features/core/experiment.js.map +1 -0
- package/dist/lib/features/core/index.js +9 -0
- package/dist/lib/features/core/index.js.map +1 -0
- package/dist/lib/features/core/track-feature.d.ts +1 -8
- package/dist/lib/features/core/track-feature.js +119 -0
- package/dist/lib/features/core/track-feature.js.map +1 -0
- package/dist/lib/features/core/track-prompt.d.ts +5 -8
- package/dist/lib/features/core/track-prompt.js +181 -0
- package/dist/lib/features/core/track-prompt.js.map +1 -0
- package/dist/lib/features/ecommerce/cart.d.ts +1 -24
- package/dist/lib/features/ecommerce/cart.js +244 -0
- package/dist/lib/features/ecommerce/cart.js.map +1 -0
- package/dist/lib/features/ecommerce/checkout.d.ts +1 -28
- package/dist/lib/features/ecommerce/checkout.js +254 -0
- package/dist/lib/features/ecommerce/checkout.js.map +1 -0
- package/dist/lib/features/ecommerce/index.d.ts +0 -2
- package/dist/lib/features/ecommerce/index.js +15 -0
- package/dist/lib/features/ecommerce/index.js.map +1 -0
- package/dist/lib/features/ecommerce/ltv.d.ts +1 -69
- package/dist/lib/features/ecommerce/ltv.js +114 -0
- package/dist/lib/features/ecommerce/ltv.js.map +1 -0
- package/dist/lib/features/ecommerce/products.d.ts +1 -33
- package/dist/lib/features/ecommerce/products.js +223 -0
- package/dist/lib/features/ecommerce/products.js.map +1 -0
- package/dist/lib/features/ecommerce/promotions.d.ts +1 -30
- package/dist/lib/features/ecommerce/promotions.js +197 -0
- package/dist/lib/features/ecommerce/promotions.js.map +1 -0
- package/dist/lib/features/ecommerce/purchases.d.ts +1 -48
- package/dist/lib/features/ecommerce/purchases.js +193 -0
- package/dist/lib/features/ecommerce/purchases.js.map +1 -0
- package/dist/lib/features/ecommerce/refunds.d.ts +1 -27
- package/dist/lib/features/ecommerce/refunds.js +195 -0
- package/dist/lib/features/ecommerce/refunds.js.map +1 -0
- package/dist/lib/features/ecommerce/search.d.ts +1 -24
- package/dist/lib/features/ecommerce/search.js +156 -0
- package/dist/lib/features/ecommerce/search.js.map +1 -0
- package/dist/lib/features/ecommerce/subscriptions.d.ts +1 -28
- package/dist/lib/features/ecommerce/subscriptions.js +207 -0
- package/dist/lib/features/ecommerce/subscriptions.js.map +1 -0
- package/dist/lib/features/ecommerce/wishlist.d.ts +1 -28
- package/dist/lib/features/ecommerce/wishlist.js +186 -0
- package/dist/lib/features/ecommerce/wishlist.js.map +1 -0
- package/dist/lib/features/enterprise/acquisition.d.ts +2 -57
- package/dist/lib/features/enterprise/acquisition.js +166 -0
- package/dist/lib/features/enterprise/acquisition.js.map +1 -0
- package/dist/lib/features/enterprise/alerts.d.ts +1 -37
- package/dist/lib/features/enterprise/alerts.js +246 -0
- package/dist/lib/features/enterprise/alerts.js.map +1 -0
- package/dist/lib/features/enterprise/churn.d.ts +1 -42
- package/dist/lib/features/enterprise/churn.js +175 -0
- package/dist/lib/features/enterprise/churn.js.map +1 -0
- package/dist/lib/features/enterprise/cohorts.d.ts +1 -37
- package/dist/lib/features/enterprise/cohorts.js +201 -0
- package/dist/lib/features/enterprise/cohorts.js.map +1 -0
- package/dist/lib/features/enterprise/engagement.d.ts +40 -46
- package/dist/lib/features/enterprise/engagement.js +335 -0
- package/dist/lib/features/enterprise/engagement.js.map +1 -0
- package/dist/lib/features/enterprise/forecasting.d.ts +0 -50
- package/dist/lib/features/enterprise/forecasting.js +232 -0
- package/dist/lib/features/enterprise/forecasting.js.map +1 -0
- package/dist/lib/features/enterprise/index.d.ts +1 -1
- package/dist/lib/features/enterprise/index.js +76 -0
- package/dist/lib/features/enterprise/index.js.map +1 -0
- package/dist/lib/features/enterprise/monetization.d.ts +1 -60
- package/dist/lib/features/enterprise/monetization.js +146 -0
- package/dist/lib/features/enterprise/monetization.js.map +1 -0
- package/dist/lib/features/enterprise/multi-path-funnels.d.ts +1 -17
- package/dist/lib/features/enterprise/multi-path-funnels.js +205 -0
- package/dist/lib/features/enterprise/multi-path-funnels.js.map +1 -0
- package/dist/lib/features/enterprise/paths.d.ts +1 -56
- package/dist/lib/features/enterprise/paths.js +149 -0
- package/dist/lib/features/enterprise/paths.js.map +1 -0
- package/dist/lib/features/enterprise/security.d.ts +8 -57
- package/dist/lib/features/enterprise/security.js +202 -0
- package/dist/lib/features/enterprise/security.js.map +1 -0
- package/dist/lib/features/enterprise/support.d.ts +3 -42
- package/dist/lib/features/enterprise/support.js +162 -0
- package/dist/lib/features/enterprise/support.js.map +1 -0
- package/dist/lib/flowgrid.d.ts +278 -0
- package/dist/lib/flowgrid.js +323 -0
- package/dist/lib/flowgrid.js.map +1 -0
- package/dist/lib/frameworks/index.d.ts +13 -6
- package/dist/lib/frameworks/index.js +18 -0
- package/dist/lib/frameworks/index.js.map +1 -0
- package/dist/lib/frameworks/nextjs/client.js +355 -0
- package/dist/lib/frameworks/nextjs/client.js.map +1 -0
- package/dist/lib/frameworks/nextjs/index.js +31 -0
- package/dist/lib/frameworks/nextjs/index.js.map +1 -0
- package/dist/lib/frameworks/nextjs/server.js +259 -0
- package/dist/lib/frameworks/nextjs/server.js.map +1 -0
- package/dist/lib/frameworks/node/index.js +391 -0
- package/dist/lib/frameworks/node/index.js.map +1 -0
- package/dist/lib/frameworks/nuxt/index.js +288 -0
- package/dist/lib/frameworks/nuxt/index.js.map +1 -0
- package/dist/lib/frameworks/react/CookieBanner.js +166 -0
- package/dist/lib/frameworks/react/CookieBanner.js.map +1 -0
- package/dist/lib/frameworks/react/index.js +271 -0
- package/dist/lib/frameworks/react/index.js.map +1 -0
- package/dist/lib/frameworks/vue/CookieBanner.js +165 -0
- package/dist/lib/frameworks/vue/CookieBanner.js.map +1 -0
- package/dist/lib/frameworks/vue/index.js +390 -0
- package/dist/lib/frameworks/vue/index.js.map +1 -0
- package/dist/lib/tracking/analytics/attribution.d.ts +14 -0
- package/dist/lib/tracking/analytics/attribution.js +18 -0
- package/dist/lib/tracking/analytics/attribution.js.map +1 -0
- package/dist/lib/tracking/analytics/events.d.ts +26 -0
- package/dist/lib/tracking/analytics/events.js +30 -0
- package/dist/lib/tracking/analytics/events.js.map +1 -0
- package/dist/lib/tracking/analytics/funnels.d.ts +16 -0
- package/dist/lib/tracking/analytics/funnels.js +22 -0
- package/dist/lib/tracking/analytics/funnels.js.map +1 -0
- package/dist/lib/tracking/analytics/heatmaps.d.ts +27 -0
- package/dist/lib/tracking/analytics/heatmaps.js +22 -0
- package/dist/lib/tracking/analytics/heatmaps.js.map +1 -0
- package/dist/lib/tracking/analytics/identify.d.ts +16 -0
- package/dist/lib/tracking/analytics/identify.js +22 -0
- package/dist/lib/tracking/analytics/identify.js.map +1 -0
- package/dist/lib/tracking/analytics/index.d.ts +10 -0
- package/dist/lib/tracking/analytics/index.js +11 -0
- package/dist/lib/tracking/analytics/index.js.map +1 -0
- package/dist/lib/tracking/analytics/page-views.d.ts +29 -0
- package/dist/lib/tracking/analytics/page-views.js +50 -0
- package/dist/lib/tracking/analytics/page-views.js.map +1 -0
- package/dist/lib/tracking/analytics/performance.d.ts +22 -0
- package/dist/lib/tracking/analytics/performance.js +22 -0
- package/dist/lib/tracking/analytics/performance.js.map +1 -0
- package/dist/lib/tracking/analytics/replay.d.ts +34 -0
- package/dist/lib/tracking/analytics/replay.js +46 -0
- package/dist/lib/tracking/analytics/replay.js.map +1 -0
- package/dist/lib/tracking/analytics/retention.d.ts +10 -0
- package/dist/lib/tracking/analytics/retention.js +10 -0
- package/dist/lib/tracking/analytics/retention.js.map +1 -0
- package/dist/lib/tracking/analytics/sessions.d.ts +20 -0
- package/dist/lib/tracking/analytics/sessions.js +26 -0
- package/dist/lib/tracking/analytics/sessions.js.map +1 -0
- package/dist/lib/tracking/core/activation.d.ts +23 -0
- package/dist/lib/tracking/core/activation.js +33 -0
- package/dist/lib/tracking/core/activation.js.map +1 -0
- package/dist/lib/tracking/core/experiment.d.ts +122 -0
- package/dist/lib/tracking/core/experiment.js +150 -0
- package/dist/lib/tracking/core/experiment.js.map +1 -0
- package/dist/lib/tracking/core/feature.d.ts +13 -0
- package/dist/lib/tracking/core/feature.js +14 -0
- package/dist/lib/tracking/core/feature.js.map +1 -0
- package/dist/lib/tracking/core/index.d.ts +4 -0
- package/dist/lib/tracking/core/index.js +5 -0
- package/dist/lib/tracking/core/index.js.map +1 -0
- package/dist/lib/tracking/core/prompt.d.ts +18 -0
- package/dist/lib/tracking/core/prompt.js +26 -0
- package/dist/lib/tracking/core/prompt.js.map +1 -0
- package/dist/lib/tracking/ecommerce/cart.d.ts +17 -0
- package/dist/lib/tracking/ecommerce/cart.js +22 -0
- package/dist/lib/tracking/ecommerce/cart.js.map +1 -0
- package/dist/lib/tracking/ecommerce/checkout.d.ts +17 -0
- package/dist/lib/tracking/ecommerce/checkout.js +22 -0
- package/dist/lib/tracking/ecommerce/checkout.js.map +1 -0
- package/dist/lib/tracking/ecommerce/index.d.ts +10 -0
- package/dist/lib/tracking/ecommerce/index.js +11 -0
- package/dist/lib/tracking/ecommerce/index.js.map +1 -0
- package/dist/lib/tracking/ecommerce/ltv.d.ts +15 -0
- package/dist/lib/tracking/ecommerce/ltv.js +14 -0
- package/dist/lib/tracking/ecommerce/ltv.js.map +1 -0
- package/dist/lib/tracking/ecommerce/products.d.ts +15 -0
- package/dist/lib/tracking/ecommerce/products.js +18 -0
- package/dist/lib/tracking/ecommerce/products.js.map +1 -0
- package/dist/lib/tracking/ecommerce/promotions.d.ts +14 -0
- package/dist/lib/tracking/ecommerce/promotions.js +25 -0
- package/dist/lib/tracking/ecommerce/promotions.js.map +1 -0
- package/dist/lib/tracking/ecommerce/purchases.d.ts +11 -0
- package/dist/lib/tracking/ecommerce/purchases.js +10 -0
- package/dist/lib/tracking/ecommerce/purchases.js.map +1 -0
- package/dist/lib/tracking/ecommerce/refunds.d.ts +17 -0
- package/dist/lib/tracking/ecommerce/refunds.js +22 -0
- package/dist/lib/tracking/ecommerce/refunds.js.map +1 -0
- package/dist/lib/tracking/ecommerce/search.d.ts +24 -0
- package/dist/lib/tracking/ecommerce/search.js +22 -0
- package/dist/lib/tracking/ecommerce/search.js.map +1 -0
- package/dist/lib/tracking/ecommerce/subscriptions.d.ts +21 -0
- package/dist/lib/tracking/ecommerce/subscriptions.js +38 -0
- package/dist/lib/tracking/ecommerce/subscriptions.js.map +1 -0
- package/dist/lib/tracking/ecommerce/wishlist.d.ts +19 -0
- package/dist/lib/tracking/ecommerce/wishlist.js +26 -0
- package/dist/lib/tracking/ecommerce/wishlist.js.map +1 -0
- package/dist/lib/tracking/enterprise/acquisition.d.ts +25 -0
- package/dist/lib/tracking/enterprise/acquisition.js +22 -0
- package/dist/lib/tracking/enterprise/acquisition.js.map +1 -0
- package/dist/lib/tracking/enterprise/alerts.d.ts +32 -0
- package/dist/lib/tracking/enterprise/alerts.js +30 -0
- package/dist/lib/tracking/enterprise/alerts.js.map +1 -0
- package/dist/lib/tracking/enterprise/churn.d.ts +23 -0
- package/dist/lib/tracking/enterprise/churn.js +22 -0
- package/dist/lib/tracking/enterprise/churn.js.map +1 -0
- package/dist/lib/tracking/enterprise/cohorts.d.ts +18 -0
- package/dist/lib/tracking/enterprise/cohorts.js +18 -0
- package/dist/lib/tracking/enterprise/cohorts.js.map +1 -0
- package/dist/lib/tracking/enterprise/engagement.d.ts +31 -0
- package/dist/lib/tracking/enterprise/engagement.js +44 -0
- package/dist/lib/tracking/enterprise/engagement.js.map +1 -0
- package/dist/lib/tracking/enterprise/forecasting.d.ts +18 -0
- package/dist/lib/tracking/enterprise/forecasting.js +22 -0
- package/dist/lib/tracking/enterprise/forecasting.js.map +1 -0
- package/dist/lib/tracking/enterprise/index.d.ts +11 -0
- package/dist/lib/tracking/enterprise/index.js +12 -0
- package/dist/lib/tracking/enterprise/index.js.map +1 -0
- package/dist/lib/tracking/enterprise/monetization.d.ts +14 -0
- package/dist/lib/tracking/enterprise/monetization.js +10 -0
- package/dist/lib/tracking/enterprise/monetization.js.map +1 -0
- package/dist/lib/tracking/enterprise/multi-path-funnels.d.ts +20 -0
- package/dist/lib/tracking/enterprise/multi-path-funnels.js +18 -0
- package/dist/lib/tracking/enterprise/multi-path-funnels.js.map +1 -0
- package/dist/lib/tracking/enterprise/paths.d.ts +20 -0
- package/dist/lib/tracking/enterprise/paths.js +18 -0
- package/dist/lib/tracking/enterprise/paths.js.map +1 -0
- package/dist/lib/tracking/enterprise/security.d.ts +28 -0
- package/dist/lib/tracking/enterprise/security.js +26 -0
- package/dist/lib/tracking/enterprise/security.js.map +1 -0
- package/dist/lib/tracking/enterprise/support.d.ts +25 -0
- package/dist/lib/tracking/enterprise/support.js +22 -0
- package/dist/lib/tracking/enterprise/support.js.map +1 -0
- package/dist/lib/tracking/index.d.ts +4 -0
- package/dist/lib/tracking/index.js +5 -0
- package/dist/lib/tracking/index.js.map +1 -0
- package/dist/lib/types/analytics.d.ts +10 -2
- package/dist/lib/types/analytics.js +6 -0
- package/dist/lib/types/analytics.js.map +1 -0
- package/dist/lib/types/common.js +6 -0
- package/dist/lib/types/common.js.map +1 -0
- package/dist/lib/types/ecommerce.js +6 -0
- package/dist/lib/types/ecommerce.js.map +1 -0
- package/dist/lib/types/index.js +8 -0
- package/dist/lib/types/index.js.map +1 -0
- package/dist/lib/utils/browser.d.ts +16 -0
- package/dist/lib/utils/browser.js +32 -0
- package/dist/lib/utils/browser.js.map +1 -0
- package/dist/lib/utils/identity.js +346 -0
- package/dist/lib/utils/identity.js.map +1 -0
- package/dist/lib/utils/storage.js +105 -0
- package/dist/lib/utils/storage.js.map +1 -0
- package/dist/umd/237.index.js +2 -0
- package/dist/umd/237.index.js.map +1 -0
- package/dist/umd/546.index.js +3 -0
- package/dist/umd/546.index.js.LICENSE.txt +14 -0
- package/dist/umd/546.index.js.map +1 -0
- package/dist/umd/index.js +2 -0
- package/dist/umd/index.js.map +1 -0
- package/package.json +27 -80
- package/dist/lib/features/ecommerce/inventory.d.ts +0 -219
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class IdentifyTracker {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
/** Identify a user with traits. */
|
|
6
|
+
user(userId, traits, anonymousId) {
|
|
7
|
+
return this.client.user({ userId, anonymousId, traits: traits });
|
|
8
|
+
}
|
|
9
|
+
/** Update traits on an existing user. */
|
|
10
|
+
updateTraits(userId, traits) {
|
|
11
|
+
return this.client.updateTraits(userId, traits);
|
|
12
|
+
}
|
|
13
|
+
/** Alias an anonymous ID to a known user ID. */
|
|
14
|
+
alias(previousId, userId) {
|
|
15
|
+
return this.client.alias({ previousId, userId });
|
|
16
|
+
}
|
|
17
|
+
/** Associate a user with a group/company. */
|
|
18
|
+
group(userId, groupId, traits) {
|
|
19
|
+
return this.client.group({ userId, groupId, traits: traits });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=identify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identify.js","sourceRoot":"","sources":["../../../../src/lib/tracking/analytics/identify.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,eAAe;IAC1B,YAA4B,MAAgB;QAAhB,WAAM,GAAN,MAAM,CAAU;IAAG,CAAC;IAEhD,mCAAmC;IACnC,IAAI,CAAC,MAAc,EAAE,MAAgC,EAAE,WAAoB;QACzE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,yCAAyC;IACzC,YAAY,CAAC,MAAc,EAAE,MAA+B;QAC1D,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,gDAAgD;IAChD,KAAK,CAAC,UAAkB,EAAE,MAAc;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,6CAA6C;IAC7C,KAAK,CAAC,MAAc,EAAE,OAAe,EAAE,MAAgC;QACrE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAChE,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { EventTracker } from "./events";
|
|
2
|
+
export { PageViewTracker } from "./page-views";
|
|
3
|
+
export { SessionTracker } from "./sessions";
|
|
4
|
+
export { IdentifyTracker } from "./identify";
|
|
5
|
+
export { FunnelTracker } from "./funnels";
|
|
6
|
+
export { RetentionTracker } from "./retention";
|
|
7
|
+
export { AttributionTracker } from "./attribution";
|
|
8
|
+
export { HeatmapTracker } from "./heatmaps";
|
|
9
|
+
export { PerformanceTracker } from "./performance";
|
|
10
|
+
export { ReplayTracker } from "./replay";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { EventTracker } from "./events";
|
|
2
|
+
export { PageViewTracker } from "./page-views";
|
|
3
|
+
export { SessionTracker } from "./sessions";
|
|
4
|
+
export { IdentifyTracker } from "./identify";
|
|
5
|
+
export { FunnelTracker } from "./funnels";
|
|
6
|
+
export { RetentionTracker } from "./retention";
|
|
7
|
+
export { AttributionTracker } from "./attribution";
|
|
8
|
+
export { HeatmapTracker } from "./heatmaps";
|
|
9
|
+
export { PerformanceTracker } from "./performance";
|
|
10
|
+
export { ReplayTracker } from "./replay";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/tracking/analytics/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page view shortcuts. Browser fields auto-detected when available.
|
|
3
|
+
*/
|
|
4
|
+
import { PageViews } from "../../features/analytics/page-views";
|
|
5
|
+
export declare class PageViewTracker {
|
|
6
|
+
readonly client: PageViews;
|
|
7
|
+
constructor(client: PageViews);
|
|
8
|
+
/**
|
|
9
|
+
* Track a page view. With no args, auto-detects from `window`/`document`.
|
|
10
|
+
* Pass a path or full URL to override.
|
|
11
|
+
*/
|
|
12
|
+
view(pathOrUrl?: string, properties?: Record<string, unknown>, opts?: {
|
|
13
|
+
title?: string;
|
|
14
|
+
referrer?: string;
|
|
15
|
+
userId?: string;
|
|
16
|
+
sessionId?: string;
|
|
17
|
+
}): Promise<import("../../features/analytics/page-views").PageViewResponse>;
|
|
18
|
+
/** Record scroll depth (0-100). */
|
|
19
|
+
scroll(path: string, scrollDepth: number, timeAtDepth?: number): Promise<import("../../features/analytics/page-views").PageViewResponse>;
|
|
20
|
+
/** Record time spent on a page (seconds). */
|
|
21
|
+
time(path: string, duration: number): Promise<import("../../features/analytics/page-views").PageViewResponse>;
|
|
22
|
+
/** Record page exit. */
|
|
23
|
+
exit(path: string, duration: number, scrollDepth: number): Promise<import("../../features/analytics/page-views").PageViewResponse>;
|
|
24
|
+
/** Auto-track SPA route changes, scroll-depth thresholds, and time-on-page. */
|
|
25
|
+
autoTrack(options?: {
|
|
26
|
+
userId?: string;
|
|
27
|
+
sessionId?: string;
|
|
28
|
+
}): import("../../utils/browser").Teardown;
|
|
29
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
function browserDefaults() {
|
|
2
|
+
const isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
|
3
|
+
return {
|
|
4
|
+
url: isBrowser ? window.location.href : "",
|
|
5
|
+
path: isBrowser ? window.location.pathname : "",
|
|
6
|
+
title: isBrowser ? document.title : undefined,
|
|
7
|
+
referrer: isBrowser ? document.referrer : undefined,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export class PageViewTracker {
|
|
11
|
+
constructor(client) {
|
|
12
|
+
this.client = client;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Track a page view. With no args, auto-detects from `window`/`document`.
|
|
16
|
+
* Pass a path or full URL to override.
|
|
17
|
+
*/
|
|
18
|
+
view(pathOrUrl, properties, opts) {
|
|
19
|
+
const d = browserDefaults();
|
|
20
|
+
const isFullUrl = pathOrUrl && /^https?:\/\//i.test(pathOrUrl);
|
|
21
|
+
const url = isFullUrl ? pathOrUrl : d.url;
|
|
22
|
+
const path = isFullUrl ? new URL(pathOrUrl).pathname : (pathOrUrl ?? d.path);
|
|
23
|
+
return this.client.track({
|
|
24
|
+
url,
|
|
25
|
+
path,
|
|
26
|
+
title: opts?.title ?? d.title,
|
|
27
|
+
referrer: opts?.referrer ?? d.referrer,
|
|
28
|
+
userId: opts?.userId,
|
|
29
|
+
sessionId: opts?.sessionId,
|
|
30
|
+
properties,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** Record scroll depth (0-100). */
|
|
34
|
+
scroll(path, scrollDepth, timeAtDepth) {
|
|
35
|
+
return this.client.trackScrollDepth({ path, scrollDepth, timeAtDepth });
|
|
36
|
+
}
|
|
37
|
+
/** Record time spent on a page (seconds). */
|
|
38
|
+
time(path, duration) {
|
|
39
|
+
return this.client.trackTimeOnPage({ path, duration });
|
|
40
|
+
}
|
|
41
|
+
/** Record page exit. */
|
|
42
|
+
exit(path, duration, scrollDepth) {
|
|
43
|
+
return this.client.trackExit(path, duration, scrollDepth);
|
|
44
|
+
}
|
|
45
|
+
/** Auto-track SPA route changes, scroll-depth thresholds, and time-on-page. */
|
|
46
|
+
autoTrack(options) {
|
|
47
|
+
return this.client.autoTrack(options);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=page-views.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-views.js","sourceRoot":"","sources":["../../../../src/lib/tracking/analytics/page-views.ts"],"names":[],"mappings":"AAKA,SAAS,eAAe;IACtB,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,CAAC;IACnF,OAAO;QACL,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QAC1C,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;QAC/C,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;QAC7C,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;KACpD,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,eAAe;IAC1B,YAA4B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAEjD;;;OAGG;IACH,IAAI,CACF,SAAkB,EAClB,UAAoC,EACpC,IAAiF;QAEjF,MAAM,CAAC,GAAG,eAAe,EAAE,CAAC;QAC5B,MAAM,SAAS,GAAG,SAAS,IAAI,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/D,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,SAAU,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAC3C,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,SAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAC9E,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YACvB,GAAG;YACH,IAAI;YACJ,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC,KAAK;YAC7B,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,CAAC,CAAC,QAAQ;YACtC,MAAM,EAAE,IAAI,EAAE,MAAM;YACpB,SAAS,EAAE,IAAI,EAAE,SAAS;YAC1B,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED,mCAAmC;IACnC,MAAM,CAAC,IAAY,EAAE,WAAmB,EAAE,WAAoB;QAC5D,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,6CAA6C;IAC7C,IAAI,CAAC,IAAY,EAAE,QAAgB;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,wBAAwB;IACxB,IAAI,CAAC,IAAY,EAAE,QAAgB,EAAE,WAAmB;QACtD,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IAED,+EAA+E;IAC/E,SAAS,CAAC,OAAiD;QACzD,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance shortcuts.
|
|
3
|
+
*/
|
|
4
|
+
import { PerformanceTracking } from "../../features/analytics/performance";
|
|
5
|
+
type ResourceType = "script" | "stylesheet" | "image" | "font" | "xhr" | "fetch" | "other";
|
|
6
|
+
export declare class PerformanceTracker {
|
|
7
|
+
readonly client: PerformanceTracking;
|
|
8
|
+
constructor(client: PerformanceTracking);
|
|
9
|
+
/** Report Core Web Vitals (LCP/FID/CLS/INP/TTFB). */
|
|
10
|
+
webVitals(pageUrl: string, vitals: Record<string, number>): Promise<import("../../features/analytics/performance").PerformanceResponse>;
|
|
11
|
+
/** Report page-load timing. */
|
|
12
|
+
pageLoad(pageUrl: string, timings: Record<string, number>): Promise<import("../../features/analytics/performance").PerformanceResponse>;
|
|
13
|
+
/** Report a single resource load. */
|
|
14
|
+
resource(pageUrl: string, resourceUrl: string, resourceType: ResourceType, duration: number): Promise<import("../../features/analytics/performance").PerformanceResponse>;
|
|
15
|
+
/** Auto-collect Core Web Vitals + navigation timing from the browser. */
|
|
16
|
+
autoTrack(options?: {
|
|
17
|
+
userId?: string;
|
|
18
|
+
resources?: boolean;
|
|
19
|
+
minDuration?: number;
|
|
20
|
+
}): import("../../utils/browser").Teardown;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class PerformanceTracker {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
/** Report Core Web Vitals (LCP/FID/CLS/INP/TTFB). */
|
|
6
|
+
webVitals(pageUrl, vitals) {
|
|
7
|
+
return this.client.trackWebVitals({ pageUrl, ...vitals });
|
|
8
|
+
}
|
|
9
|
+
/** Report page-load timing. */
|
|
10
|
+
pageLoad(pageUrl, timings) {
|
|
11
|
+
return this.client.trackPageLoad({ pageUrl, ...timings });
|
|
12
|
+
}
|
|
13
|
+
/** Report a single resource load. */
|
|
14
|
+
resource(pageUrl, resourceUrl, resourceType, duration) {
|
|
15
|
+
return this.client.trackResource({ pageUrl, resourceUrl, resourceType, duration });
|
|
16
|
+
}
|
|
17
|
+
/** Auto-collect Core Web Vitals + navigation timing from the browser. */
|
|
18
|
+
autoTrack(options) {
|
|
19
|
+
return this.client.autoTrack(options);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=performance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance.js","sourceRoot":"","sources":["../../../../src/lib/tracking/analytics/performance.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,kBAAkB;IAC7B,YAA4B,MAA2B;QAA3B,WAAM,GAAN,MAAM,CAAqB;IAAG,CAAC;IAE3D,qDAAqD;IACrD,SAAS,CAAC,OAAe,EAAE,MAA8B;QACvD,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,+BAA+B;IAC/B,QAAQ,CAAC,OAAe,EAAE,OAA+B;QACvD,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,qCAAqC;IACrC,QAAQ,CAAC,OAAe,EAAE,WAAmB,EAAE,YAA0B,EAAE,QAAgB;QACzF,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,yEAAyE;IACzE,SAAS,CAAC,OAAwE;QAChF,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Replay shortcut wrapper.
|
|
3
|
+
*/
|
|
4
|
+
import { SessionReplay, type SessionReplayFlushMetadata, type SessionReplayFlushReason, type SessionReplayOptions, type SessionReplayStatus } from "../../features/analytics/replay";
|
|
5
|
+
import type { Teardown } from "../../utils/browser";
|
|
6
|
+
export declare class ReplayTracker {
|
|
7
|
+
readonly client: SessionReplay;
|
|
8
|
+
constructor(client: SessionReplay);
|
|
9
|
+
/**
|
|
10
|
+
* Start recording the current page. Returns a teardown that stops capture
|
|
11
|
+
* and flushes the final buffer.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const stop = await fg.replay.start({ sampleRate: 1.0, maskAllInputs: true });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
start(options?: SessionReplayOptions): Promise<Teardown>;
|
|
19
|
+
/** Enable replay and start recording immediately. */
|
|
20
|
+
enable(options?: SessionReplayOptions): Promise<Teardown>;
|
|
21
|
+
/** Disable replay and stop any active recorder. */
|
|
22
|
+
disable(): void;
|
|
23
|
+
/** Stop the active recorder and flush a final chunk. */
|
|
24
|
+
stop(reason?: SessionReplayFlushReason): void;
|
|
25
|
+
/** Flush buffered events without stopping recording. */
|
|
26
|
+
flush(reason?: SessionReplayFlushReason): Promise<void>;
|
|
27
|
+
/** Bind a known user ID to subsequent replay chunks. */
|
|
28
|
+
identify(userId: string): void;
|
|
29
|
+
/** Read recorder lifecycle and health state. */
|
|
30
|
+
status(): SessionReplayStatus;
|
|
31
|
+
/** Send a pre-recorded rrweb chunk for custom recorder integrations. */
|
|
32
|
+
sendChunk(sessionId: string, events: unknown[], options?: Parameters<SessionReplay["sendChunk"]>[2]): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
export type { SessionReplayFlushMetadata, SessionReplayFlushReason, SessionReplayOptions, SessionReplayStatus };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export class ReplayTracker {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Start recording the current page. Returns a teardown that stops capture
|
|
7
|
+
* and flushes the final buffer.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const stop = await fg.replay.start({ sampleRate: 1.0, maskAllInputs: true });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
start(options) {
|
|
15
|
+
return this.client.start(options ?? {});
|
|
16
|
+
}
|
|
17
|
+
/** Enable replay and start recording immediately. */
|
|
18
|
+
enable(options) {
|
|
19
|
+
return this.client.enable(options ?? {});
|
|
20
|
+
}
|
|
21
|
+
/** Disable replay and stop any active recorder. */
|
|
22
|
+
disable() {
|
|
23
|
+
this.client.disable();
|
|
24
|
+
}
|
|
25
|
+
/** Stop the active recorder and flush a final chunk. */
|
|
26
|
+
stop(reason) {
|
|
27
|
+
this.client.stop(reason);
|
|
28
|
+
}
|
|
29
|
+
/** Flush buffered events without stopping recording. */
|
|
30
|
+
flush(reason) {
|
|
31
|
+
return this.client.flush(reason ?? "manual");
|
|
32
|
+
}
|
|
33
|
+
/** Bind a known user ID to subsequent replay chunks. */
|
|
34
|
+
identify(userId) {
|
|
35
|
+
this.client.identify(userId);
|
|
36
|
+
}
|
|
37
|
+
/** Read recorder lifecycle and health state. */
|
|
38
|
+
status() {
|
|
39
|
+
return this.client.getStatus();
|
|
40
|
+
}
|
|
41
|
+
/** Send a pre-recorded rrweb chunk for custom recorder integrations. */
|
|
42
|
+
sendChunk(sessionId, events, options) {
|
|
43
|
+
return this.client.sendChunk(sessionId, events, options ?? {});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=replay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay.js","sourceRoot":"","sources":["../../../../src/lib/tracking/analytics/replay.ts"],"names":[],"mappings":"AAYA,MAAM,OAAO,aAAa;IACxB,YAA4B,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAErD;;;;;;;;OAQG;IACH,KAAK,CAAC,OAA8B;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,qDAAqD;IACrD,MAAM,CAAC,OAA8B;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,mDAAmD;IACnD,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,wDAAwD;IACxD,IAAI,CAAC,MAAiC;QACpC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,wDAAwD;IACxD,KAAK,CAAC,MAAiC;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED,wDAAwD;IACxD,QAAQ,CAAC,MAAc;QACrB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,gDAAgD;IAChD,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IACjC,CAAC;IAED,wEAAwE;IACxE,SAAS,CACP,SAAiB,EACjB,MAAiB,EACjB,OAAmD;QAEnD,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IACjE,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retention shortcuts.
|
|
3
|
+
*/
|
|
4
|
+
import { Retention } from "../../features/analytics/retention";
|
|
5
|
+
export declare class RetentionTracker {
|
|
6
|
+
readonly client: Retention;
|
|
7
|
+
constructor(client: Retention);
|
|
8
|
+
/** Record that a user was active. */
|
|
9
|
+
active(userId: string, properties?: Record<string, unknown>): Promise<import("../../features/analytics/retention").ActivityResponse>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class RetentionTracker {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
/** Record that a user was active. */
|
|
6
|
+
active(userId, properties) {
|
|
7
|
+
return this.client.trackActivity({ userId, properties });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=retention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retention.js","sourceRoot":"","sources":["../../../../src/lib/tracking/analytics/retention.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,gBAAgB;IAC3B,YAA4B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAEjD,qCAAqC;IACrC,MAAM,CAAC,MAAc,EAAE,UAAoC;QACzD,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session lifecycle shortcuts.
|
|
3
|
+
*/
|
|
4
|
+
import { Sessions } from "../../features/analytics/sessions";
|
|
5
|
+
export declare class SessionTracker {
|
|
6
|
+
readonly client: Sessions;
|
|
7
|
+
constructor(client: Sessions);
|
|
8
|
+
/** Start a new session. */
|
|
9
|
+
start(opts?: Parameters<Sessions["start"]>[0]): Promise<import("../../features/analytics/sessions").SessionResponse>;
|
|
10
|
+
/** Update an active session with new properties. */
|
|
11
|
+
update(sessionId: string, properties: Record<string, unknown>): Promise<import("../../features/analytics/sessions").SessionResponse>;
|
|
12
|
+
/** End a session. */
|
|
13
|
+
end(sessionId: string): Promise<import("../../features/analytics/sessions").SessionEndResponse>;
|
|
14
|
+
/** Heartbeat to keep a session alive. */
|
|
15
|
+
heartbeat(sessionId: string): Promise<import("../../features/analytics/sessions").SessionResponse>;
|
|
16
|
+
/** Auto-manage browser session lifecycle (start, heartbeat, end on pagehide). */
|
|
17
|
+
autoTrack(config?: Parameters<Sessions["autoTrack"]>[0], options?: {
|
|
18
|
+
heartbeatMs?: number;
|
|
19
|
+
}): import("../../utils/browser").Teardown;
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class SessionTracker {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
/** Start a new session. */
|
|
6
|
+
start(opts) {
|
|
7
|
+
return this.client.start(opts);
|
|
8
|
+
}
|
|
9
|
+
/** Update an active session with new properties. */
|
|
10
|
+
update(sessionId, properties) {
|
|
11
|
+
return this.client.update(sessionId, properties);
|
|
12
|
+
}
|
|
13
|
+
/** End a session. */
|
|
14
|
+
end(sessionId) {
|
|
15
|
+
return this.client.end(sessionId);
|
|
16
|
+
}
|
|
17
|
+
/** Heartbeat to keep a session alive. */
|
|
18
|
+
heartbeat(sessionId) {
|
|
19
|
+
return this.client.heartbeat(sessionId);
|
|
20
|
+
}
|
|
21
|
+
/** Auto-manage browser session lifecycle (start, heartbeat, end on pagehide). */
|
|
22
|
+
autoTrack(config, options) {
|
|
23
|
+
return this.client.autoTrack(config, options);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=sessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../../../src/lib/tracking/analytics/sessions.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,cAAc;IACzB,YAA4B,MAAgB;QAAhB,WAAM,GAAN,MAAM,CAAU;IAAG,CAAC;IAEhD,2BAA2B;IAC3B,KAAK,CAAC,IAAuC;QAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,oDAAoD;IACpD,MAAM,CAAC,SAAiB,EAAE,UAAmC;QAC3D,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACnD,CAAC;IAED,qBAAqB;IACrB,GAAG,CAAC,SAAiB;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,yCAAyC;IACzC,SAAS,CAAC,SAAiB;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED,iFAAiF;IACjF,SAAS,CAAC,MAA6C,EAAE,OAAkC;QACzF,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Activation shortcuts — one helper per event, positional args, sensible defaults.
|
|
3
|
+
* Underlying class accessible via `.client`.
|
|
4
|
+
*/
|
|
5
|
+
import { Activation } from "../../features/core/activation";
|
|
6
|
+
export declare class ActivationTracker {
|
|
7
|
+
readonly client: Activation;
|
|
8
|
+
constructor(client: Activation);
|
|
9
|
+
/** New user signup. */
|
|
10
|
+
signup(userId: string, method: string, source?: string, props?: Record<string, unknown>): Promise<import("../../features/core/activation").ActivationResponse>;
|
|
11
|
+
/** Step in an onboarding flow (e.g. `step 2 of 5`). */
|
|
12
|
+
onboardingStep(userId: string, stepId: string, stepName: string, stepOrder: number, totalSteps: number, extra?: {
|
|
13
|
+
skipped?: boolean;
|
|
14
|
+
timeSpent?: number;
|
|
15
|
+
properties?: Record<string, unknown>;
|
|
16
|
+
}): Promise<import("../../features/core/activation").ActivationResponse>;
|
|
17
|
+
/** All onboarding steps finished. */
|
|
18
|
+
onboardingComplete(userId: string, totalTimeSpent: number, stepsCompleted: number, stepsSkipped?: number): Promise<import("../../features/core/activation").ActivationResponse>;
|
|
19
|
+
/** First meaningful action after signup ("aha" moment). */
|
|
20
|
+
firstAction(userId: string, actionName: string, timeSinceSignup: number, properties?: Record<string, unknown>): Promise<import("../../features/core/activation").ActivationResponse>;
|
|
21
|
+
/** Generic activation event. */
|
|
22
|
+
event(eventName: string, properties?: Record<string, unknown>): Promise<import("../../features/core/activation").ActivationResponse>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export class ActivationTracker {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
/** New user signup. */
|
|
6
|
+
signup(userId, method, source, props) {
|
|
7
|
+
return this.client.trackSignup(userId, method, source, props);
|
|
8
|
+
}
|
|
9
|
+
/** Step in an onboarding flow (e.g. `step 2 of 5`). */
|
|
10
|
+
onboardingStep(userId, stepId, stepName, stepOrder, totalSteps, extra) {
|
|
11
|
+
return this.client.trackOnboardingStep({
|
|
12
|
+
userId,
|
|
13
|
+
stepId,
|
|
14
|
+
stepName,
|
|
15
|
+
stepOrder,
|
|
16
|
+
totalSteps,
|
|
17
|
+
...extra,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** All onboarding steps finished. */
|
|
21
|
+
onboardingComplete(userId, totalTimeSpent, stepsCompleted, stepsSkipped = 0) {
|
|
22
|
+
return this.client.completeOnboarding(userId, totalTimeSpent, stepsCompleted, stepsSkipped);
|
|
23
|
+
}
|
|
24
|
+
/** First meaningful action after signup ("aha" moment). */
|
|
25
|
+
firstAction(userId, actionName, timeSinceSignup, properties) {
|
|
26
|
+
return this.client.trackFirstAction({ userId, actionName, timeSinceSignup, properties });
|
|
27
|
+
}
|
|
28
|
+
/** Generic activation event. */
|
|
29
|
+
event(eventName, properties = {}) {
|
|
30
|
+
return this.client.create({ eventName, properties });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=activation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activation.js","sourceRoot":"","sources":["../../../../src/lib/tracking/core/activation.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,iBAAiB;IAC5B,YAA4B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAElD,uBAAuB;IACvB,MAAM,CAAC,MAAc,EAAE,MAAc,EAAE,MAAe,EAAE,KAA+B;QACrF,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAChE,CAAC;IAED,uDAAuD;IACvD,cAAc,CACZ,MAAc,EACd,MAAc,EACd,QAAgB,EAChB,SAAiB,EACjB,UAAkB,EAClB,KAAuF;QAEvF,OAAO,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC;YACrC,MAAM;YACN,MAAM;YACN,QAAQ;YACR,SAAS;YACT,UAAU;YACV,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;IAED,qCAAqC;IACrC,kBAAkB,CAAC,MAAc,EAAE,cAAsB,EAAE,cAAsB,EAAE,YAAY,GAAG,CAAC;QACjG,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IAC9F,CAAC;IAED,2DAA2D;IAC3D,WAAW,CAAC,MAAc,EAAE,UAAkB,EAAE,eAAuB,EAAE,UAAoC;QAC3G,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,gCAAgC;IAChC,KAAK,CAAC,SAAiB,EAAE,aAAsC,EAAE;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;IACvD,CAAC;CAEF"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Experiment tracker — A/B testing API.
|
|
3
|
+
*
|
|
4
|
+
* Covers the full A/B test lifecycle:
|
|
5
|
+
* 1. `define()` — register an experiment (one-time admin setup).
|
|
6
|
+
* 2. `init()` — initialise the client-side engine (browser only).
|
|
7
|
+
* 3. `assign()` / `variant()` — get a user's variant.
|
|
8
|
+
* 4. `exposure()` — log that the user saw the assigned variant.
|
|
9
|
+
* 5. `conversion()` — log a success metric.
|
|
10
|
+
*
|
|
11
|
+
* The browser flow is the simplest:
|
|
12
|
+
* ```ts
|
|
13
|
+
* await fg.experiments.init([{ experimentId, variants: [...] }]);
|
|
14
|
+
* const variant = fg.experiments.variant(experimentId);
|
|
15
|
+
* if (variant === "B") renderNewCheckout();
|
|
16
|
+
* await fg.experiments.exposure(experimentId, userId, variant);
|
|
17
|
+
* // …user converts…
|
|
18
|
+
* await fg.experiments.conversion(experimentId, userId, variant, "purchase", 1);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
import { Experiment, ExperimentDefinition, ExperimentInitConfig } from "../../features/core/experiment";
|
|
22
|
+
import type { ServerCookieReader } from "../../utils/identity";
|
|
23
|
+
export declare class ExperimentTracker {
|
|
24
|
+
readonly client: Experiment;
|
|
25
|
+
constructor(client: Experiment);
|
|
26
|
+
/**
|
|
27
|
+
* Define an experiment. Run this once during admin setup.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* await fg.experiments.define({
|
|
32
|
+
* experimentId: "checkout_v2",
|
|
33
|
+
* name: "New checkout flow",
|
|
34
|
+
* variants: [
|
|
35
|
+
* { id: "control", weight: 50 },
|
|
36
|
+
* { id: "B", weight: 50 },
|
|
37
|
+
* ],
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
define(definition: ExperimentDefinition): Promise<import("../../features/core/experiment").ExperimentResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Initialise the client-side engine (browser only).
|
|
44
|
+
*
|
|
45
|
+
* Verifies experiments, performs weighted-random assignment, and
|
|
46
|
+
* persists assignments in `localStorage` so the same visitor always
|
|
47
|
+
* sees the same variant.
|
|
48
|
+
*/
|
|
49
|
+
init(experiments: ExperimentInitConfig[]): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Synchronously read the locally-cached variant assignment.
|
|
52
|
+
* Returns `null` if no assignment exists. Browser-only.
|
|
53
|
+
*/
|
|
54
|
+
variant(experimentId: string): string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Explicitly assign (or override) a user's variant. Use this for
|
|
57
|
+
* targeted assignments or admin overrides.
|
|
58
|
+
*/
|
|
59
|
+
assign(experimentId: string, userId: string, variantId: string, source?: "random" | "targeted" | "override"): Promise<import("../../features/core/experiment").ExperimentResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* Record that a user was exposed to (saw / used) their variant.
|
|
62
|
+
* Call this when the variant is rendered.
|
|
63
|
+
*/
|
|
64
|
+
exposure(experimentId: string, userId: string, variantId: string): Promise<import("../../features/core/experiment").ExperimentResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Record a conversion against a specific user's variant (server-side).
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* await fg.experiments.conversion("checkout_v2", "u_1", "B", "purchase", 49.99);
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
conversion(experimentId: string, userId: string, variantId: string, metricName: string, value?: number): Promise<import("../../features/core/experiment").ExperimentResponse>;
|
|
74
|
+
/**
|
|
75
|
+
* Browser-side conversion using the locally-cached variant assignment.
|
|
76
|
+
* No-op if the visitor has no assignment for this experiment.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* await fg.experiments.localConversion("checkout_v2", "purchase", 49.99);
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
localConversion(experimentId: string, metricName?: string, value?: number): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Hydrate assignments from a server cookie reader (Next.js `cookies()`,
|
|
86
|
+
* Nuxt `useCookie()`, etc.). Call this once per request before reading
|
|
87
|
+
* `variant()` server-side.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* import { cookies } from "next/headers";
|
|
92
|
+
* fg.experiments.hydrateFromCookies(cookies());
|
|
93
|
+
* const variant = fg.experiments.variant("checkout_v2");
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
hydrateFromCookies(reader: ServerCookieReader): void;
|
|
97
|
+
/**
|
|
98
|
+
* Hydrate assignments from a raw `Cookie` header (Workers, Bun, Hono, etc.).
|
|
99
|
+
*/
|
|
100
|
+
hydrateFromCookieHeader(cookieHeader: string | null | undefined): void;
|
|
101
|
+
/**
|
|
102
|
+
* Inject assignments resolved server-side. Use when the assignment was
|
|
103
|
+
* computed without a cookie (e.g. logged-in user fetched from DB).
|
|
104
|
+
*/
|
|
105
|
+
injectAssignments(assignments: Record<string, string>): void;
|
|
106
|
+
/**
|
|
107
|
+
* Snapshot of all known assignments. Useful for SSR payload hand-off.
|
|
108
|
+
*/
|
|
109
|
+
getAssignments(): Record<string, string>;
|
|
110
|
+
/**
|
|
111
|
+
* Build a `Set-Cookie` header value seeding the visitor's browser with
|
|
112
|
+
* the current assignment map.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* res.headers.set("Set-Cookie", fg.experiments.serializeAssignmentCookie());
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
serializeAssignmentCookie(): string;
|
|
120
|
+
/** Wipe all locally-cached assignments (cookie + localStorage). */
|
|
121
|
+
clearAssignments(): void;
|
|
122
|
+
}
|