Project:About

From docs.airpush.com
Jump to: navigation, search

Contents

About Airpush Conversion Tracking

Use ACT to measure the performance of your Airpush campaigns and maximize your ROI. You can track Android app downloads and mobile web conversions (e.g., leads, user registrations) to better measure conversions, revenue per conversion, cost per conversion, and conversion rate percentage.

Airpush currently supports Cookieless conversion tracking for:

  1. App downloads for Android
  2. WAP conversions (e.g., leads, user registrations)

This guide explains in detail how to integrate ACT so that you can track conversions.

To integrate ACT you will need the following:

  1. An active Android App / WAP page.
  2. An ad campaign in the Airpush Ad Network to promote your Android App / wap page.
  3. Configure and install Conversion Tracking code (either in your App or on your servers) and update your app in Google Play store.

How do I start Using ACT?

The conversion tracking process is very simple. Let us start with the obvious question. What do you want to track?

  1. Android App Install- Google Play Store
  2. Android App Install - 3rd Party Store or Self-hosted apps
  3. WAP Conversions

Android App Install- Google Play Store

Tracking your app conversions in Google Play Store is child’s play now. There are two ways to do this:

  1. Use ACT SDK
  2. Use App-2-Server Method
  3. .

Use ACT SDK

This is by far the simplest of all tracking methods. The implementation steps are:

  1. Include the following ACT SDK within your Android app and publish the updated app to the Google Play store. Download the SDK here.
    Click here for Instructions.
  2. Create a campaign promoting your Android app in Airpush.
  3. Append &referrer=guid%3D%guid% at the end of your Google Play URL. This is very important.
  4. The google play store URL accepts *only* referrer parameter other than id.
    *id *would be the package name and the *referrer *will have all the other parameters, which should be url encoded.
  5. Once your campaign starts getting clicks and your app is downloaded from Google Play store, the conversion numbers will start getting updated in the Airpush Campaigns Dashboard.

Creative URL should be like this:

 http://play.google.com/store/apps/details?id=<package_name>&referrer=guid%3D%guid%

Sample URL:

http://play.google.com/store/apps/details?id=com.test.app&referrer=guid%3D%guid%

What is GUID

GUID is an unique variable generated by Airpush when a click happens. This is automatically generated by Airpush. You need not have to make any changes at your end.


ACT SDK installation instructions

Step 1 – Adding the JAR

For Eclipse projects:

If you are using ADT Plugin 18 or later then copy the appconversionsdk.jar to libs folder of your project and move to step 2.

Conversionscr.png

To verify whether it’s added to your project, expand the Android Dependencies.

Conversionscr1.png

Step 2 – Editing Your Manifest File

1: Copy and paste the following XML just before the closing </application> tag:

<receiver android:name="com.track.conversion.TrackingReceiver" android:exported="true" >
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

2: Add following permissions in Manifest:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Use App-2-Server Method

This is a slightly complicated method. However, if you aren’t comfortable adding our ACT SDK to your app, you can use this method:

  1. You will have to add some code snippets to your Android App. The main files that need to be modified are BroadcastReceiver and Manifest file. Once the code has been added, update your app in the Google Play store. Click here for Instructions.
  2. Create a campaign promoting your Android app in Airpush
  3. Append &referrer=guid%3D%guid% at the end of your Google Play URL. This is very important.
  4. Once your campaign starts getting clicks and your app is downloaded from Google Play store, the conversion numbers will start getting updated in the Airpush Campaigns Dashboard.
App-2-Server installation Code for Android App Conversion Tracking

Step 1 – Add code in your BroadcastReceiver file

