How to add Event Tracking with Google Analytics
Normally when I want to use Conversion Tracking for Google Analytics and Google Adwords for a form, I just track the link of the “Thank You” page. However, I needed a way to track users clicking the button to use our ZenDesk form. To do that, you need “Event Tracking.”
1. Login to you Google Analytics for your site and click on ADMIN.
2. Under VIEW, click on the GOALS link.
3. Click on CREATE NEW GOAL.
4. Give the goal a title, then choose EVENT as the type.
5. For the category, I used the name of the form I am trying to track.
6. For action, I just put “Click”
7. For label, I put the text on the button since I have a few variants, but it might be any other factors you want to track (ie location, size, color of button, etc)
8. Since we are just checking whether they clicked it or not, there is not quantative value (like how long they watched a video for). Set “Use the Event value as the Goal Value for the conversion” to NO.
9. Using the example I made, that translates to this for the code:
<a href="#" onClick="_gaq.push(['_trackEvent', 'Maintenance Signup', 'Click', 'Request More Info']);">Request More Info</a>
10. You will want to replace the “#” with your real link.
11. For this to send data, you also have to get the Google Analytic Event Driven snippet and add it to your site. I just did this in the “debug” module position and put the code snippet in using Sourcerer.
12. That snippet is below and you will want to replace the UA-XXXXX-X with your Google ID:
var _gaq = _gaq || ;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script'); s.parentNode.insertBefore(ga, s);
YellowWebMonkey Web design offers reliable website design, SEO and digital marketing services for Joomla, WordPress and Shopify sites. We strive to be a one-stop shop for all your web needs.