flowgrid-sdk 1.2.0 → 1.3.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 +224 -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.d.ts +2 -2
- 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.d.ts +2 -2
- 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
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
49
|
import { FlowGridTransport } from "../../client/transport";
|
|
50
|
-
import { ClickEvent, FormEvent, SearchEvent, ErrorEvent, TimeSeriesData
|
|
50
|
+
import { ClickEvent, FormEvent, SearchEvent, ErrorEvent, TimeSeriesData } from "../../types";
|
|
51
51
|
/**
|
|
52
52
|
* Configuration for tracking a custom event.
|
|
53
53
|
*/
|
|
@@ -157,9 +157,6 @@ export interface EventAnalyticsData {
|
|
|
157
157
|
* label: 'export_pdf',
|
|
158
158
|
* properties: { format: 'A4', pages: 5 }
|
|
159
159
|
* });
|
|
160
|
-
*
|
|
161
|
-
* // Get event analytics
|
|
162
|
-
* const analytics = await events.getAnalytics({ range: 'last7days' });
|
|
163
160
|
* ```
|
|
164
161
|
*/
|
|
165
162
|
export declare class Events extends FlowGridTransport {
|
|
@@ -276,29 +273,5 @@ export declare class Events extends FlowGridTransport {
|
|
|
276
273
|
* ```
|
|
277
274
|
*/
|
|
278
275
|
trackError(config: ErrorEvent): Promise<EventResponse>;
|
|
279
|
-
/**
|
|
280
|
-
* Retrieves event analytics data for dashboards and charts.
|
|
281
|
-
*
|
|
282
|
-
* @param filter - Date range filter
|
|
283
|
-
* @param pagination - Pagination options
|
|
284
|
-
* @returns Promise resolving to event analytics
|
|
285
|
-
*
|
|
286
|
-
* @example
|
|
287
|
-
* ```typescript
|
|
288
|
-
* const analytics = await events.getAnalytics({
|
|
289
|
-
* range: 'last7days'
|
|
290
|
-
* });
|
|
291
|
-
*
|
|
292
|
-
* // Bar chart data - top events
|
|
293
|
-
* const barData = analytics.topEvents.map(e => ({
|
|
294
|
-
* x: e.eventName,
|
|
295
|
-
* y: e.count
|
|
296
|
-
* }));
|
|
297
|
-
*
|
|
298
|
-
* // Line chart - events over time
|
|
299
|
-
* const lineData = analytics.timeSeries.data;
|
|
300
|
-
* ```
|
|
301
|
-
*/
|
|
302
|
-
getAnalytics(filter?: DateRangeFilter, pagination?: PaginationParams): Promise<EventAnalyticsData>;
|
|
303
276
|
}
|
|
304
277
|
export default Events;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Product Analytics - Custom Event Tracking
|
|
3
|
+
* @module features/analytics/events
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Track custom events with flexible properties for any user action
|
|
7
|
+
* or system event. Supports categorization, value tracking, and batching.
|
|
8
|
+
*
|
|
9
|
+
* @useCases
|
|
10
|
+
* - Track button clicks and CTA interactions
|
|
11
|
+
* - Monitor feature usage and engagement
|
|
12
|
+
* - Capture form submissions and errors
|
|
13
|
+
* - Log search queries and results
|
|
14
|
+
* - Record video/audio playback events
|
|
15
|
+
*
|
|
16
|
+
* @metrics
|
|
17
|
+
* - Event counts by type
|
|
18
|
+
* - Event trends over time
|
|
19
|
+
* - Unique users per event
|
|
20
|
+
* - Event value aggregations
|
|
21
|
+
* - Event-to-conversion correlation
|
|
22
|
+
*
|
|
23
|
+
* @chartData
|
|
24
|
+
* - Bar chart: Top events by count
|
|
25
|
+
* - Line chart: Event trends over time
|
|
26
|
+
* - Heatmap: Events by hour/day
|
|
27
|
+
* - Sankey: Event flow paths
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const events = new Events(webId, endpoint, apiKey);
|
|
32
|
+
*
|
|
33
|
+
* // Track a button click
|
|
34
|
+
* await events.track({
|
|
35
|
+
* eventName: 'cta_clicked',
|
|
36
|
+
* category: 'engagement',
|
|
37
|
+
* action: 'click',
|
|
38
|
+
* label: 'signup_hero'
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* // Track with value
|
|
42
|
+
* await events.track({
|
|
43
|
+
* eventName: 'video_watched',
|
|
44
|
+
* value: 120, // seconds
|
|
45
|
+
* properties: { videoId: 'intro-video' }
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// EVENTS CLASS
|
|
52
|
+
// ============================================================================
|
|
53
|
+
/**
|
|
54
|
+
* Events - Track and analyze custom events.
|
|
55
|
+
*
|
|
56
|
+
* @extends FlowGridTransport
|
|
57
|
+
*
|
|
58
|
+
* @description
|
|
59
|
+
* Provides flexible custom event tracking including:
|
|
60
|
+
* - Standard event tracking with categories
|
|
61
|
+
* - Click and interaction tracking
|
|
62
|
+
* - Form submission tracking
|
|
63
|
+
* - Search event tracking
|
|
64
|
+
* - Error and exception logging
|
|
65
|
+
* - Batch event submission
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const events = new Events(webId, endpoint, apiKey);
|
|
70
|
+
*
|
|
71
|
+
* // Track feature usage
|
|
72
|
+
* await events.track({
|
|
73
|
+
* eventName: 'feature_used',
|
|
74
|
+
* category: 'features',
|
|
75
|
+
* action: 'use',
|
|
76
|
+
* label: 'export_pdf',
|
|
77
|
+
* properties: { format: 'A4', pages: 5 }
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export class Events extends FlowGridTransport {
|
|
82
|
+
/**
|
|
83
|
+
* Tracks a custom event.
|
|
84
|
+
*
|
|
85
|
+
* @param config - Event configuration
|
|
86
|
+
* @returns Promise resolving to event response
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* await events.track({
|
|
91
|
+
* eventName: 'upgrade_clicked',
|
|
92
|
+
* category: 'monetization',
|
|
93
|
+
* action: 'click',
|
|
94
|
+
* label: 'pricing_page',
|
|
95
|
+
* value: 99.99
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
async track(config) {
|
|
100
|
+
return await this.init("custom_event", {
|
|
101
|
+
type: "custom_event",
|
|
102
|
+
eventName: config.eventName,
|
|
103
|
+
category: config.category || "general",
|
|
104
|
+
action: config.action,
|
|
105
|
+
label: config.label,
|
|
106
|
+
value: config.value,
|
|
107
|
+
nonInteraction: config.nonInteraction || false,
|
|
108
|
+
userId: config.userId,
|
|
109
|
+
sessionId: config.sessionId,
|
|
110
|
+
...config.properties,
|
|
111
|
+
timestamp: new Date().toISOString()
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Tracks multiple events in a single request.
|
|
116
|
+
*
|
|
117
|
+
* @param config - Batch configuration with events array
|
|
118
|
+
* @returns Promise resolving to batch response
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* await events.trackBatch({
|
|
123
|
+
* events: [
|
|
124
|
+
* { eventName: 'step_1_complete', category: 'onboarding' },
|
|
125
|
+
* { eventName: 'step_2_complete', category: 'onboarding' },
|
|
126
|
+
* { eventName: 'step_3_complete', category: 'onboarding' }
|
|
127
|
+
* ]
|
|
128
|
+
* });
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
async trackBatch(config) {
|
|
132
|
+
const events = config.events.map(e => ({
|
|
133
|
+
...e,
|
|
134
|
+
timestamp: new Date().toISOString()
|
|
135
|
+
}));
|
|
136
|
+
return await this.init("batch_events", {
|
|
137
|
+
type: "batch_events",
|
|
138
|
+
events,
|
|
139
|
+
count: events.length,
|
|
140
|
+
timestamp: new Date().toISOString()
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Tracks a click/interaction event.
|
|
145
|
+
*
|
|
146
|
+
* @param config - Click event configuration
|
|
147
|
+
* @returns Promise resolving to event response
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* document.addEventListener('click', (e) => {
|
|
152
|
+
* if (e.target.dataset.track) {
|
|
153
|
+
* events.trackClick({
|
|
154
|
+
* elementId: e.target.id,
|
|
155
|
+
* elementText: e.target.textContent,
|
|
156
|
+
* targetUrl: e.target.href
|
|
157
|
+
* });
|
|
158
|
+
* }
|
|
159
|
+
* });
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
async trackClick(config) {
|
|
163
|
+
return await this.init("click_event", {
|
|
164
|
+
type: "click_event",
|
|
165
|
+
...config,
|
|
166
|
+
timestamp: new Date().toISOString()
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Tracks a form submission event.
|
|
171
|
+
*
|
|
172
|
+
* @param config - Form event configuration
|
|
173
|
+
* @returns Promise resolving to event response
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```typescript
|
|
177
|
+
* form.addEventListener('submit', async (e) => {
|
|
178
|
+
* await events.trackForm({
|
|
179
|
+
* formId: 'contact-form',
|
|
180
|
+
* formName: 'Contact Us',
|
|
181
|
+
* success: true,
|
|
182
|
+
* fields: ['name', 'email', 'message'],
|
|
183
|
+
* completionTime: 45
|
|
184
|
+
* });
|
|
185
|
+
* });
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
async trackForm(config) {
|
|
189
|
+
return await this.init("form_event", {
|
|
190
|
+
type: "form_event",
|
|
191
|
+
...config,
|
|
192
|
+
timestamp: new Date().toISOString()
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Tracks a search event.
|
|
197
|
+
*
|
|
198
|
+
* @param config - Search event configuration
|
|
199
|
+
* @returns Promise resolving to event response
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* await events.trackSearch({
|
|
204
|
+
* query: 'wireless headphones',
|
|
205
|
+
* category: 'products',
|
|
206
|
+
* resultsCount: 42,
|
|
207
|
+
* filters: { brand: 'Sony', priceRange: '100-200' }
|
|
208
|
+
* });
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
async trackSearch(config) {
|
|
212
|
+
return await this.init("search_event", {
|
|
213
|
+
type: "search_event",
|
|
214
|
+
query: config.query,
|
|
215
|
+
category: config.category,
|
|
216
|
+
resultsCount: config.resultsCount,
|
|
217
|
+
resultClicked: config.resultClicked,
|
|
218
|
+
clickedPosition: config.clickedPosition,
|
|
219
|
+
filters: config.filters,
|
|
220
|
+
timestamp: new Date().toISOString()
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Tracks an error or exception.
|
|
225
|
+
*
|
|
226
|
+
* @param config - Error event configuration
|
|
227
|
+
* @returns Promise resolving to event response
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```typescript
|
|
231
|
+
* window.onerror = (message, source, line, col, error) => {
|
|
232
|
+
* events.trackError({
|
|
233
|
+
* message: message.toString(),
|
|
234
|
+
* stack: error?.stack,
|
|
235
|
+
* type: error?.name,
|
|
236
|
+
* fatal: false,
|
|
237
|
+
* context: source
|
|
238
|
+
* });
|
|
239
|
+
* };
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
async trackError(config) {
|
|
243
|
+
return await this.init("error_event", {
|
|
244
|
+
type: "error_event",
|
|
245
|
+
message: config.message,
|
|
246
|
+
stack: config.stack,
|
|
247
|
+
errorType: config.type,
|
|
248
|
+
fatal: config.fatal || false,
|
|
249
|
+
context: config.context,
|
|
250
|
+
userAction: config.userAction,
|
|
251
|
+
timestamp: new Date().toISOString()
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
export default Events;
|
|
256
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../src/lib/features/analytics/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAyG3D,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,MAAO,SAAQ,iBAAiB;IAC3C;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,KAAK,CAAC,MAAwB;QAClC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACrC,IAAI,EAAE,cAAc;YACpB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,SAAS;YACtC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,KAAK;YAC9C,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,GAAG,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AK;YACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,UAAU,CAAC,MAAkB;QACjC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACpC,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,SAAS,EAAE,MAAM,CAAC,IAAI;YACtB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,KAAK;YAC5B,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;CAEF;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Product Analytics - Funnel Analysis
|
|
3
|
+
* @module features/analytics/funnels
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Define and analyze conversion funnels to understand user journeys,
|
|
7
|
+
* identify drop-off points, and optimize conversion rates.
|
|
8
|
+
*
|
|
9
|
+
* @useCases
|
|
10
|
+
* - Track signup/onboarding completion rates
|
|
11
|
+
* - Analyze checkout funnel performance
|
|
12
|
+
* - Identify where users drop off in key flows
|
|
13
|
+
* - Compare funnel performance across segments
|
|
14
|
+
* - A/B test different funnel variations
|
|
15
|
+
*
|
|
16
|
+
* @metrics
|
|
17
|
+
* - Step-by-step conversion rates
|
|
18
|
+
* - Drop-off rates at each step
|
|
19
|
+
* - Time to complete each step
|
|
20
|
+
* - Overall funnel conversion rate
|
|
21
|
+
* - Funnel completion time
|
|
22
|
+
*
|
|
23
|
+
* @chartData
|
|
24
|
+
* - Funnel chart: Step-by-step visualization
|
|
25
|
+
* - Bar chart: Conversion by step
|
|
26
|
+
* - Line chart: Funnel performance over time
|
|
27
|
+
* - Comparison: Funnel variants side-by-side
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const funnels = new Funnels(webId, endpoint, apiKey);
|
|
32
|
+
*
|
|
33
|
+
* // Track funnel step
|
|
34
|
+
* await funnels.trackStep({
|
|
35
|
+
* funnelId: 'checkout_funnel',
|
|
36
|
+
* step: 'add_payment',
|
|
37
|
+
* stepNumber: 3,
|
|
38
|
+
* userId: 'user_123'
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* // Get funnel analysis
|
|
42
|
+
* const analysis = await funnels.analyze('checkout_funnel');
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// FUNNELS CLASS
|
|
48
|
+
// ============================================================================
|
|
49
|
+
/**
|
|
50
|
+
* Funnels - Define and analyze conversion funnels.
|
|
51
|
+
*
|
|
52
|
+
* @extends FlowGridTransport
|
|
53
|
+
*
|
|
54
|
+
* @description
|
|
55
|
+
* Provides funnel analysis capabilities including:
|
|
56
|
+
* - Funnel definition and management
|
|
57
|
+
* - Step-by-step event tracking
|
|
58
|
+
* - Conversion and drop-off analysis
|
|
59
|
+
* - Time-to-completion tracking
|
|
60
|
+
* - Segment-based funnel comparison
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const funnels = new Funnels(webId, endpoint, apiKey);
|
|
65
|
+
*
|
|
66
|
+
* // Define a signup funnel
|
|
67
|
+
* await funnels.define({
|
|
68
|
+
* funnelId: 'signup_funnel',
|
|
69
|
+
* name: 'User Signup',
|
|
70
|
+
* steps: [
|
|
71
|
+
* { name: 'Visit Landing', events: ['page_view_landing'] },
|
|
72
|
+
* { name: 'Click Signup', events: ['signup_clicked'] },
|
|
73
|
+
* { name: 'Submit Form', events: ['signup_submitted'] },
|
|
74
|
+
* { name: 'Verify Email', events: ['email_verified'] }
|
|
75
|
+
* ]
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* // Analyze funnel performance
|
|
79
|
+
* const analysis = await funnels.analyze('signup_funnel', {
|
|
80
|
+
* range: 'last30days'
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export class Funnels extends FlowGridTransport {
|
|
85
|
+
/**
|
|
86
|
+
* Defines a new funnel or updates existing.
|
|
87
|
+
*
|
|
88
|
+
* @param config - Funnel definition
|
|
89
|
+
* @returns Promise resolving to definition response
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* await funnels.define({
|
|
94
|
+
* funnelId: 'checkout_funnel',
|
|
95
|
+
* name: 'Checkout Flow',
|
|
96
|
+
* steps: [
|
|
97
|
+
* { name: 'View Cart', events: ['view_cart'] },
|
|
98
|
+
* { name: 'Begin Checkout', events: ['begin_checkout'] },
|
|
99
|
+
* { name: 'Add Shipping', events: ['add_shipping_info'] },
|
|
100
|
+
* { name: 'Add Payment', events: ['add_payment_info'] },
|
|
101
|
+
* { name: 'Purchase', events: ['purchase'] }
|
|
102
|
+
* ]
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
async define(config) {
|
|
107
|
+
return await this.init("define_funnel", {
|
|
108
|
+
type: "define_funnel",
|
|
109
|
+
funnelId: config.funnelId,
|
|
110
|
+
name: config.name,
|
|
111
|
+
description: config.description,
|
|
112
|
+
steps: config.steps,
|
|
113
|
+
timestamp: new Date().toISOString()
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Tracks a funnel step completion.
|
|
118
|
+
*
|
|
119
|
+
* @param config - Funnel step configuration
|
|
120
|
+
* @returns Promise resolving to step response
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* // Track user progressing through checkout
|
|
125
|
+
* await funnels.trackStep({
|
|
126
|
+
* funnelId: 'checkout_funnel',
|
|
127
|
+
* step: 'add_shipping_info',
|
|
128
|
+
* stepNumber: 3,
|
|
129
|
+
* userId: 'user_123',
|
|
130
|
+
* properties: { shippingMethod: 'express' }
|
|
131
|
+
* });
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
async trackStep(config) {
|
|
135
|
+
return await this.init("funnel_step", {
|
|
136
|
+
type: "funnel_step",
|
|
137
|
+
funnelId: config.funnelId,
|
|
138
|
+
step: config.step,
|
|
139
|
+
stepNumber: config.stepNumber,
|
|
140
|
+
userId: config.userId,
|
|
141
|
+
sessionId: config.sessionId,
|
|
142
|
+
...config.properties,
|
|
143
|
+
timestamp: new Date().toISOString()
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Tracks funnel completion.
|
|
148
|
+
*
|
|
149
|
+
* @param funnelId - Funnel identifier
|
|
150
|
+
* @param userId - User who completed
|
|
151
|
+
* @param properties - Completion properties
|
|
152
|
+
* @returns Promise resolving to completion response
|
|
153
|
+
*/
|
|
154
|
+
async trackComplete(funnelId, userId, properties) {
|
|
155
|
+
return await this.init("funnel_complete", {
|
|
156
|
+
type: "funnel_complete",
|
|
157
|
+
funnelId,
|
|
158
|
+
userId,
|
|
159
|
+
...properties,
|
|
160
|
+
timestamp: new Date().toISOString()
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Tracks funnel abandonment.
|
|
165
|
+
*
|
|
166
|
+
* @param funnelId - Funnel identifier
|
|
167
|
+
* @param lastStep - Last completed step
|
|
168
|
+
* @param userId - User who abandoned
|
|
169
|
+
* @param reason - Optional abandonment reason
|
|
170
|
+
* @returns Promise resolving to abandonment response
|
|
171
|
+
*/
|
|
172
|
+
async trackAbandon(funnelId, lastStep, userId, reason) {
|
|
173
|
+
return await this.init("funnel_abandon", {
|
|
174
|
+
type: "funnel_abandon",
|
|
175
|
+
funnelId,
|
|
176
|
+
lastStep,
|
|
177
|
+
userId,
|
|
178
|
+
reason,
|
|
179
|
+
timestamp: new Date().toISOString()
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Analyzes funnel performance.
|
|
184
|
+
*
|
|
185
|
+
* @param funnelId - Funnel identifier
|
|
186
|
+
* @param filter - Date range filter
|
|
187
|
+
* @returns Promise resolving to funnel analytics
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* const analysis = await funnels.analyze('checkout_funnel', {
|
|
192
|
+
* range: 'last7days'
|
|
193
|
+
* });
|
|
194
|
+
*
|
|
195
|
+
* // Funnel visualization data
|
|
196
|
+
* const funnelData = analysis.visualization.map(step => ({
|
|
197
|
+
* name: step.step,
|
|
198
|
+
* value: step.entered,
|
|
199
|
+
* conversion: step.conversionRate
|
|
200
|
+
* }));
|
|
201
|
+
*
|
|
202
|
+
* // Overall conversion rate
|
|
203
|
+
* console.log(`Conversion: ${analysis.analysis.overallConversionRate}%`);
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
async analyze(funnelId, filter) {
|
|
207
|
+
return await this.init("analyze_funnel", {
|
|
208
|
+
type: "query",
|
|
209
|
+
funnelId,
|
|
210
|
+
filter: filter || { range: "last30days" },
|
|
211
|
+
timestamp: new Date().toISOString()
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Compares two funnel periods or segments.
|
|
216
|
+
*
|
|
217
|
+
* @param funnelId - Funnel identifier
|
|
218
|
+
* @param baselineFilter - Baseline period filter
|
|
219
|
+
* @param comparisonFilter - Comparison period filter
|
|
220
|
+
* @returns Promise resolving to comparison data
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* const comparison = await funnels.compare(
|
|
225
|
+
* 'checkout_funnel',
|
|
226
|
+
* { range: 'last30days' },
|
|
227
|
+
* { range: 'last60days' }
|
|
228
|
+
* );
|
|
229
|
+
*
|
|
230
|
+
* // Side-by-side comparison chart
|
|
231
|
+
* const comparisonData = comparison.stepComparison.map(s => ({
|
|
232
|
+
* step: s.step,
|
|
233
|
+
* baseline: s.baselineRate,
|
|
234
|
+
* comparison: s.comparisonRate
|
|
235
|
+
* }));
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
async compare(funnelId, baselineFilter, comparisonFilter) {
|
|
239
|
+
return await this.init("compare_funnel", {
|
|
240
|
+
type: "query",
|
|
241
|
+
funnelId,
|
|
242
|
+
baselineFilter,
|
|
243
|
+
comparisonFilter,
|
|
244
|
+
timestamp: new Date().toISOString()
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Lists all defined funnels.
|
|
249
|
+
*
|
|
250
|
+
* @returns Promise resolving to funnel list
|
|
251
|
+
*/
|
|
252
|
+
async list() {
|
|
253
|
+
return await this.init("list_funnels", {
|
|
254
|
+
type: "query",
|
|
255
|
+
timestamp: new Date().toISOString()
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
export default Funnels;
|
|
260
|
+
//# sourceMappingURL=funnels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"funnels.js","sourceRoot":"","sources":["../../../../src/lib/features/analytics/funnels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AA4G3D,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E;;;;;;;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|
+
import { Teardown } from "../../utils/browser";
|
|
45
45
|
/**
|
|
46
46
|
* Click interaction data.
|
|
47
47
|
*/
|
|
@@ -229,25 +229,18 @@ export declare class Heatmaps extends FlowGridTransport {
|
|
|
229
229
|
*/
|
|
230
230
|
trackRageClick(pageUrl: string, x: number, y: number, clickCount: number): Promise<HeatmapResponse>;
|
|
231
231
|
/**
|
|
232
|
-
*
|
|
232
|
+
* Auto-collect heatmap interactions: clicks (with element selector + text)
|
|
233
|
+
* and scroll depth on the current page. Mouse-move tracking is opt-in
|
|
234
|
+
* because the volume can be very high.
|
|
233
235
|
*
|
|
234
|
-
* @param
|
|
235
|
-
* @param
|
|
236
|
-
* @returns
|
|
237
|
-
*
|
|
238
|
-
* @example
|
|
239
|
-
* ```typescript
|
|
240
|
-
* const data = await heatmaps.getData('/pricing', {
|
|
241
|
-
* range: 'last7days'
|
|
242
|
-
* });
|
|
243
|
-
*
|
|
244
|
-
* // Render click heatmap
|
|
245
|
-
* renderHeatmap(data.clicks);
|
|
246
|
-
*
|
|
247
|
-
* // Render scroll map
|
|
248
|
-
* renderScrollMap(data.scrollDepth);
|
|
249
|
-
* ```
|
|
236
|
+
* @param options.movement Subscribe to throttled mousemove sampling.
|
|
237
|
+
* @param options.userId Attached to every event.
|
|
238
|
+
* @returns Teardown function detaching all listeners.
|
|
250
239
|
*/
|
|
251
|
-
|
|
240
|
+
autoTrack(options?: {
|
|
241
|
+
movement?: boolean;
|
|
242
|
+
userId?: string;
|
|
243
|
+
sessionId?: string;
|
|
244
|
+
}): Teardown;
|
|
252
245
|
}
|
|
253
246
|
export default Heatmaps;
|