Track conversions and user activity

Generate and send activity tags

Activity tags are snippets of JavaScript code that contain an HTML image tag. The image tag sends a request to Ad Manager, which is used to record an activity event. You can use Ad Manager reporting to understand conversion metrics for activity groups and activities. The raw key-values passed into these tags are available through Data Transfer. 

Conversion tracking is not currently supported on sites or ad requests that have been tagged for child-directed treatment

Generate tags for activities

  1. Sign in to Google Ad Manager.
  2. Click Admin and then Activity groups.
  3. Click on the activity group that contains the activity.
  4. Locate the activity and click Copy tag in the "Tag" column.

You can alternately copy activity tags when you click to view the activity details.

Activity tags in detail

Let's look at some example activity tags to understand how they're put together. The tags differ slightly depending on the activity type.

Expand all  Collapse all

 

Page views (Counter)

The 'Page views (Counter)' activity type tracks conversions for each time a user views a webpage.

Example:

<img src="https://pubads.g.doubleclick.net/activity;xsp=1234;ord='+ a +'?" width=1 height=1 border=0/>

To get a better understanding of the activity tag, let's look at it part by part.

img src: An HTML image tag. The src parameter tells the browser where to find the requested content for the image.

pubads.g.doubleclick.net: The web address of the Ad Manager servers for conversion tracking.

activity: Identifies the tag as an activity tag.

xsp=1234: Identifies the activity. Each activity has its own unique ID.

ord='+ a +': A random number generator. The random number makes the tag unique each time it's served, which means that the user's browser can't serve it from the cache, but instead needs to make a fresh call to the Ad Manager servers. That ensures that Ad Manager is able to check each page view for a conversion.

In the version of the image tag that's within the <noscript> tags, the value for ord= is set to 1. That's because no value can be added dynamically. The <noscript> version of the activity tag is served only to users whose browsers don't support JavaScript, which is a very small percentage of users.

width=1 height=1: Sets the dimensions of the invisible image, in pixels.

border=0: Sets the border of the image to 0 pixels so that it doesn't show.

Daily visits (Counter)

The 'Daily visits (Counter)' activity type tracks conversions for visits to a webpage, but only counts one conversion per user per day, even if a user visits the page multiple times.

Example:

<img src="https://pubads.g.doubleclick.net/activity;xsp=1234;ord=1;num='+ a +'?" width=1 height=1 border=0/>

The tag is identical to a 'Page visits (Counter)' tag, except for two key-values.

ord=1: A random number generator. 

num='+ a +': A random number generator. The random number makes the tag unique each time it's served, which means that the user's browser can't serve it from the cache, but instead needs to make a fresh call to the Ad Manager servers. That ensures that Ad Manager is able to check each page view for a conversion.

width=1 height=1: Sets the dimensions of the invisible image, in pixels.

border=0: Sets the border of the image to 0 pixels so that it doesn't show.

Custom (Counter)

The 'Custom (Counter)' activity type tracks conversions for visits to a webpage, but only counts one conversion per user per user session. Session length is set by the advertiser, using the value of the ord= key-value to insert a session ID. It's up to the advertiser to set and insert the session ID when the webpage containing the tag is loaded. Keep in mind, however, that Ad Manager can only consider a session ID unique within a 24-hour day, starting at midnight Eastern Time. Even if the same session ID is used on subsequent days, a new conversion will be counted for each day.

Example:

<img src="https://pubads.g.doubleclick.net/activity;xsp=1234;ord=[session id]?" width=1 height=1 border=0/>

The tag is identical to a 'Page visits (Counter)' tag, except for the ord= key-value.

Items Purchased (Sales)

The Items Purchased (Sales)' activity type is used to track conversions where the user has made a purchase. Specifically, it tracks the monetary value of each purchase, plus the number of items that were purchased and the order ID. It's up to the advertiser to insert these values dynamically when the webpage containing the tag is loaded.

The quantity, cost and order ID values passed into these tags are available through Data Transfer. The aggregated revenue totals for each activity are available through the Conversions metrics in Ad Manager reporting.

Example:

<img src="https://pubads.g.doubleclick.net/activity;xsp=9659;qty=[quantity of items purchased];cost=[revenue];ord=[order id]?" width=1 height=1 border=0/>

Here are the elements that are unique to 'Items Purchased (Sales)' activities:

qty=[quantity of items purchased]: The number of items purchased in each order. For example, if a user buys three books as one purchase, the value 3 can be dynamically inserted.

cost=[Revenue]: The amount of revenue generated by the entire transaction. The advertiser is responsible for dynamically inserting the value of each purchase. The value should be inserted as a number with a decimal, without commas or currency symbols.

The value of the cost parameter is interpreted to be in the same currency as the Ad Manager network.

 

ord=[orderID]: The advertiser is responsible for inserting a unique identifier for each transaction.

Transactions (Sales)

The 'Transactions (Sales)' activity type is used to track conversions where the user has made a purchase. Specifically, it tracks the monetary value of each purchase, plus the order ID. It's up to the advertiser to insert these values dynamically when the webpage containing the tag is loaded.

The quantity, cost and order ID values passed into these tags are available through Data Transfer. The aggregated revenue totals for each activity are available through the Conversions metrics in Ad Manager reporting.

Example:

<img src="https://pubads.g.doubleclick.net/activity;xsp=10139;qty=1;cost=[revenue];ord=[order id]?" width=1 height=1 border=0/>

'Transactions (Sales)' activity tags are the same as 'Items Purchased (Sales)' activity tags, with one exception:

qty=1: This value is set to 1 because it's used to count the number of transactions. The number of transactions for a 'Transactions (Sales)' activity is the same as the number of conversions.

Application downloads (Counter)

The Application downloads (counter) activity types (one for iOS, one for Android) track conversions for the initial launch of a mobile app. In their apps, advertisers include a small snippet of code in their apps that pings Ad Manager upon the app’s first launch; if a user has recently viewed and/or clicked one of that advertiser’s ads in an Ad Manager publisher’s app, Ad Manager will count that as an app download conversion.

This feature only works with in-app ads. Conversions are not counted if the ad is initially viewed on the web (desktop or mobile) and the application is subsequently downloaded.

You’ll need to create separate activity groups and snippets to track iOS and Android conversions. For apps, you’ll also need to incorporate the Conversion Tracking SDK in either Android or iOS. You can learn more about the SDK in the developer documentation.

Here are examples of conversion snippets:

  • iOS (to be included in your application delegate's application:didFinishLaunchingWithOptions: method):
    [DCTConversionReporter reportWithConversionID:@"<activity id>"
                            value:nil /* or price of app if desired */
                            isRepeatable:NO];
  • Android (to be included in your application's main activity):
    DoubleClickConversionReporter.reportWithConversionId(
       this.getApplicationContext(), "<activity id>",
       null, null /* or price of app if desired */, false);

Activity tags and page load times

On their own, activity tags have a minimal effect on the layout of webpages and the speed with which they're displayed. Additionally, a webpage containing an activity tag loads correctly even if the user's browser is unable to download the activity tag content.

The typical response time for pubads.g.doubleclick.net calls is around 150-300 milliseconds, but we cannot guarantee these times.

Was this helpful?
How can we improve it?