This Google Analytics jQuery Plugin v1.0 - 19/10/2012 is designed to extend the standard Google Analytics Tracking Tag with a minimum amount of website modification. The primary features are:
Steps for implementation (detailed documentation below steps):
Default settings/options in the plugin:
The above default options can be overridden by adding the options and corresponding changes to the function/plugin call from your webpages or website template.
Default implementation to track a single domain and single property ID. This also tracks clicks on file downloads, clicks on email links and clicks on external domain links (external domain links are tracked as an event).
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://www.yourdomain.com/yourpath/jquery.izilla.sd.analytics.tracker.min.js"></script>
<script>
$(document).ready(function() {
$('a').isdAnalyticsTracker();
});
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Implementation for cross domain tracking, which passes session details by the GA _link() function and a single property ID. This also tracks clicks on file downloads, clicks on email links and clicks on external domain links. Any domains listed as domains for cross domain tracking will not be tracked as an external domain click event, as the destination page should contain the same asynchronous Google Analytics Tracking Tag with the identical Property ID number (UA-XXXXXXX-X) as the originating domain.
In the example below, we have added an exclusion flag for any links that you do not want to track, just add the link to a CSS Class .exclude and it will be ignored when clicked.
Note: Examples for each step below are in the following code block.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://www.yourdomain.com/yourpath/jquery.izilla.sd.analytics.tracker.min.js"></script>
<script>
$(document).ready(function() {
$('a').isdAnalyticsTracker({
'trackCrossDomain': true,
'domains': 'yourdomain2.com',
});
});
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', 'UA-XXXXXXX-X'],
['_setDomainName', 'yourdomain.com'],
['_setAllowLinker', true],
['_trackPageview']
);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Implementation for cross domain tracking, which passes session details by the GA _link() function and multiple Property IDs (2 or more). This also tracks clicks on file downloads, clicks on email links and clicks on external domain links and pushes the page views and events to all Property IDs listed. Any domains listed as domains for cross domain tracking will not be tracked as an external domain click event, as the destination page should contain the same asynchronous Google Analytics Tracking Tag with the identical Property ID number (UA-XXXXXXX-X) as the originating domain.
In the example below, we have added an exclusion flag for any links that you do not want to track, just add the link to a CSS Class .exclude and it will be ignored when clicked.
Note: Examples for each step below are in the following code block.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://www.yourdomain.com/yourpath/jquery.izilla.sd.analytics.tracker.min.js"></script>
<script>
$(document).ready(function() {
$('a').isdAnalyticsTracker({
'trackCrossDomain': true,
'domains': 'yourdomain2.com',
'trackAlternatePropertyIDs': true,
'alternatePropertyIDs': 'isd2, isd3'
});
});
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', 'UA-XXXXXXX-1'],
['_setDomainName', 'yourdomain.com'],
['_setAllowLinker', true],
['_trackPageview'],
['isd2._setAccount', 'UA-XXXXXXX-2'],
['isd2._setDomainName', 'yourdomain.com'],
['isd2._setAllowLinker', true],
['isd2._trackPageview']
['isd3._setAccount', 'UA-XXXXXXX-3'],
['isd3._setDomainName', 'yourdomain.com'],
['isd3._setAllowLinker', true],
['isd3._trackPageview']
);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
The Google Analytics jQuery Plugin v1.0 - 19/10/2012 is designed to allow cross domain session tracking, multiple property IDs, event tracking for external links and page views for downloaded files. This is a very comprehensive and easy to use method of implementing Google Analytics tracking tags with many advanced features of Google Analytics already included.
Below is an example of how the code is added to this website through Google Tag Manager. It can be used and called directly from your website, or it can be added to the Google Tag Manager as a Custom HTML Tag Type and the GTM code then calls the Google Analytics jQuery Plugin for you.
As soon as the documentation is complete, it will be available for download from https://github.com/izilla/
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://www.yourdomain.com/yourpath/jquery.izilla.sd.analytics.tracker.min.js"></script>
<script>
$(document).ready(function() {
$('a:not(.exclude)').isdAnalyticsTracker({
'trackCrossDomain': true,
'domains': 'intellectiveweb.net, falley.org',
'trackAlternatePropertyIDs': true,
'alternatePropertyIDs': 'isd2, isd3'
});
});
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', 'UA-32857002-1'],
['_setDomainName', 'searchanddisplay.com.au'],
['_setAllowLinker', true],
['_trackPageview'],
['isd2._setAccount', 'UA-1522975-1'],
['isd2._setDomainName', 'searchanddisplay.com.au'],
['isd2._setAllowLinker', true],
['isd2._trackPageview'],
['isd3._setAccount', 'UA-2461352-1'],
['isd3._setDomainName', 'searchanddisplay.com.au'],
['isd3._setAllowLinker', true],
['isd3._trackPageview']
);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
google.com
facebook.com
twitter.com
www.yourdomain.com/yourpage.html
relative a.html
relative a.html
relative b.html
relative.pdf
relative.docx
This email address is being protected from spambots. You need JavaScript enabled to view it.