How to Add Custom Link Attribution: Setup Custom Link Categories, Labels, and Actions

Want to track custom events on your WordPress site?

Learn how to customize the Event Category, Event Action, and Event Label of your links in this guide.

Prerequisites

  1. ExactMetrics is installed and activated.
  2. ExactMetrics is connected with Google Analytics.
  3. Your version of ExactMetrics is up-to-date. (ExactMetrics version 6.0.0 or later is required.)

The Benefits of Custom Event Tracking

Custom event tracking helps you measure how well links perform on your site, depending on your needs:

  • Track your call-to-action links (CTA).
  • Track link clicks on important internal links, such as links that lead to a subdomain of your website.
  • Track event categories of your choosing.
  • Tweak custom tracking that ExactMetrics automatically tracks, such as telephone links, download link clicks or email link clicks, as needed for your end goals.

Note: Your custom link tracking will override the detection built into ExactMetrics.

It’s not required to define all three attributes (Event Category, Event Action or Event Label) in order for custom tracking to work. Simply customize what you need.

For example, if you just want to change the category name for telephone link clicks from tel (ExactMetrics tracks this by default) to something different, just define the Event Category of the link and ExactMetrics will track whichever value you set.

Learn more about the events that ExactMetrics automatically tracks for you.

How to Add Custom Event Tracking Links

To set up custom tracking, simply add the following “data-vars-ga-” data attributes within your links:

<a href="https://www.exactmetrics.com" data-vars-ga-category="Custom Category" data-vars-ga-action="Custom Action" data-vars-ga-label="Custom Label" >Example</a>

Use the following to customize your tracking:

  • Use data-vars-ga-category to customize the Event Category name.
  • Use data-vars-ga-action to customize the Event Action. This is normally tracked as the href value.
  • Use data-vars-ga-label to customize the Event label. This is normally tracked as the text of the link, or if there is a title available, then it will be tracked as the title attribute of a link.

ExactMetrics will map the Event Category, Event Action, and Event Label to the following:

  • Event Category → Event name
  • Event Action → link_url
  • Event Label → link_text

When you authenticate and connect ExactMetrics to your Google Analytics property, the custom dimensions of link_url and link_text are automatically created for you.

How to Add Call-to-Action Custom Event Click Tracking

To start, let’s say we have a link to a landing page within our website that looks like this:

<a href="https://www.exactmetrics.com/goal/">Learn More</a>

By default, this link will not be tracked, but we can customize it so that ExactMetrics will track it by adding custom event tracking.

Now the link looks like this:

<a href="https://www.exactmetrics.com/goal/" data-vars-ga-category="cta" data-vars-ga-action="Custom Action" data-vars-ga-label="Sidebar Button">Learn More</a>

Here’s a breakdown of how we set up custom event tracking for this link above:

  • Event category: This link will be tracked as cta event category.
  • Event action: We’ve overridden this to use Custom Action.
  • Event label: We’ve set this to be Sidebar Button.
  • Event Value: N/A.
  • Non-Interaction: Automatically set as not set.

A Minimalist Approach to Creating CTA Custom Link Click Events with ExactMetrics

As mentioned, you do not need to use all three “data-vars-ga-” data attributes. Here’s a more minimal example of custom event tracking being set on a link:

<a href="https://www.exactmetrics.com/goal/" data-vars-ga-category="cta" title="CTA" >Click Here</a>
  • Event category: Is set as cta.
  • Event action: ExactMetrics will track this as https://www.exactmetrics.com/goal/ since the data-vars-ga-action attribute wasn’t added.
  • Event label: Since this is not defined but there is a title attribute, this will be set as CTA 
  • Event Value: N/A.
  • Non-Interaction: Automatically set as not set.

Our suggestion is to only use custom event tracking on your most important links and not track every internal link on your website.

That’s all there is! You learned how to add custom event tracking to your WordPress site, and learned how to customize your tracking with ExactMetrics.

Want to learn how your pages or posts are performing individually? Get started with our Page Insights Addon.