AdWords Conversion Tracking

Google Tag Manager (GTM) provides AdWords conversion tracking tags to support flexible, rule-based AdWords conversion tracking for Android apps.

This guide shows you how to track an Android app install conversion with GTM AdWords conversion tracking tags:

  1. Create a new conversion in AdWords
  2. Create a trigger to fire an AdWords conversion tracking tag
  3. Create an AdWords conversion tracking tag
  4. Update file AndroidManifest.xml
  5. Push the AdWords conversion event to the data layer
  6. Record deep links
  7. Publish the container

1. Create a new conversion in AdWords

To create a new conversion in AdWords:

  1. Sign in to your AdWords account.
  2. At the menu bar, select Tools > Conversions.
  3. Click + CONVERSION.
  4. Select App.
  5. Select Android and App installs (first open) and click Continue.
  6. Enter the following:
    • Click Name to the name of the Android app and click Done.
    • Click Value to enter a value for each install of the app, or select Don't assign a value to this install, and click Done.
    • Click Package name to enter the package name of your Android app within Google play and click Done.
    • Click Optimization, which is turned off by default. To turn on optimization, click OFF to toggle it to ON and click Done.
    • (Optional). Click Postback URL to enter the URL from your analytics provider where you’d like conversions to be posted and click Done.
  7. Click Save and continue.
  8. Review your conversion settings. To change them, click Edit settings.
  9. Under Set up your tracking method, select Put tracking code into the app.
  10. Click Save instructions and code or Email instructions and code to save the conversion ID and conversion label, which are required to create an AdWords conversion tracking tag.
  11. Click Done.

2. Create a trigger to fire an AdWords conversion tracking tag

To create a trigger in Google Tag Manager to fire the AdWords conversion tracking tag:

  1. Sign in to your Google Tag Manager account.
  2. Select a mobile container.
  3. On the left navigation bar, click Triggers.
  4. Click New.
  5. Under Fire On, enter the following conditions:

    tracking method

  6. Click Create Trigger.
  7. Enter a trigger name.
  8. Click Save.

3. Create an AdWords conversion tracking tag

To create an AdWords conversion tracking tag:

  1. Sign in to your Google Tag Manager account.
  2. Select a mobile container.
  3. On the left navigation bar, click Tags.
  4. Click New.
  5. Choose product Google AdWords.
  6. Choose tag type AdWords Conversion Tracking.
  7. Enter the Conversion ID and Conversion Label.
  8. Select Unrepeatable.
  9. Click Continue.
  10. Under Fire On, select Custom event.
  11. Select the trigger created in step 2.
  12. Click Save.
  13. Click Create TAg.
  14. Enter a tag name (say Android App Install Conversion).
  15. Click Save.

4. Update file AndroidManifest.xml

In Android Studio, open the AndroidManifest.xml file to add the following within the <application> tag:

<service android:name="com.google.android.gms.tagmanager.InstallReferrerService"/>
<receiver
   android:name="com.google.android.gms.tagmanager.InstallReferrerReceiver"
   android:exported="true">
   <intent-filter>
       <action android:name="com.android.vending.INSTALL_REFERRER" />
   </intent-filter>
</receiver>

5. Push the AdWords conversion event to the data layer

First initialize Google Tag Manager (GTM). Then add the following code you to your app to push the AdWords conversion event to the data layer, which will enable GTM to evaluate the trigger and fire the matching tag:

DataLayer dataLayer = TagManager.getInstance(context).getDataLayer();
dataLayer.pushEvent("appLaunch", DataLayer.mapOf());

If your app uses deep linking, to record a deep linking conversion, push the link to the data layer as "gtm.url" in the activities launched by your intents:

if (this.getIntent() != null && this.getIntent().getData() != null ) {
  TagManager.getInstance(this).getDataLayer().push("gtm.url", this.getIntent().getData().toString());
}

7. Publish the container

You can now publish your container to begin firing the AdWords conversion tag. For details, see Adding, Updating and Publishing Tags on Setup and Workflow (Mobile Apps).