Conversion Tracking – Android
In order to properly measure the effectiveness of cross-promotions and direct-sold advertisements, you should implement conversion tracking.
The conversion tracking network event only happens once — a file is stored on device so that the application doesn’t make additional network calls on subsequent application loads.
Basic implementation
In your main Activity class, place the following snippet in your onCreate() method:
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//.... other initialization
// Conversion tracking call
new MoPubConversionTracker().reportAppOpen(this);
}
The conversion tracking network event only happens once. A preference variable is stored so that the application doesn’t make additional network calls on later app starts.
Advanced server-side implementation
If your application already reports installs to your own server, you can choose to use our server-side conversion tracking API instead of bundling this logic in your app.
Then, whenever you want to us to track conversions for you, simply ping the URL `http://ads.mopub.com/m/open?v=5&id=<ANDROID_PACKAGE_NAME>&udid=idfa:<ANDROID_ADVERTISING_ID>`.
An example: To report a conversion for the GaiaGPS Lite application with Android Advertising ID `f8da38e9-b8af-4f8c-b8a7-e4ce25a9d384 `, the conversion URL would be http://ads.mopub.com/m/open?v=5&id=com.trailbehind.android.gaiagps.lite&udid=ifa:f8da38e9-b8af-4f8c-b8a7-e4ce25a9d384
To maintain the accuracy of conversion data on our servers, please limit your conversion calls to one per unique Android Advertising ID.