Standard event tags

Click events

We associate (at least) 3 pieces of metadata with every event. These appear as event category, event action, and event label in Google Analytics's "Events" reports. Here's a summary of what each is:

Category: High-level description of application and the path the user is on within the application ("task path"). The category combines the application acronym with the task the event is part of. For example, if a user is clicking a link on the MassFishHunt hunting license shop, the event category would read mfh shop license. We usually determine what task a user is doing via the URL.

Action: Description of what the user is doing when the event is logged. We infer this from the target of the click, e.g. a button's value attribute or a link's text. We preprend this with the type of action, e.g.: Link click: Learn more or Button click: Purchase now.

Label: Sometimes used to log additional important information, such as the URL clicked.

We also attach other important metadata to events, such as the time they happened and the unique ID of the session in which they occurred.

Most user interactions are with links and buttons. We collect data about these through 2 tags:

  • GA – Link as Link

  • GA – Button as Link

These tags captures the link click text and the URL it sends the clicker to. Below is the typical structure for each field in one of these tags. The items in brackets represent variables whose values are populated by Javascript when a page is loaded or when the event is triggered.

  • Category: {{Task Path}}

  • Action: {{Link Click}}: {Click Link Text}}

  • Label: {{Click URL No GA Cookie}}

Note: In the case of a button being used as a link, we would replace "Link click" with "Button as link click," or some equally clear name to distinguish them.

The {{ Task Path }} variable is a combination of the application name and the "path" the user is on which we infer from the URL (i.e. the path). For example, if you are clicking an "add to cart" button in MassFishHunt, the state's hunting & fishing license application, the resulting {{Task Path}} might read mfh shop license. Here's a more in-depth explanation of the Task Path variable.

The other variables result in what they say they do -- the {{Click Link Text}} is the text that the user clicked, and the {{Click URL No GA Cookie}} is the destination URL (with the GA cookie, which is necessary for cross-domain tracking.

Google Analytics Settings. Click "Enable overriding settings in this tag." This will reveal a new field, and you'll be able to pick the {{GA Property X-domain}} variable that you set up previously.

Custom dimensions

You should also add at least 2 custom dimensions.

If you have other data you wish to associate with each page view, you may wish to add additional variables and assign them here.

Triggering

For each tag, you will need to assign a trigger that specifies when it should fire. In the case of a "Link clicks" tag, you can simply use the "Just links" trigger.

It is also possible to create separate tags for separate types of links -- for example, one for navigation menu clicks, and one for inline links. This can be especially useful if you would like to create special tags for "conversion" clicks, for instance.

However, our experience suggests that dividing up click types between many different tags leads to much tougher maintenance in the long run. Create tags sparingly if possible, and use variables to make data easier to slice, filter, and group.

Last updated