Query Parameter Fun

Nine times out of ten if I’m pulling a parameter out of the query string, it has something to do with campaign tracking.

s.campaign = s.getQueryParam('cid');

However, when automating your measurement implementation, there is often a wealth of information that can be pulled from the query string. If you are making use of the Omniture ‘getQueryParam’ plugin, remember (I had forgotten) that the plugin can be used to pull query string values out of strings other than the current URL.

Just the other day, I was addressing a requirement to track interaction with social media bookmark buttons supplied by AddThis.com


I needed to capture which social media service was being used and what page was being bookmarked. I was able to make use of getQueryParam along with the linkHandler plugin to get everything I needed.

Example exit link:
http://www.addthis.com/bookmark.php?&s=facebook&title=i%20can%20has%20cheezburger

Output:
s.eVar1 = “facebook”;
s.eVar2 = “i can has cheezburger”;

var url=s.linkHandler("Social Media~addthis.com","e");
   if(url){
     s.events=s.apl(s.events,"event1",",",2);
     s.eVar1=s.getQueryParam('s','',url);
     s.eVar2=s.getQueryParam('title','',url);

     //Track eVar & Event
     s.linkTrackVars="eVar1,eVar2,events";
     s.linkTrackEvents="event1";
  }

1. I used s.linkHandler to capture exit links for the URL ‘addthis.com’

2. event1 denoted a ‘social bookmark’ event

3. In the exit link URL ‘s’ is the social network being utilized and ‘title’ is the page being bookmarked.

4. I used s.getQueryParam to pull the query string values from the exit link captured by s.linkHandler (notice the 3rd argument, I passed in the URL string generated by the linkHandler plug-in).

Lesson Learned: Query parameters have more uses than just campaign tracking!

Bonus Code:
A friend of mine was working on a issue where a client needed to pull multiple campaign tracking codes, all with the same parameter name, from the query string and concatenate them together. In this case, there were N number of times that ‘cid’ could appear within the query string. I have no idea what the business case was, although now I’m very interested, but here is the code that will solve the problem.

Example link:

http://www.site.com?cid=value1&cid=value2&cid=value3

Output:
s.campaign = “value1:value2:value3″;


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.

One Comment

  1. Posted August 15, 2010 at 6:08 pm | Permalink

    Jason,

    Very clever use of the link handler plugin. I wonder what other things could be handled this way. Got me thinking….

    -Rudi

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