@Override
	public void onReceive(Context context, Intent intent) {
		try {
			if (intent.getAction().equals("com.android.vending.INSTALL_REFERRER")) {
				Bundle extras = intent.getExtras();
				String referrerString = extras.getString("referrer");
				if (referrerString != null && !referrerString.equals("")&& referrerString.contains("guid")) {
					Map<String, String> referralParams = new HashMap<String, String>();
					referrerString = URLDecoder.decode(referrerString, "UTF-8");
					String[] params = referrerString.split("&");
					for (String param : params) {
						String[] pair = param.split("=");
						referralParams.put(pair[0], pair[1]);
					}
					String guid = referralParams.get("guid");
					if (guid != null && !guid.equals(""))
						sendData(context, guid);
				} else
					Log.i("TrackingReceiver", "Referrer is null.");
			}
		} catch (Exception e) {
			Log.e("TrackingReceiver", "Error: " + e.getMessage());
		}

	}

	// check the internet connection
	private static boolean isConnected(Context context) {
		try {
		ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
			if (connectivityManager != null
					&& (connectivityManager.getActiveNetworkInfo()
							.isConnected())) {
				return true;
			} else {
				return false;
			}
		} catch (Exception exception) {
			Log.e("TrackingReceiver", "Internet connection not available");
			return false;
		}

	}

	// send data to api.
	private static void sendData(Context context, String guid) {
		final List<NameValuePair> list = new ArrayList<NameValuePair>();
		list.add(new BasicNameValuePair("guid", guid));
		list.add(new BasicNameValuePair("sdkVersion", "1.1"));
		Log.i("TrackingReceiver", "Values: " + list);
		if (!isConnected(context))
			return;
		Thread thread = new Thread(new Runnable() {
			@Override
			public void run() {
				try {
					HttpClient httpclient = new DefaultHttpClient();
					HttpPost httppost = new HttpPost("https://api.airpush.com/track/");
					httppost.setEntity(new UrlEncodedFormEntity(list));
					BasicHttpParams basicHttpParams = new BasicHttpParams();
					httppost.setParams(basicHttpParams);
					HttpConnectionParams.setConnectionTimeout(basicHttpParams, 15000);
					HttpConnectionParams.setSoTimeout(basicHttpParams, 10000);
					HttpResponse response = httpclient.execute(httppost);
					int code = response == null ? 0 : response.getStatusLine().getStatusCode();
					Log.i("TrackingReceiver", "Status code: " + code);
					if (code == 200) {
						String string = EntityUtils.toString(response.getEntity());
						Log.i("TrackingReceiver", "Response: " + string);
					}
				} catch (UnsupportedEncodingException e) {
					Log.e("TrackingReceiver", "UnsupportedEncodingException: "+ e.getMessage());
				} catch (Exception e) {
					Log.e("TrackingReceiver", "Exception: " + e.getMessage());
				}

			}
		});
		thread.start();
	}
Step 2 – Editing Your Manifest File

1: Add the below intent filter in your receiver:

<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>

Example:

<receiver android:name="<<Receiver file Name>" android:exported="true" >
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

2: Add Following Permissions in Manifest:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Android App Install - 3rd Party Store or Self-hosted apps

If you would like to track conversions of your app that is hosted in other markets like Amazon, you will have to follow the below process.

  1. Create a campaign promoting your Android app in Airpush. Note down your Campaign ID and Creative ID.
  2. Enable your Android App to transmit conversion event data to Airpush API servers. Required data includes Campaign ID, Creative ID and md5 encrypted IMEI. Configure and integrate the conversion API code.
  3. Configure the conversion API code as follows. Replace placeholder values (i.e., , etc) with actual values.
     http://api.airpush.com/track/app/?campaignid=< CAMPAIGN ID >&creativeid=< CREATIVE ID >&IMEI=< MD5 ENCRYPTED IMEI > 
    ( Click Here to know how to collect IMEI)
  4. Call the conversion API immediately after the app installs. It can be a simple HTTP call. An example API URL is
    http://api.airpush.com/track/app/?campaignid=1000&creativeid=100&IMEI=abcdef1234567890 
How to Get MD5 Encrypted IMEI

