Google Analytics
$ ionic plugin add cordova-plugin-google-analytics
Repo: https://github.com/danwilson/google-analytics-plugin
This plugin connects to Google's native Universal Analytics SDK Prerequisites:
- A Cordova 3.0+ project for iOS and/or Android
- A Mobile App property through the Google Analytics Admin Console
- (Android) Google Play Services SDK installed via Android SDK Manager
Supported platforms
- Android
- iOS
Static Methods
startTrackerWithId(id)
In your ‘deviceready’ handler, set up your Analytics tracker. https://developers.google.com/analytics/devguides/collection/analyticsjs/
Param | Type | Details |
---|---|---|
id |
string
|
Your Google Analytics Mobile App property |
trackView(title)
Track a screen https://developers.google.com/analytics/devguides/collection/analyticsjs/screens
Param | Type | Details |
---|---|---|
title |
string
|
Screen title |
trackEvent(category, action, label, value)
Track an event https://developers.google.com/analytics/devguides/collection/analyticsjs/events
Param | Type | Details |
---|---|---|
category |
string
|
|
action |
string
|
|
label |
string
|
|
value |
number
|
trackException(description, fatal)
Track an exception
Param | Type | Details |
---|---|---|
description |
string
|
|
fatal |
boolean
|
trackTiming(category, intervalInMilliseconds, variable, label)
Track User Timing (App Speed)
Param | Type | Details |
---|---|---|
category |
string
|
|
intervalInMilliseconds |
number
|
|
variable |
string
|
|
label |
string
|
addTransaction(id, affiliation, revenue, tax, shipping, currencyCode)
Add a Transaction (Ecommerce) https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addTrans
Param | Type | Details |
---|---|---|
id |
string
|
|
affiliation |
string
|
|
revenue |
number
|
|
tax |
number
|
|
shipping |
number
|
|
currencyCode |
string
|
addTransactionItem(id, name, sku, category, price, quantity, currencyCode)
Add a Transaction Item (Ecommerce) https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addItem
Param | Type | Details |
---|---|---|
id |
string
|
|
name |
string
|
|
sku |
string
|
|
category |
string
|
|
price |
number
|
|
quantity |
number
|
|
currencyCode |
string
|
addCustomDimension(key, value)
Add a Custom Dimension https://developers.google.com/analytics/devguides/platform/customdimsmets
Param | Type | Details |
---|---|---|
key |
string
|
|
value |
string
|
setUserId(id)
Set a UserId https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
Param | Type | Details |
---|---|---|
id |
string
|
debugMode()
Enable verbose logging
enableUncaughtExceptionReporting(shouldEnable)
Enable/disable automatic reporting of uncaught exceptions
Param | Type | Details |
---|---|---|
shouldEnable |
boolean
|