1 | /**
|
2 | * @name Google Analytics
|
3 | * @description
|
4 | * This plugin connects to Google's native Universal Analytics SDK
|
5 | * Prerequisites:
|
6 | * - A Cordova 3.0+ project for iOS and/or Android
|
7 | * - A Mobile App property through the Google Analytics Admin Console
|
8 | * - (Android) Google Play Services SDK installed via [Android SDK Manager](https://developer.android.com/sdk/installing/adding-packages.html)
|
9 | * @usage
|
10 | * ```typescript
|
11 | * import { GoogleAnalytics } from 'ionic-native';
|
12 | *
|
13 | * GoogleAnalytics.startTrackerWithId('YOUR_TRACKER_ID')
|
14 | * .then(() => {
|
15 | * console.log('Google analytics is ready now');
|
16 | * // Tracker is ready
|
17 | * // You can now track pages or set additional information such as AppVersion or UserId
|
18 | * })
|
19 | * .catch(e => console.log('Error starting GoogleAnalytics', e));
|
20 | *
|
21 | *
|
22 | * ```
|
23 | */
|
24 | export declare class GoogleAnalytics {
|
25 | /**
|
26 | * In your 'deviceready' handler, set up your Analytics tracker.
|
27 | * https://developers.google.com/analytics/devguides/collection/analyticsjs/
|
28 | * @param {string} id Your Google Analytics Mobile App property
|
29 | * @param {number} interval Optional dispatch period in seconds. Defaults to 30.
|
30 | * @returns {Promise<any>}
|
31 | */
|
32 | static startTrackerWithId(id: string, interval?: number): Promise<any>;
|
33 | /**
|
34 | * Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
|
35 | * @param allow {boolean}
|
36 | * @returns {Promise<any>}
|
37 | */
|
38 | static setAllowIDFACollection(allow: boolean): Promise<any>;
|
39 | /**
|
40 | * Set a UserId
|
41 | * https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
|
42 | * @param {string} id User ID
|
43 | * @returns {Promise<any>}
|
44 | */
|
45 | static setUserId(id: string): Promise<any>;
|
46 | /**
|
47 | * Set a anonymize Ip address
|
48 | * @param anonymize {boolean} Set to true to anonymize the IP Address
|
49 | * @returns {Promise<any>}
|
50 | */
|
51 | static setAnonymizeIp(anonymize: boolean): Promise<any>;
|
52 | /**
|
53 | * Sets the app version
|
54 | * @param appVersion {string} App version
|
55 | * @returns {Promise<any>}
|
56 | */
|
57 | static setAppVersion(appVersion: string): Promise<any>;
|
58 | /**
|
59 | * Set OptOut
|
60 | * @param optout {boolean}
|
61 | * @returns {Promise<any>}
|
62 | */
|
63 | static setOptOut(optout: boolean): Promise<any>;
|
64 | /**
|
65 | * Enable verbose logging
|
66 | * @returns {Promise<any>}
|
67 | */
|
68 | static debugMode(): Promise<any>;
|
69 | /**
|
70 | * Track custom metric
|
71 | * @param key {string}
|
72 | * @param value {any}
|
73 | * @returns {Promise<any>}
|
74 | */
|
75 | static trackMetric(key: string, value?: any): Promise<any>;
|
76 | /**
|
77 | * Track a screen
|
78 | * https://developers.google.com/analytics/devguides/collection/analyticsjs/screens
|
79 | *
|
80 | * @param title {string} Screen title
|
81 | * @param campaignUrl {string} Campaign url for measuring referrals
|
82 | * @param newSession {boolean} Set to true to create a new session
|
83 | * @returns {Promise<any>}
|
84 | */
|
85 | static trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise<any>;
|
86 | /**
|
87 | * Add a Custom Dimension
|
88 | * https://developers.google.com/analytics/devguides/platform/customdimsmets
|
89 | * @param key {number}
|
90 | * @param value {string}
|
91 | * @returns {Promise<any>}
|
92 | */
|
93 | static addCustomDimension(key: number, value: string): Promise<any>;
|
94 | /**
|
95 | * Track an event
|
96 | * https://developers.google.com/analytics/devguides/collection/analyticsjs/events
|
97 | * @param category {string}
|
98 | * @param action {string}
|
99 | * @param label {string}
|
100 | * @param value {number}
|
101 | * @param newSession {boolean} Set to true to create a new session
|
102 | * @returns {Promise<any>}
|
103 | */
|
104 | static trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise<any>;
|
105 | /**
|
106 | * Track an exception
|
107 | * @param description {string}
|
108 | * @param fatal {boolean}
|
109 | * @returns {Promise<any>}
|
110 | */
|
111 | static trackException(description: string, fatal: boolean): Promise<any>;
|
112 | /**
|
113 | * Track User Timing (App Speed)
|
114 | * @param category {string}
|
115 | * @param intervalInMilliseconds {number}
|
116 | * @param variable {string}
|
117 | * @param label {string}
|
118 | * @returns {Promise<any>}
|
119 | */
|
120 | static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any>;
|
121 | /**
|
122 | * Add a Transaction (Ecommerce)
|
123 | * https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addTrans
|
124 | * @param id {string}
|
125 | * @param affiliation {string}
|
126 | * @param revenue {number}
|
127 | * @param tax {number}
|
128 | * @param shipping {number}
|
129 | * @param currencyCode {string}
|
130 | * @returns {Promise<any>}
|
131 | */
|
132 | static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any>;
|
133 | /**
|
134 | * Add a Transaction Item (Ecommerce)
|
135 | * https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addItem
|
136 | * @param {string} id
|
137 | * @param {string} name
|
138 | * @param {string} sku
|
139 | * @param {string} category
|
140 | * @param {number} price
|
141 | * @param {number} quantity
|
142 | * @param {string} currencyCode
|
143 | * @returns {Promise<any>}
|
144 | */
|
145 | static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise<any>;
|
146 | /**
|
147 | * Enable/disable automatic reporting of uncaught exceptions
|
148 | * @param shouldEnable {boolean}
|
149 | * @returns {Promise<any>}
|
150 | */
|
151 | static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any>;
|
152 | }
|