How do I add Google Analytics Event Tracking to a link?

Custom Google Analytics event tracking can be added to links, pages, and entire sites. You can setup a link to track the click, or the onclick event.

How an "onclick" event is structured, and how you can create your own

Here's an example of the full "tracker":


Since the CMS will provide the wrapping portion which is


we are only need to build the middle, which is


Let's go through and explain the pieces you'll need to modify to make it work. 


This you can replace with your unique identifier of the webpage where the link appears that you're tracking. This will show up in the Google Analytics report, so make it unique and recognizable. You can't use spaces or special characters, so it might look something like this: e.g. WebComm-Training


EventAction is the type of action the onclick event you are tracking performs. This is usually one of these three: Click, Toggle, or Downloads.

So, if we're building a tracker to monitor the amount of clicks our "View our Intro Training" link gets on our training page, it might look something like this:


Now, let's show you where to put this on your link so it starts tracking. 

Placing the tracker you've built onto the link you want to track

  1. Login to your webpage, and begin editing the page you wish to add the tracker.
  2. Click the green button on the editable region you wish to edit (e.g. Main Content.)
  3. Highlight the link you wish to add the tracker.
  4. Click on the Advanced Tab.
  5. Paste your tracker into the onclick field.
    • that=this;_gaq.push(['_trackEvent','EventCategory','EventAction',that.href]);
  6. Click OK.
  7. Save and publish your page and you should now be tracking that link.


Click on the link a few times to send tracking information through to your Google Analytics, however, the clicks may not show up right away. You may need to check back in a few days.

Was this article helpful? 0 out of 0 found this helpful

Have more questions? Submit a Support Ticket