UNPKG

1.76 kBTypeScriptView Raw
1import { ICredentials } from '@aws-amplify/core';
2/**
3 * Analytics instance options
4 */
5export interface AnalyticsOptions {
6 appId: string;
7 platform?: string;
8 clientId?: string;
9 region?: string;
10 credentials?: ICredentials;
11}
12export interface EventAttributes {
13 [key: string]: string;
14}
15export interface EventMetrics {
16 [key: string]: number;
17}
18export interface pageViewTrackOpts {
19 enable: boolean;
20 type?: string;
21 eventName?: string;
22 provider?: string;
23 attributes?: EventAttributes | (() => EventAttributes | Promise<EventAttributes>);
24 getUrl?: () => string;
25}
26export interface EventTrackOpts {
27 enable: boolean;
28 events?: Array<string>;
29 selectorPrefix?: string;
30 provider?: string;
31 attributes?: EventAttributes | (() => EventAttributes | Promise<EventAttributes>);
32}
33export interface SessionTrackOpts {
34 enable: boolean;
35 attributes?: EventAttributes | (() => EventAttributes | Promise<EventAttributes>);
36 provider?: string;
37}
38export declare type AutoTrackAttributes = (() => EventAttributes | Promise<EventAttributes>) | EventAttributes;
39export interface AutoTrackSessionOpts {
40 enable: boolean;
41 attributes?: AutoTrackAttributes;
42 provider?: string;
43}
44export interface AutoTrackPageViewOpts {
45 enable: boolean;
46 eventName?: string;
47 attributes?: AutoTrackAttributes;
48 type?: 'SPA' | 'multiPageApp';
49 provider?: string;
50 getUrl?: () => string;
51}
52export interface AutoTrackEventOpts {
53 enable: boolean;
54 events?: string[];
55 selectorPrefix?: string;
56 provider?: string;
57 attributes?: AutoTrackAttributes;
58}
59export interface AnalyticsEvent {
60 name: string;
61 attributes?: EventAttributes;
62 metrics?: EventMetrics;
63 immediate?: boolean;
64}