forked from MatteoGabriele/vue-gtag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue-gtag.d.ts
100 lines (86 loc) · 2.36 KB
/
vue-gtag.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
declare module 'vue-gtag' {
import _Vue, { PluginFunction } from 'vue';
import VueRouter from 'vue-router';
export interface PageView {
page_title: string;
page_location: string;
page_path: string;
}
export interface EventParams {
/** string that will appear as the event category */
event_category?: string;
/** string that will appear as the event label */
event_label?: string;
/** non-negative integer that will appear as the event value */
value?: number;
[key: string]: any;
}
export interface ScreenView {
app_name: string;
screen_name: string;
}
export interface Purchase {
transaction_id: string;
affiliation: string;
value: number;
}
export interface Refund {
transaction_id: string;
affiliation: string;
value: number;
}
export interface Linker {
domains: string[];
}
export interface Exception {
description: string;
fatal: boolean;
}
export type Dictionary<T> = { [key: string]: T };
export interface VueGtag {
pageview(pageView: PageView): void;
/**
* Send a Google Analytics Event.
*
* @see https://developers.google.com/analytics/devguides/collection/gtagjs/events
*
* @param action string that will appear as the event action in Google Analytics Event reports
* @param eventParams
*/
event(action: string, eventParams?: EventParams): void;
screenview(screenView: ScreenView): void;
customMap(map: Dictionary<string>): void;
purchase(purchase: Purchase): void;
refund(refund: Refund): void;
linker(config: Linker): void;
exception(ex: Exception): void;
}
export interface PluginOptions {
appName?: string;
pageTrackerTemplate?: () => void;
onBeforeTrack?: () => void;
onAfterTrack?: () => void;
onReady?: () => void;
enabled?: boolean;
disableScriptLoad?: boolean;
bootstrap?: boolean;
globalObjectName?: string;
pageTrackerEnabled?: boolean;
pageTrackerScreenviewEnabled?: boolean;
defaultGroupName?: string;
includes?: any;
config?: {
id: string,
params?: Dictionary<any>
};
}
export class VueGtagPlugin {
static install(Vue: typeof _Vue, options: PluginOptions, router?: VueRouter): void;
}
export default VueGtagPlugin;
module 'vue/types/vue' {
interface Vue {
$gtag: VueGtag;
}
}
}