In the past I’ve visited many sites and blogs trying to find easy guides to help me manage my PPC accounts. Although I have a technical background, certain tutorials tend to drag on quite a bit and can be filled with waffle.
I have found many tutorials regarding event tracking, but they were mostly for affiliate tracking. What I couldn’t find much information on was event tracking of buttons, specifically dynamic buttons – so when a user clicks “send” there isn’t a confirmation landing page to track as a goal.
Hopefully this guide will help others who felt the same as me. Using a few simple steps, I will show you how to set up dynamic button goal tracking in Google Analytics.
There is a Download App button on a website that does not lead to a confirmation page, but instead to iTunes where you are able to download the app. This makes tracking difficult as we cannot track external URL landing pages as we do not own them or have access to their analytics. Please note that this is not tracking the amount of downloads but the amount of people wanting to download (clicking the button to be directed to iTunes, not directly downloading from iTunes).
The 5 Step Guide
The task is to track this button submission as an event. And this will become the Goal.
Step 1. Create a new Goal
Step 2. Name the Goal and Select Event
You will notice that Google Analytics will identify the goal as “Goal ID 1 / Goal Set 4”. This is because the event (clicking on a dynamic button) is the 4th type/4th in the list. Above I named the goal ‘Download iOS App’ but you can name it whatever you would like for your reference purposes.
Step 3. Goal Details
Here comes the tricky part; the Google Analytics default event tracking code looks like this:
onclick=”_gaq.push(‘_trackEvent’, ‘category’, ‘action’, ‘label’);”
You will need to replace at least two of the three values below, but if you have more than one button, it is suggested to replace three. When you or your developer is adding this to the button submission code you will need to define the following values;
- Category – The category/type of event, e.g. button click
- Action – Give the action a name, e.g. click (I use “button” here) but it depends on how your developer has done this.
- Label – Anything else you want to include (I use the page URL)
Step 4. Identifying your Variables
Next you will need to identify the variables for your event. Say your dynamic button which looks a little like the one below. You will need to identify the values of the button on the page source. Without being too technical, all you have to do is right click on the button in question and then click on Inspect element
This will bring up what looks like a whole load of jargon, but all you will need to do is check that you have a snippet of information that looks similar to this. This confirms that you are able to track the clicks properly once the goal is set up:
<a target=”_app” no-match=”1″ href=”https://itunes.apple.com/xxxxx” onclick=”track.appLink(this.href, ‘button’); return true;”>
In the text above, you can identify two variables: the action and the label.
The action, in this case the “button” and the label, in this case ref=https://itunes.apple.com/xxxxx (with xxxxx being the URL for the app within the iTunes site).
Step 4. Inserting the Goal Details
Now you have the information located in Step 3., you will need to substitute the variable in Google Analytics under the event conditions section. In this case it will be for the ‘action’ and the ‘label’ only.
Step 5. Verifying your Goal and saving it
Finally, you will now have to verify your goal by clicking on the save button.
Be aware, if your website is new it may have little to no data to be tracked. This is nothing to worry about and I would suggest trying again once your site has been live a little longer and the site has more traffic.
Hopefully this guide will have made things much simpler for you, but in the unfortunate event that you are still having trouble, Google themselves have a more in depth Google Analytics event tracking help sheet.
You can also follow the same steps to track a newsletter submission which doesn’t generate a confirmation page.