Custom Google Analytics event tracking can be added to links, pages, and entire sites through the
onclick attribute. What does that mean? It means you're adding tracking to an action taken by the user (or as we call it, an "event") and the event you're tracking is the "click".
How an "onclick" event is structured, and how you can create your own
Here's an example of the "tracker":
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.
EventAction is the type of action the onclick event you are tracking performs. This is usually one of these three:
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
- Login to your webpage, and begin editing the page you wish to add the tracker.
- Click the green button on the editable region you wish to edit (e.g. Main Content.)
- Highlight the link you wish to add the tracker.
- Click on the Advanced Tab.
- Paste your tracker into the onclick field.
- Click OK.
- 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.