From ff0008e7eba66355206f8f5884a73b2079526a6c Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Thu, 15 Mar 2018 22:02:58 +0100 Subject: [PATCH] feat(google-analytics): add missing functions --- .../plugins/google-analytics/index.ts | 129 +++++++++++++++--- 1 file changed, 111 insertions(+), 18 deletions(-) diff --git a/src/@ionic-native/plugins/google-analytics/index.ts b/src/@ionic-native/plugins/google-analytics/index.ts index 9af3c62e5..1b7fe31ee 100644 --- a/src/@ionic-native/plugins/google-analytics/index.ts +++ b/src/@ionic-native/plugins/google-analytics/index.ts @@ -38,7 +38,6 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; }) @Injectable() export class GoogleAnalytics extends IonicNativePlugin { - /** * In your 'deviceready' handler, set up your Analytics tracker. * https://developers.google.com/analytics/devguides/collection/analyticsjs/ @@ -50,7 +49,9 @@ export class GoogleAnalytics extends IonicNativePlugin { successIndex: 2, errorIndex: 3 }) - startTrackerWithId(id: string, interval?: number): Promise { return; } + startTrackerWithId(id: string, interval?: number): Promise { + return; + } /** * Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more @@ -58,7 +59,9 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - setAllowIDFACollection(allow: boolean): Promise { return; } + setAllowIDFACollection(allow: boolean): Promise { + return; + } /** * Set a UserId @@ -67,7 +70,9 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - setUserId(id: string): Promise { return; } + setUserId(id: string): Promise { + return; + } /** * Set a anonymize Ip address @@ -75,15 +80,40 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - setAnonymizeIp(anonymize: boolean): Promise { return; } + setAnonymizeIp(anonymize: boolean): Promise { + return; + } /** - * Sets the app version + * Set the app version * @param appVersion {string} App version * @returns {Promise} */ @Cordova() - setAppVersion(appVersion: string): Promise { return; } + setAppVersion(appVersion: string): Promise { + return; + } + + /** + * Get a variable + * @param key {string} Variable + * @returns {Promise} + */ + @Cordova() + getVar(key: string): Promise { + return; + } + + /** + * Set a variable + * @param key {string} Variable + * @param value {string} Parameter + * @returns {Promise} + */ + @Cordova() + setVar(key: string, value: string): Promise { + return; + } /** * Set OptOut @@ -91,14 +121,18 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - setOptOut(optout: boolean): Promise { return; } + setOptOut(optout: boolean): Promise { + return; + } /** * Enable verbose logging * @returns {Promise} */ @Cordova() - debugMode(): Promise { return; } + debugMode(): Promise { + return; + } /** * Track custom metric @@ -110,7 +144,9 @@ export class GoogleAnalytics extends IonicNativePlugin { successIndex: 2, errorIndex: 3 }) - trackMetric(key: number, value?: number): Promise { return; } + trackMetric(key: number, value?: number): Promise { + return; + } /** * Track a screen @@ -125,7 +161,13 @@ export class GoogleAnalytics extends IonicNativePlugin { successIndex: 3, errorIndex: 4 }) - trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise { return; } + trackView( + title: string, + campaignUrl?: string, + newSession?: boolean + ): Promise { + return; + } /** * Add a Custom Dimension @@ -135,7 +177,9 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - addCustomDimension(key: number, value: string): Promise { return; } + addCustomDimension(key: number, value: string): Promise { + return; + } /** * Track an event @@ -151,7 +195,15 @@ export class GoogleAnalytics extends IonicNativePlugin { successIndex: 5, errorIndex: 6 }) - trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise { return; } + trackEvent( + category: string, + action: string, + label?: string, + value?: number, + newSession?: boolean + ): Promise { + return; + } /** * Track an exception @@ -160,7 +212,9 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - trackException(description: string, fatal: boolean): Promise { return; } + trackException(description: string, fatal: boolean): Promise { + return; + } /** * Track User Timing (App Speed) @@ -171,7 +225,14 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise { return; } + trackTiming( + category: string, + intervalInMilliseconds: number, + variable: string, + label: string + ): Promise { + return; + } /** * Add a Transaction (Ecommerce) @@ -185,7 +246,16 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise { return; } + addTransaction( + id: string, + affiliation: string, + revenue: number, + tax: number, + shipping: number, + currencyCode: string + ): Promise { + return; + } /** * Add a Transaction Item (Ecommerce) @@ -200,7 +270,17 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise { return; } + addTransactionItem( + id: string, + name: string, + sku: string, + category: string, + price: number, + quantity: number, + currencyCode: string + ): Promise { + return; + } /** * Enable/disable automatic reporting of uncaught exceptions @@ -208,6 +288,19 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - enableUncaughtExceptionReporting(shouldEnable: boolean): Promise { return; } + enableUncaughtExceptionReporting(shouldEnable: boolean): Promise { + return; + } + /** + * Manually dispatch any data + * @returns {Promise} + * @platform + */ + @Cordova({ + platforms: ['Android', 'iOS', 'Windows'] + }) + dispatch(): Promise { + return; + } }