Minimal Link Tracking With Omniture
NOTE: This post assumes you know a lil somethin’ somethin’ about Omniture and jQuery.
There are a few different ways you can implement Link Tracking for SiteCatalyst Reporting, but this post will cover the most basic way. This basic implementation just uses an instance of the custom link to be tracked. I wanted to track link clicks without using props, evars or events, so this basic implementation works great for just that. Let’s get started!
The tl function has three parameters:
- The “this” object is required.
- The link type(e=exit link, d=download link and o=generic custom link).
- The link name(arbitrary).
For this implementation, the s.linkTrackVars parameter is required and must be set to none to avoid passing in all s variables from the page it is on. Thanks for clarifying that @OmnitureCare. If you are using the Omniture core JS file, by default, this will be set there and is not necessary in the page level function.
Here’s the code:
$('#element a').click(function(){ s.linkTrackVars="none"; //not necessary if set in Omniture JS core. s.tl(this,'o','Arbitrary Link Name'); });
You can verify that the image request is going through by using a web analytics tool like Charles or by checking the report in SiteCatalyst by going to Site Content > Links > Custom Links.
Shout out to @usujason, @JenniKunz, @OmnitureCare and @ad0815 for clarifying the facts about Link Tracking.
Please let me know what you think or if you see anything that is incorrect in this post. I love to learn from others, as I did with my Link Tracking experience.
Great post. Thanks for putting this together.
So I’m attempting to implement this and am using your code verbatim as a test. I keep receiving “s.tl is not a function” errors when I click on any of my links.
Have you encountered this before?
The s.tl function is set in the Omniture javascript core file. Do you have this file referenced in your code? If, so make sure s.linkTrackVars is set to “None” and that the core file is loaded before your link tracking code.
Mr. Interactive – you rawk! This post saved me time and tears. -Nash.
Thanks for this great post – simple and elegant. But, dumb question… where in my page code should this go?
@MitchellT the code should go before the closing body tag, but after the Omniture code core file.
Hi,
I want to track the number document downloads in the website and page is developed in SharePoint. want to track multiple documents by using above script in tag manager. Could you please explain how I can define that s.tl function for multiple link name. What should I define in Arbitrary Link Name in s.tl()