Cocos2d-x Quick Start

Current Cocos2d-x plugin version 2.3.10

The TUNE plugin for Cocos2d-x provides application session and event logging functionality via the native TUNE SDKs.

To begin logging sessions and events, first integrate the Cocos2d-x 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).

Supported TMC Solutions

The TUNE plugin for Cocos2d-x supports the following TUNE Marketing Console solutions:

  • Attribution Analytics
  • App Store Analytics

Downloading the Plugin

The TUNE plugin is available via Cocos2d-x’s SDKBOX. We will be using SDKBOX in this integration guide so first install SDKBOX.

Before you integrate the TUNE plugin, make sure to add your app to the Attribution Analytics platform.


To implement the downloaded plugin:

  1. From your project folder, import the TUNE SDKBOX plugin:
    sdkbox import tune
  2. SDKBOX will output the steps you need to follow from the integration guide in the /doc folder inside the plugin file.
  3. A basic integration will have AppDelegate.cpp look like this:
    #include "AppDelegate.h"
    #include "HelloWorldScene.h"
    #include "PluginTune/PluginTune.h"
    bool AppDelegate::applicationDidFinishLaunching() {
        return true;
    // this function will be called when the app is active again
    void AppDelegate::applicationWillEnterForeground() {

Advertising Identifiers

To increase the consistency and ease of attribution, consider collecting device identifiers as described in Unique Identifiers for Attribution.


  • In your app’s /, make sure that the path to the Google Play Services SDK is correct.
  • In /, make sure that the manifest contains the entry:
    <meta-data android:name=""
               android:value="@integer/google_play_services_version" />
    inside the <application> tags.

When this reference to the Google Play Services library is set up, the TUNE plugin will be able to collect the Google Advertising ID.


The Apple Advertising ID is automatically collected by the TUNE plugin. It requires you include AdSupport.framework in your iOS project. This is automatically added when installing the TUNE SDKBOX plugin on iOS.

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 Attribution Analytics. 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 SDK implementation in your mobile app, you can do so straight from the Attribution Analytics platform itself rather than creating a test environment. Please visit Testing Your Mobile App.

Measuring Events

After you implement the TUNE SDK 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 (such as a table or seat) held for one's 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.