Rich media developer's guide

Count events with custom report variables

Custom variable reporting allows you to track events using your own reporting labels even after you've begun the reporting process.

If you anticipate tracking over 300 interactive elements in your creative or you need tracking counters generated dynamically (for example, information entered by a user at runtime, data collected from input text fields, tracking of dynamic fields set up using Studio’s dynamic enabler with a dynamic profile, or variables that are determined at runtime), we recommend adding custom variable reporting to your creative.

Limitations

  • Maximum 100 characters per custom report variable
  • Latin characters only (no Chinese, Cyrillic, etc.)
  • All question marks, semicolons, or hashtags and anything after the first question mark, semicolon, or hashtag in a string will be truncated. For example:
    • http://example.com/profile?0813u3hohgw is reported as http://example.com/profile
    • http://example.com/profile;0813u3hohgw is reported as http://example.com/profile
    • http://example.com/profile#0813u3hohgw is reported as http://example.com/profile
  • No personally identifiable data is allowed (for example, name, email address, phone number, health data, or financial data)

Step 1: Add custom report variables in HTML5

There are two types of methods that allow you to track two different counts against a custom variable:

Example code

Enabler.reportCustomVariableCount1(“Click Tracked”);
Enabler.reportCustomVariableCount2(“Click Tracked”);

This sends the reporting string "Click Tracked" to Google Marketing Platform's servers, which generate the custom variable report that will have two counts against this string: Custom Variable Count 1 and Custom Variable Count 2. In this case, the string should identify what content in the creative resulted in the user's performing an action for readable reporting later.

reportCustomVariableCount1 and reportCustomVariableCount2 don't behave in the same way as an Enabler.exit function. They only generate custom variable reporting. Make sure to also use a standard Enabler.exit function to generate a new window for click-throughs.

The two counts can be used to track different types of events against a particular string. For example, the reportCustomVariableCount1 method can be called for each impression against a given string, and the reportCustomVariableCount2 method can be called for each click against a given string. By doing this, both impressions and clicks can be tracked against the reporting labels you chose.

Step 2: Verify coding in Studio Preview

After you've uploaded assets into the Studio Web UI, you can see if custom variables are firing by previewing your creatives in Studio and opening the output console. Custom variables register in the Events Triggered section if they've been added correctly.

Step 3: Generate a report after the creative has served

Learn how to generate custom variable reports in the Campaign Manager 360 Help Center (sign-in required)

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

Search
Clear search
Close search
Google apps
Main menu
9544062425535819117
true
Search Help Center
true
true
true
true
true
74220
false
false