UNPKG

2.05 kBTypeScriptView Raw
1import { AnalyticsProvider, EventMetrics } from './types';
2/**
3 * Provide mobile analytics client functions
4 */
5export declare class AnalyticsClass {
6 private _config;
7 private _pluggables;
8 private _disabled;
9 private _trackers;
10 /**
11 * Initialize Analtyics
12 * @param config - Configuration of the Analytics
13 */
14 constructor();
15 getModuleName(): string;
16 /**
17 * configure Analytics
18 * @param {Object} config - Configuration of the Analytics
19 */
20 configure(config?: any): any;
21 /**
22 * add plugin into Analytics category
23 * @param {Object} pluggable - an instance of the plugin
24 */
25 addPluggable(pluggable: AnalyticsProvider): any;
26 /**
27 * Get the plugin object
28 * @param providerName - the name of the plugin
29 */
30 getPluggable(providerName: any): AnalyticsProvider;
31 /**
32 * Remove the plugin object
33 * @param providerName - the name of the plugin
34 */
35 removePluggable(providerName: any): void;
36 /**
37 * stop sending events
38 */
39 disable(): void;
40 /**
41 * start sending events
42 */
43 enable(): void;
44 /**
45 * Record Session start
46 * @return - A promise which resolves if buffer doesn't overflow
47 */
48 startSession(provider?: string): Promise<unknown>;
49 /**
50 * Record Session stop
51 * @return - A promise which resolves if buffer doesn't overflow
52 */
53 stopSession(provider?: string): Promise<unknown>;
54 /**
55 * Record one analytic event and send it to Pinpoint
56 * @param {String} name - The name of the event
57 * @param {Object} [attributes] - Attributes of the event
58 * @param {Object} [metrics] - Event metrics
59 * @return - A promise which resolves if buffer doesn't overflow
60 */
61 record(event: string | object, provider?: any, metrics?: EventMetrics): Promise<unknown>;
62 updateEndpoint(attrs: any, provider?: any): Promise<unknown>;
63 private _sendEvent;
64 autoTrack(trackerType: any, opts: any): void;
65}
66export declare const Analytics: AnalyticsClass;