In this blog post, I will show you how to automatically track every single link clicking on your website or manually track certain link clicking. This is useful to determine which links or click events are taking place on the site. Click events can be someone clicking on the left and right arrow the move a slider, flipping through panels on the page, or clicking on a button in a form.
1. The first thing you need to do is install Google Analytics on your site. This is done by going to www.Googleanalytics.com
2. Once you have create a website profile, you should be given the code snippet which should look something like this:
You will need to add a few lines of extra code right after the <script> tag in line 1. For X’s, add in your Google Analytics tracking id.
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-XX']);
_gaq.push(['_trackPageview']);
Place this code at the bottom of every single page on your site before the </html> tag.
3A. This next step will need to be done for EACH individual areas that you want to track. So for 3 panel slider, this step would be done for each panel so they can be tracked separately. The following website generates the Google Analytics code for.
http://marketylink.com/event_code_generator_for_Google_analytics.php
The following are what we suggest to keep your tracking organized.
Download/Link – This is the destination URL link that a person will be taken too once they click on the call to action.
Category – This is the type of link the tracking is being placed on. Here are some options to call different categories:
- Slider
- Banner
- Submit Button
- Hyperlink
Action – This is the type of action that can be applied to the link. Typically it will be a click, but some other suggestions can be:
- Click
- Scroll
- Double Click
Label – This is the unique label you want to apply to the tracking object.
Link Test – Just fill this out with anything. You won’t need this.
As an example, let’s say we wanted to track the 2nd panel of the homepage slider that when click on will go to: http://www.mywebsite.com/page2 So to track this I would put the following:
Download Link = http://www.mywebsite.com/page2
Category = Slider
Action = click
Label = Homepage Slider Panel 2
Link Text = link test
I would get the following code to use within my website.
HTML Code:
<a href="http://www.mywebsite.com/page2" onclick="_gaq.push(['_trackEvent', 'slider', 'click', 'homepage_slider_panel_2']);">link test</a>
onClick Code:
onclick="_gaq.push(['_trackEvent', 'slider', 'click', 'homepage_slider_panel_2']);"
From there, your web developer should know what to do with it.
For more information for setting up tracking code, please visit the documentation on Google Analytic’s website.
https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEventTracking
3B. If you want everything to be tracked on your site. Download the following Google Analytics link tracker code. Here and write the folloing lines of code within <head>…</head>.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="/ga-tracker.js"></script>
If you already have JQuery, you can leave out the first line of code.
4. After a few days have passed by and you have sufficient data to work with login into your Google Analytics account and go to Behavior -> Events -> Overview.
Download the GA Tracking Code Word doc.