Integration Steps

The AdWords Conversion Tracking SDK is a lightweight SDK with two main purposes. First, it allows you to measure the effectiveness of your AdWords app promotion campaigns. You can tag the events you'd like to track in your app, then log in to AdWords to see how many of these conversions are being driven by your advertising.

You can tag any event in your app to be tracked as a conversion--whenever users perform the tagged action after interacting with an ad, the event is recorded and can be viewed in your AdWords campaign reports. Details for setting up tracked events are below.

Second, the SDK can also be used to tag user activity in your app, so you can reach certain users with ads that re-engage them with your app later on. For example, you might want to target app re-engagement ads to users who downloaded your app but haven't used it recently.

The default integration of the AdWords conversion tracking SDK--described below--collects information about app upgrades and app usage after the install. This post-download usage data allows AdWords to optimize your advertising. This data will also allow you to remarket to these segments of your existing user base with app re-engagement ads if you choose to set up remarketing later on in your AdWords account:

  • All users who have your app installed
  • People who did or didn't use the app recently
  • People using specific app versions

To target even more specific audiences, you can tag custom events in your app (e.g., purchases or progress in a game) for remarketing use. This will allow you to reach users who have completed those specific actions with re-engagement ads later on. Custom remarketing is described here.

Usage and disclosure

Check the Personalized advertising policy to find out which sensitive categories of sites or apps can't use remarketing, and what you need to add to your site's or app's privacy policy.

If you'd like, you can disable the collection of post-download usage data by calling AdWordsAutomatedUsageReporter.disableAutomatedUsageReporting(this.getApplicationContext(),conversionID)--providing your application context and conversion ID as arguments (it's rare but possible that you could have multiple conversion IDs in your application).

Track in-app events driven by advertising

Events you track in your app might include things like whether a user completes a gameplay tutorial, or whether a user completes a purchase. Conversion events will show up in your AdWords account if a user carries out one of these conversions after clicking an ad.

To track these events, simply define conversions in your AdWords account, one for each event you'd like to track. Give each one a descriptive name. (AdWords allows you to define a large number of different conversions, and gives you a different label for each one.)

For each one, you'll be given a code snippet that looks like this:

    "1038185027", "aqUCHIerhAgQw-SF7wM", "0", true);

Add the Android code snippet you've been given to your app's code, placing it in the appropriate place to track the conversion that you care about. reportWithConversionId takes five arguments that have been pre-filled for you in the snippet that is provided in your AdWords account:

  • the application context from which you are tracking a conversion event
  • an ID that identifies your conversion
  • an alphanumeric label that identifies your conversion
  • the value of your conversion (must be specified in the currency of your AdWords account)
  • a boolean to indicate whether the conversion should fire only once or should fire multiple times. We pre-populate the appropriate value for you and strongly recommend leaving the default value unchanged.

If your app uses deep linking, you'll need to call AdWordsConversionReporter.registerReferrer(MY_APPLICATION_CONTEXT, INBOUND_URI) to make sure that conversions are counted even when users come in via a deep link. Here is an example:

public void onResume() {

  /** Your code that parses deep links and routes users to the right place. **/

Note that if your conversion has a value (e.g., some in-app purchases cost 99 cents while others cost 1.99), you can fill in the proper value into the value parameter each time you report a conversion.

Track application usage

To record the most accurate application usage data, put the following code near the beginning of your application, for example, in your main Activity's onResume() method.

// Enable automated usage reporting.
AdWordsAutomatedUsageReporter.enableAutomatedUsageReporting(MY_APPLICATION_CONTEXT, MY_ACCOUNT_CONVERSION_ID);

On the other hand, if you'd like to opt out of transmitting application usage data to AdWords, just call the following method before any conversion or remarketing reports are made:

// Disable automated usage reporting for a single conversion ID.
AdWordsAutomatedUsageReporter.disableAutomatedUsageReporting(MY_APPLICATION_CONTEXT, MY_ACCOUNT_CONVERSION_ID);

Example: Track app upgrades as conversions

To track app upgrades, first define a new conversion in your AdWords account--you can call it something like "App upgrade".

Then take the conversion code snippet that was provided and put it inside a block of code that checks each time the app launches to see whether the app has just been upgraded to a newer version:

private static final String LAST_RECORDED_VERSION_KEY = "last_recorded_app_version";

public void onResume() {
  try {
    PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    int currentAppVersion = packageInfo.versionCode;
    int lastRecordedAppVersion = mPrefs.getInt(LAST_RECORDED_VERSION_KEY, -1);
    if (currentAppVersion > lastRecordedAppVersion) {
          "0",  // The value of your conversion; can be modified to a transaction-specific value.
      SharedPreferences.Editor editor = mPrefs.edit();
      editor.putInt(LAST_RECORDED_VERSION_KEY, currentAppVersion);
  } catch (NameNotFoundException e) {
    Log.w("MyApp", e.getMessage());

Confirm setup

When you go into your app and carry out the conversion event that you've defined, you should see messages similar to the following logged at the Info level:

I/GoogleConversionReporter( 1557): Pinging: [...]

I/GoogleConversionReporter( 1557): Ping responded with response code 200

The HTTP 200 response code indicates that the conversion was successfully reported to Google AdWords.

Enviar comentarios sobre…

Mobile Apps Conversion Tracking and Remarketing
Mobile Apps Conversion Tracking and Remarketing