Omniture: Capture Download Link Text (code by @ad0815)

Recently I had a client request to capture the link text associated with PDF downloads from their site. I scratched my head for awhile and finally decided the best option was to ask the Twitter community for help.

My good buddy Andreas came to the rescue.

The Goal
Capture ‘The Dude – A Complete Biography’, from the link below, into a custom conversion variable.

The Dude - A Complete Biography

The Code

var url=s.linkHandler(".pdf","d");
if(url){
            var currentobj=s.eo?s.eo:s.lnk;
            if (currentobj && currentobj.innerHTML) {
                        s.eVar1 = currentobj.innerHTML;
                        s.linkTrackVars="eVar1";
            }
}

The Result

s.eVar1="The Dude - A Complete Biography";

Thanks Andreas, the code is clean, concise, and accomplished exactly what I needed!

NOTE: The above requires the addition of the linkHandler plugin to your s_code.js file.


Jason Thompson

Jason is the Sr. Director of Community Solutions at Keystone Solutions. If you are interested in partnering with Jason at Keystone, in need of analytics & optimization consulting, or looking for employment/internship possibilities, please feel free to email ‘jason [at] keystonesolutions [dot] com’

Twitter - Facebook - More Posts

This entry was posted in Omniture SiteCatalyst. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

Switch to our mobile site