1 | import { AnalyticsProvider, EventAttributes, EventMetrics, AnalyticsEvent, AutoTrackSessionOpts, AutoTrackPageViewOpts, AutoTrackEventOpts } from './types';
|
2 | import { PageViewTracker, EventTracker, SessionTracker } from './trackers';
|
3 | declare const trackers: {
|
4 | pageView: typeof PageViewTracker;
|
5 | event: typeof EventTracker;
|
6 | session: typeof SessionTracker;
|
7 | };
|
8 | declare type TrackerTypes = keyof typeof trackers;
|
9 | /**
|
10 | * Provide mobile analytics client functions
|
11 | */
|
12 | export declare class AnalyticsClass {
|
13 | private _config;
|
14 | private _pluggables;
|
15 | private _disabled;
|
16 | private _trackers;
|
17 | /**
|
18 | * Initialize Analtyics
|
19 | * @param config - Configuration of the Analytics
|
20 | */
|
21 | constructor();
|
22 | getModuleName(): string;
|
23 | /**
|
24 | * configure Analytics
|
25 | * @param {Object} config - Configuration of the Analytics
|
26 | */
|
27 | configure(config?: any): any;
|
28 | /**
|
29 | * add plugin into Analytics category
|
30 | * @param pluggable - an instance of the plugin
|
31 | */
|
32 | addPluggable(pluggable: AnalyticsProvider): any;
|
33 | /**
|
34 | * Get the plugin object
|
35 | * @param providerName - the name of the provider to be removed
|
36 | */
|
37 | getPluggable(providerName: string): AnalyticsProvider;
|
38 | /**
|
39 | * Remove the plugin object
|
40 | * @param providerName - the name of the provider to be removed
|
41 | */
|
42 | removePluggable(providerName: string): void;
|
43 | /**
|
44 | * stop sending events
|
45 | */
|
46 | disable(): void;
|
47 | /**
|
48 | * start sending events
|
49 | */
|
50 | enable(): void;
|
51 | /**
|
52 | * Record Session start
|
53 | * @param [provider] - name of the provider.
|
54 | * @return - A promise which resolves if buffer doesn't overflow
|
55 | */
|
56 | startSession(provider?: string): Promise<unknown>;
|
57 | /**
|
58 | * Record Session stop
|
59 | * @param [provider] - name of the provider.
|
60 | * @return - A promise which resolves if buffer doesn't overflow
|
61 | */
|
62 | stopSession(provider?: string): Promise<unknown>;
|
63 | /**
|
64 | * Record one analytic event and send it to Pinpoint
|
65 | * @param event - An object with the name of the event, attributes of the event and event metrics.
|
66 | * @param [provider] - name of the provider.
|
67 | */
|
68 | record(event: AnalyticsEvent, provider?: string): any;
|
69 | /**
|
70 | * Record one analytic event and send it to Pinpoint
|
71 | * @deprecated Use the new syntax and pass in the event as an object instead.
|
72 | * @param eventName - The name of the event
|
73 | * @param [attributes] - Attributes of the event
|
74 | * @param [metrics] - Event metrics
|
75 | * @return - A promise which resolves if buffer doesn't overflow
|
76 | */
|
77 | record(eventName: string, attributes?: EventAttributes, metrics?: EventMetrics): any;
|
78 | updateEndpoint(attrs: {
|
79 | [key: string]: any;
|
80 | }, provider?: string): Promise<any>;
|
81 | private _sendEvent;
|
82 | /**
|
83 | * Enable or disable auto tracking
|
84 | * @param trackerType - The type of tracker to activate.
|
85 | * @param [opts] - Auto tracking options.
|
86 | */
|
87 | autoTrack(trackerType: 'session', opts: AutoTrackSessionOpts): any;
|
88 | autoTrack(trackerType: 'pageView', opts: AutoTrackPageViewOpts): any;
|
89 | autoTrack(trackerType: 'event', opts: AutoTrackEventOpts): any;
|
90 | autoTrack(trackerType: TrackerTypes, opts: {
|
91 | provider: string;
|
92 | [key: string]: any;
|
93 | }): any;
|
94 | }
|
95 | export declare const Analytics: AnalyticsClass;
|
96 | export {};
|