Count events with custom report variables

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

Use custom report variables when:

  • You need to track more than 400 interactive elements in your creative.
  • You need to track dynamically generated counters (for example, information entered by a user at runtime, data collected from input text fields, or variables that are determined at runtime).

String restrictions

  • Maximum 100 characters
  • Latin characters only (no Chinese, Cyrillic, etc.)
  • If the string includes question marks, semicolons, or number signs, both the symbol and anything after it will be truncated. Examples:
    • is reported as
    •;12345 is reported as
    • is reported as
  • No personally identifiable data, such as name, email address, phone number, health info, financial info, and so on.

Step 1: Add custom report variables in HTML5

There are two Enabler methods that allow you to track two different counts against a custom variable: reportCustomVariableCount1 and reportCustomVariableCount2.

Example code

Enabler.reportCustomVariableCount1("Click Tracked");
Enabler.reportCustomVariableCount2("Click Tracked");

This sends the reporting string "Click Tracked" to Google Marketing Platform's servers. When you run a custom variable report, there will be 2 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. These counts only appear in custom variable reporting. Make sure to also use a standard Enabler.exit function to generate a new window for clicks that should open an advertiser landing page.

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: Run a report after the creative has served

Learn how to run a custom variable report

Was this helpful?
How can we improve it?