browser lang:en
This is a very simple, low impact, jQuery plugin that allows you to add Google onClick tracking with a couple simple lines to your site. Even if your links already have OnClick code, the tracking will just be appended to the existing code without breaking what already exists. Below are some samples of how it's used:
Usage
Variables:
analyticsaccount - your Google Analytics account #
referenceBy - acceptable values: "href", "html", "title", "name", "id" or combinations "location|href", "location|title", "location|html". If a combination is choosen, then the output in analytics looks like so:
For "location|href":
/LOCATION/current/page/location.html/HREF/www.theurlofthelinktracked.com/
For "location|title":
/LOCATION/current/page/location.html/TITLE/thelinktitletag/
For "location|html":
/LOCATION/current/page/location.html/HTML/click here/
onlyTrackClass - (optional) if you only wish to track links with a certain class name, use this
trackprefix - (optional) prefix text added prior to the tracking link reference. i.e. "/click/"
trackpostfix - (optional) postfix text added after to the tracking link reference. i.e. "/outbound/"
Sample Code
Standard usage for tracking links:
$(document).ready(function() {
$("a").easygoogleonclick({
analyticsaccount: "UA-XXXXXXX",
referenceBy: "location|href",
trackprefix: "/click/"
});
});
the above configuration allows you to see which page the links are clicked on, as well as where those links are pointing to. So for instance, say you have a banner ad and you'd like to know on which pages this ad is most effective. This would allow you to see which pages the banner ad was clicked on the most.
Or, say you want to just handle tracking of outgoing links, then you could use a class based configuration:
$(document).ready(function() {
$("a").easygoogleonclick({
analyticsaccount: "UA-XXXXXXX",
referenceBy: "href",
onlyTrackClass: "outgoing-link",
trackprefix: "/click-outgoing/",
});
});
Any links you add the class "outgoing-link" to will then be tracked and would track the click as something like: /click-outgoing/www.theoutgoinglink.com/
Overall, this makes for much more robust click tracking and will help you get a better reading of what your users are clicking on throughout your website.
Download
Plugin
Requires the jQuery URL Parser (included)
Download version:
alpha 0.8 - js files
PHP is one of the most widely used open-source server-side scripting languages that exist today. With over…
in:Scripts and tutorials (0 comments)In a FBML Facebook App, your quick jump menu will require a little tweak to work in FBJS…
in:Scripts and tutorials (0 comments)Every single day, someone, somewhere is discussing something important to your business; your brand, your executives, your…
in:Scripts and tutorials (0 comments)The Singleton Pattern is one of the GoF (Gang of Four) Patterns. This particular pattern provides a…
in:Scripts and tutorials (0 comments)Because of the near-spherical shape of the Earth, calculating an accurate distance between two points requires the use…
in:Scripts and tutorials (1 comments)With this script we can limit the download speed // local file that should be send to the client $local_file…
in:Scripts and tutorials (0 comments)Some hosts disabled the ini setting allow_url_fopen. This also means that the ability to easily grab images…
in:Scripts and tutorials (0 comments)The act to verify if a file exists, is one of more important tasks related to files operations,…
in:Scripts and tutorials (0 comments)
