Omniture-Google Keyword Position

This is still a work in process but you get the idea. You can add this code into your Omniture s_code.js file:
Omniture recently announced that “when consumers perform an organic search on Google and click on a result, rank and keyword data is now being passed to Omniture SiteCatalyst”. Although this statement is technically true, Omniture didn’t do anything new to make this happen as this information is now being passed via the Google referring URL which was already being captured by Omniture. What I expected was to see this baked into the product i.e. “lookie here, there is a new report called ‘keyword position’”, what I found is that Omniture will enable this for you if you request it.

Cool. Seems simple enough. It’s in the referring URL, why do I need Omniture to do it for me when I can easily do it myself?

the function
function gup( name )
if (document.referrer.indexOf(‘google’) > -1){
name = name.replace(/[\[]/,”\\\[").replace(/[\]]/,”\\\]”);
var regexS = “[\\?&]“+name+”=([^&#]*)”;
var regex = new RegExp( regexS );
var results = regex.exec( document.referrer );

if( results == null )
return “”;
return results[1];

the call
var getSearchPosition = gup( ‘cd’ );
if (getSearchPosition)
s.prop1 = getSearchPosition;

Date: May 27, 2012