Integrate Google Analytics with Phonegap Application | Apache Cordova

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 integrating google analytics:

Step 1: Login or Create Google Analytics Account

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

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

Step 4: Create your phonegap project and add platform

Step 5: Add your plugin for integrate google analytics with phonegap

cordova plugin add

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

To track a Screen (PageView):

  •'Screen Title')

To track an Event:

  •'Category', 'Action', 'Label', Value) Label and Value are optional, Value is numeric

To track an Exception:

  •'Description', Fatal) where Fatal is boolean

To track User Timing (App Speed):

  •'Category', IntervalInMilliseconds, 'Variable', 'Label') where IntervalInMilliseconds is numeric

To add a Transaction (Ecommerce)

  •'ID', 'Affiliation', Revenue, Tax, Shipping, 'Currency Code') where Revenue, Tax, and Shipping are numeric

To add a Transaction Item (Ecommerce)

  •'ID', 'Name', 'SKU', 'Category', Price, Quantity, 'Currency Code') where Price and Quantity are numeric

To add a Custom Dimension

  •'Key', 'Value', success, error)

To set a UserId:


To enable verbose logging:



Share This

Share this post with your friends!