PhoneGap(Cordova) Quick Start

Current Cordova/PhoneGap plugin version 8.0.0

The TUNE plugin for Cordova/PhoneGap provides application session and event logging functionality via the TUNE native SDKs.

To begin logging sessions and events, first integrate the plugin with your mobile app. After you initiate the measureSession method, you can log in-app events (such as purchases, game levels, and any other user engagement).

Downloading the Plugin

All of our extensions/plugins are open source and available on GitHub. The Cordova/PhoneGap plugin can be found at:

PhoneGap/Cordova plugin

The TUNE PhoneGap/Cordova plugin is also available from npm via the Cordova CLI:

cordova plugin add cordova-plugin-tune

Before you can download the TUNE Cordova/PhoneGap plugin, make sure to add your app to the Attribution Analytics platform.

Note: For iOS apps, please ensure you've included Cocoapods in your implementation as it is a required dependency.


  1. Install the plugin into your project.
    $ cordova create MyAwesomeApp
    $ cd MyAwesomeApp
    $ cordova plugin add cordova-plugin-tune
  2. Initialize the tracker upon receiving the deviceready event. For example, in a new Cordova project, you would add in onDeviceReady of index.js:
    var app = {
        tune: null,
        onDeviceReady: function() {
            app.tune = window.plugins.tunePlugin;
            app.tune.init("your_advertiser_ID", "your_conversion_key");
            // Only if you have pre-existing users before TUNE SDK implementation, identify these users
            // using this code snippet.
            // Otherwise, pre-existing users will be counted as new installs the first time they run your app.
            //var isExistingUser = ...
            //if (isExistingUser) {
            //    app.tune.setExistingUser(true);

* The Android INSTALL_REFERRER receiver is automatically added via plugin.xml

Advertising Identifiers

To increase the consistency and ease of attribution, the TUNE Cordova/PhoneGap plugin collects device identifiers as described in Unique Identifiers for Attribution.


The Google Advertising ID is automatically collected by the Cordova/PhoneGap plugin. It requires the following:


The Apple Advertising ID is automatically collected by the TUNE plugin. It requires the following:

  • Include AdSupport.framework in your iOS project. This is automatically added when installing the TUNE plugin on iOS.

If you do not wish to collect the Apple Advertising ID, then instead of installing cordova-plugin-tune from npm, you may install the plugin in the /no_ifa folder from the GitHub repo.

Things to Keep in Mind

The “your_advertiser_ID” and the “your_conversion_key” values correlate with the Advertiser ID and Conversion Key that TUNE provides when you create your Mobile App in TUNE. For information about the advertiser ID and conversion key, please visit Finding Advertiser ID and Conversion Key.

If your app already has a pre-existing user base (people who have already installed your app), TUNE has several options to flag these users as Pre-Existing Users to prevent attributing these users to a marketing partner. For information about migrating existing users, please visit handle existing users prior to SDK implementation.

Testing & Troubleshooting

To test the TUNE Cordova/PhoneGap plugin implementation in your mobile app, you can do so straight from the TUNE platform itself rather than creating a test environment. Please visit Testing Your Mobile App.

Measuring Events

After you implement the TUNE Cordova/PhoneGap plugin in your mobile app and start logging sessions, you can move on to logging a wide variety of in-app events such as registrations and in-app purchases.

By logging and analyzing in-app events, you can more efficiently optimize both the functionality of your app and your advertising strategies. Bottom line? Understanding how your users interact with your mobile app directly impacts your ability to build effective and profitable advertising campaigns by enabling you to compare retention, engagement, and lifetime value (LTV) to your costs.

Or to build your own custom event, please visit Event Builder.

In-App Events

Achievement Unlocked

Gaining access to additional functionality; generally by completion of a particular event or level.

Add to Cart

Including items in one's virtual shopping cart to be purchased.

Add to Wishlist

Including items in one's virtual list of wanted items not to be readily purchased.

Added Payment Info

Including one's payment information to be used for making purchases.

Checkout Initiated

Starting the checkout process once items have been added to one's cart and ready to complete the purchase.

Content View

Looking at or inspecting content on a page; essentially the rendering of the page.


Requesting someone to do something; for example, a friend invite or an app invite.

Level Achieved

Completing the necessary requirements to move on to the next stage; generally applies to gaming apps.


The process by which an individual gains access to their account by identifying and authenticating themselves.


Completing a purchase transaction in which one has bought an item.


Assigning a value to something according to a particular scale; e.g. 4 stars.


The act or process of entering information about one's self to create an account.


Arranging to have something (like a table or seat) held for use at a later time.


Actively looking for or seeking out something via a keyword.


Giving others access to something; e.g. sending a link online content.

Spent Credits

Applying accumulated rewards/points as payment for an item.

Tutorial Complete

Finishing a lesson or instructions on how to do/achieve something.