When you are using ACT to track installs from 3rd party marketplaces like Amazon, you need to include the below code in your Android app, so that the IMEI is collected in MD5 encrypted format. Do note that this method requires READ_PHONE_STATE permission.

	// this method requires READ_PHONE_STATE permission.
	static String getIMEIinMd5(Context context) {
		try {
			String imeinumber = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
                        if (imeinumber == null || imeinumber.equals("")) {
				Class<?> c = Class.forName("android.os.SystemProperties");
				Method get = c.getMethod("get", String.class);
				imeinumber = (String) get.invoke(c, "ro.serialno");
			}
			MessageDigest mdEnc;
			mdEnc = MessageDigest.getInstance("MD5");
			mdEnc.update(imeinumber.getBytes(), 0, imeinumber.length());
			String imei = new BigInteger(1, mdEnc.digest()).toString(16); // Encrypted
			return imei;
		} catch (NoSuchAlgorithmException algorithmException) {
			algorithmException.printStackTrace();
		} catch (Exception ignored) {
			ignored.printStackTrace();
		}
		return "";
	}

WAP Conversions

Sometimes, the content you are promoting might be a WAP page and you will want to track leads or any other page as a conversion. With the new ACT method, we have also introduced conversion tracking for WAP. There are again two ways of doing this which are explained in detail below:

1. Javascript Code

This is the easiest method to implement. The implementation steps are:

  1. Add the following Javascript code at the bottom of your conversion page.
    <script type="text/javascript" src="http://api.airpush.com/track/InvokeTracking.js" /> 
  2. Create a campaign promoting your WAP link in Airpush.
  3. Append ?guid=%guid% at the end of your landing page URL. This is very important.
  4. Once your campaign starts getting clicks and conversions start happening in your WAP site, the conversion numbers will start getting updated in the Airpush Campaigns Dashboard.

2. Server-2-Server Method

Incase you aren’t interested in adding our Javascript code to your WAP site, you can still track conversions that are generated from Airpush campaigns. You will have to initiate an API call from your server to Airpush once the conversion has happened and then we will record the conversion. The implementation steps are as follows:

  1. Create a campaign promoting your WAP link in Airpush.
  2. Append ?guid=%guid% at the end of your landing page URL. This is very important.
    http://www.test.com?guid=%guid%

    Real time Sample Url would look like below after replacing %guid% in realtime.

    http://www.test.com?guid=5fb3315c04d3723890835961f6dcf1

    where the value of guid is 5fb3315c04d3723890835961f6dcf1a1

  3. Once the client has append %guid% token to his creative URL, this will be replaced by a UNIQUE IDENTIFIER when the creative gets served.
  4. The client has to post back this UNIQUE IDENTIFIER VALUE via GET or POST method.
  5. Invoke the following URL from your conversion page. This API call, once generated from your server, will let our server know that a conversion has happened. So this is mandatory. The API URL is
    http://api.airpush.com/track/?guid=<guid value>

    Note: Please replace the <guid value> with actual guid value.
    Sample URL:

    http://api.airpush.com/track/?guid=5fb3315c04d3723890835961f6dcf1a1

    NOTE:guid values should be fetched dynamically on each click and once conversion happens you should fire the pixel with the same guid which you received on click

  6. Once your campaign starts getting clicks and conversions start happening in your WAP site, the conversion numbers will start getting updated in the Airpush Campaigns Dashboard.

Additional Instructions

1: The following is a Known Issues in campaign tracking SDK by Google:

  • Only one BroadcastReceiver class can be specified per app. Should you need to incorporate two or more BroadcastReceivers from different SDKs, you will need to create your own BroadcastReceiver class that will receive all broadcasts and call the appropriate BroadcastReceivers for each type of broadcast.

2: A fully functional Google Play URL with custom tracking parameters will be as follows:

https://play.google.com/store/apps/details?id=com.app.demo&referrer=imei%3D%d%%26carrier%3D%carrier%%26phone_model%3D%device%%26manufacturer%3D%manufacturer%%26campaignid%3D%campaignid%%26creativeid%3D%creativeid%%26ip%3D%ip%%26android_id%3D%androidid%%26guid%3D%guid% 

Note:Whatever that goes into the referrer parameter has to be url encoded
WHERE %26 stands for &
and %3D stands for =

Personal tools

Variants
Actions
Toolbox