forked from MatteoGabriele/vue-analytics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue-analytics.d.ts
132 lines (122 loc) · 3.28 KB
/
vue-analytics.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
declare module 'vue-analytics' {
import _Vue, { PluginFunction } from 'vue';
import VueRouter, { Route } from 'vue-router';
interface eventFn {
(category: string, action?: string, label?: string, value?: number): void;
(options: {
eventCategory: string,
eventAction?: string,
eventLabel?: string,
eventValue?: number
}): void;
}
type pageDetails = {
page: string,
title: string,
location: string
};
interface pageFn {
(path: string): void;
(options: pageDetails): void;
(route: VueRouter): void;
}
interface setFn {
(fieldName: string, fieldValue: string): void;
(options: {
field: string, value: string
}): void;
}
interface socialFn {
(network: string, action: string, target: string): void;
(options: {
socialNetwork: string,
socialAction: string,
socialTarget: string
}): void;
}
interface timeFn {
(category: string, variable: string, value: number, label: string): void;
(options: {
timingCategory: string,
timingVar: string,
timingValue: number,
timingLabel: string
}): void;
}
export default class VueAnalytics {
static install(Vue: typeof _Vue, options: {
id: string | string[] | (() => string) | (() => Promise<string>) | Promise<string>,
router?: VueRouter,
ignoreRoutes?: string[],
debug?: {
enabled?: boolean,
trace?: boolean,
sendHitTask?: boolean
},
batch?: {
enabled?: boolean,
amount?: number,
delay?: number
},
linkers?: string[],
customResourceURL?: string,
ecommerce?: {
enabled?: boolean,
enhanced?: boolean,
options?: any
},
autoTracking?: {
exception?: boolean,
exceptionLogs?: boolean,
screenview?: boolean,
pageviewOnLoad?: boolean,
page?: boolean,
pageviewTemplate?: (route: Route) => pageDetails,
transformQueryString?: boolean,
prependBase?: boolean,
skipSamePath: boolean,
shouldRouterUpdate: (to: Route, from: Route) => string,
untracked?: boolean
},
fields?: {
[field: string]: any
},
customIdFields?: {
[id: string]: {
[field: string]: any
}
},
disabled?: boolean | (() => boolean) | (() => Promise<boolean>) | Promise<boolean>,
checkDuplicatedScript?: boolean,
disableScriptLoader?: boolean
set?: { field: string, value: string }[],
commands?: any,
beforeFirstHit?: () => void,
ready?: () => void
}): void;
analyticsMiddleware: any;
onAnalyticsReady: () => Promise<void>;
event: eventFn;
ecommerce: any;
set: setFn;
page: pageFn;
query: any;
screenview: ((screen: string) => void) | ((option: { screenName: string, [otherProperties: string]: any }) => void);
time: timeFn;
require: (pluginName: string, options?: any) => void;
exception: (exception: Error | string) => void;
social: socialFn;
disable: () => void;
enable: () => void;
}
module 'vue/types/options' {
interface ComponentOptions<V extends _Vue> {
ga?: VueAnalytics;
}
}
module 'vue/types/vue' {
interface Vue {
$ga: VueAnalytics;
}
}
}