Omniture SiteCatalyst - First Party Cookie Plugin

Ever wanted Omniture SiteCatalyst to use first party cookies instead of 3rd party cookies and your IT doesn’t allow to have your domain point to an Omniture server (CNAME DNS entry)?

Here’s the easy solution:

Simply put the following plugin into your s_code.js (or similar).
Should be placed somewhere after your config section and before the “DO NOT ALTER ANYTHING BELOW THIS LINE !” warning.


/*
* Plugin: getVID 0.1 - support first party cookies w/o CNAME
* Author: Andreas Dierl - http://adlytics.de/omtrfpc
*/
s.getVID = new Function(""
+"var s=this;var a=s.c_r('svid');if(!a){var b='abcdef1234567890'.spli"
+"t('');for(var n=0;n<32;n++){a+=b[Math.round(Math.random()*(b.length"
+"-1))]}var c=new Date;c.setTime(c.getTime()+5*365*24*60*60*1000);if("
+"!s.c_w('svid',a,c)){a=''}}return a");
s.visitorID=s.getVID();

That’s it.

Notes:
– existing visitor cookies will not be transferred -> all visitors will become new visitors. Best used for new implementations.
[Update 12/8/09] “Any existing Omniture-set visitorID (stored in the s_vi cookie) will be migrated to the new s.visitorID value one time without cliffing the visitor (counting the visitor twice and inflating visitor counts.” see http://blogs.omniture.com/2009/06/22/measuring-logged-in-visitors-without-cookies/
– The domain your request being sent to will not change. I will stay at your-namespace.your-dc.2o7.net
– Use the code above at your own risk. Always test before putting to production environments.
– Check that all your request contain the vid parameter

Omniture Debugger - First party cookie

Would be nice if you’d drop me a line if this works for you.
This plugin is published under the license of postcardware.

Have fun!
Andreas

P.S.: Thanks to Kevin from http://webanalyticsland.com/ for the beta test!