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

Are you interested in how to add custom event tracking to your links in WordPress with MonsterInsights? In this guide, we’ll show you how you can set up custom link categories, labels, and actions for your link clicks with MonsterInsights.

Prerequisites

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

The Benefits of Custom Event Tracking

The benefits of custom event tracking are that you can measure the results of the most important links that are on your site. These include:

  • Calls-to-Action (CTA’s)
  • Links that are a subdomain of your site. For example, monsterinsights.com has a link to landingpage.monsterinsights.com, but you want to track this as an external link. Now you can.
  • Create new event categories to track.
  • Editing the default tracking behavior already included in MonsterInsights such as telephone links, email link clicks, or downloads. These are already automatically tracked by MonsterInsights. Now, you can customize these links too.
Note: Custom categories, actions, and labels take precedence over built-in detection.

You also don’t have to use all three.

Here are some of the events MonsterInsights already automatically adds to Google Analytics.

How to Add Custom Event Tracking Links

Custom event tracking links follow this formula:

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

You to make links track either with completely custom categories, as different existing ones. For Example:

<a href="http://www.monsterinsights.com/download.pdf" data-vars-ga-category="outbound-link" >test</a>

Above, we’re tracking a download to track as an outbound-link.

You can also use custom categories. And also, these custom links work with AMP pages as well.

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

Let’s say you want to track link clicks on a call-to-action button on your site. In the below example, we will show you how to make links track either with a custom category of cta.

First, You can edit the link to include the following code:

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

For example, the event type cta above has the following components:

  • Event category: We’ve created a custom cta event category with cta assigned to them.
  • Event action: If left blank it will default to the URL of the link. For example:<a href=”https://www.monsterinsights.com/goal/” data-vars-ga-category=”cta” >Click Here</a>. Here, the event action is http://example.com/goal/.
  • Event label: The label of the href attribute. If left blank, MonsterInsights will first try the link title attribute, then try the text content of the link. In the above example, the event label is the text content: Sidebar Button. If left blank, it would be “test”.
  • Event Value: Not applicable.
  • Non-Interaction: Not set.

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

<a href="https://www.monsterinsights.com/goal/" data-vars-ga-category="cta" title="CTA">Click Here</a>

For example, the event type cta above has the following components:

  • Event category: We’ve created a custom cta event category with cta assigned to them.
  • Event action: If left blank it will default to the URL of the link. Here, the event action is https://monsterinsights.com/goal/.
  • Event label: The label of the href attribute. In the above example, the event label is the text content: CTA. If there wasn’t a link title blank, it would be “Click Here”.
  • Event Value: Not applicable.
  • Non-Interaction: Not set.
We would not recommend using this to track every link, as this would dilute the value of link tracking on your site.

That’s it! Now you know how to add custom event tracking to your links in WordPress with MonsterInsights. We’ve shown you how you can set up custom link categories, labels, and actions for your link clicks with MonsterInsights.

Are you interested in seeing what pages your visitors viewing on a per-post and a per-page basis? Now you can with the Page Insights addon. See our guide to learn how to get started with the page insights addon.