Integrate Google Analytics with Phonegap Application / Apache Cordova with Example

Integrate Google Analytics with Phonegap Application / Apache Cordova with Example

Want create site? Find Free WordPress Themes and plugins.

Tracking user activities / behaviour is very important for business success. In Phonegap Application we’re going to use Google Analytics for tracking user activities . By using google-analytics-plugin we can track user activities, Clicks, Screens, Events, Transactions and more

Screen Shot 2015-07-10 at 6.50.55 pm

Steps for integrate Google Analytics with Phonegap Application

Step1 : Login or Create Google Analytics Account

 

Step 2 : Create New Property for Mobile App (not website) under your account

Integrate Google Analytics with phonegap

 

Step 3 : Get your Google analytics ID (UA-XXXX-YYY)

Step 4 : Create your phonegap project

cordova create GoogleAnalytics com.phonegappro.googleanalytics GoogleAnalytics

Step 5 : Add Your Platform (Android / iOS)

cordova platform add android

Step 6: Add your plugin for integrate google analytics with phonegap / apache cordova projects

cordova plugin add https://github.com/danwilson/google-analytics-plugin.git

Step 6: Setup your google analytics tracking code on deviceready event
window.analytics.startTrackerWithId('UA-XXXX-YY')

  • To track a Screen (PageView) window.analytics.trackView('Screen Title')
  • To track an Event window.analytics.trackEvent('Category', 'Action', 'Label', Value) Label and Value are optional, Value is numeric
  • To track an Exception window.analytics.trackException('Description', Fatal) where Fatal is boolean
  • To track User Timing (App Speed) window.analytics.trackTiming('Category', IntervalInMilliseconds, 'Variable', 'Label') where IntervalInMilliseconds is numeric
  • To add a Transaction (Ecommerce) window.analytics.addTransaction('ID', 'Affiliation', Revenue, Tax, Shipping, 'Currency Code') where Revenue, Tax, and Shipping are numeric
  • To add a Transaction Item (Ecommerce) window.analytics.addTransactionItem('ID', 'Name', 'SKU', 'Category', Price, Quantity, 'Currency Code') where Price and Quantity are numeric
  • To add a Custom Dimension window.analytics.addCustomDimension('Key', 'Value', success, error)
  • To set a UserID window.analytics.setUserId('my-user-id')
  • To enable verbose logging window.analytics.debugMode()

 

Did you find apk for android? You can find new Free Android Games and apps.
  • Coupon Chamber

    where we have to add this window.analytics.trackView(‘Screen Title’)

MyMail WordPress Plugin free
Save $50 USD on Ionic Firebase Chat Source CodeEXPLORE