Having already gotten quite a bit of experience with Google Analytics under my belt (and certified), I've turned to Omniture SiteCatalyst. The product is vaguely similar to the soon-to-be-decommissioned Hitbox product that my firm has deployed for clients for years, but sort of better in most every way you need it to be. (More robust, more flexible, etc) I went thru the three day deployment course, learning the ins and outs of deploying the product and how to configure data collection to get the best possible reports out of it.
After the course was over, I found one real glaring omission I couldn't believe I had not caught during the course. It took me a few days to think of an efficient method around it, but it's important enough that I wanted to share it with others, in the spirit of the Internet's open learning environment.
Setup of the Problem Deploying SiteCatalyst
Deployment of SiteCatalyst, at its simplest, is the inclusion of two sets of Javascript tags on every page of your website. There's one include that references a JS function on your site, affectionately known as the "site code". The reference looks like this:
<script language="JavaScript" type="text/javascript" src="/js/sitecode.js"></script>
This is no problem, as it's the very same text on every page. You can include it in a page template for your content management system and it will be included on every page.
However the second piece of JavaScript on every page is more complicated. It's longer, and generally looks something like this:
<script language="JavaScript" type="text/javascript">
s.pageName=document.title; //set the page titles.server=""
s.channel=""
s.pageType=""
s.prop1=""
s.prop2=""
s.prop3=""
s.prop4=""
s.prop5=""
/* Conversion Variables */
s.campaign=""
s.state=""
s.zip=""
s.events=""
s.products=""
s.purchaseID=""
s.eVar1=""
s.eVar2=""
s.eVar3=""
s.eVar4=""s.eVar5=""
(At this point you call the function that records the data and sends it back to the Omniture servers, based upon the variables set above)
So, why can't you just stick this into your page template also, and have it included on every page? Well the variables set on this page actually are page-specific. Unless you have a good page title set in the <title> tag, you've got to set the pagename. And if this is a landing page for a specific campaign, you've got to set the "campaign" variable, and various other variables.
Basically, this blog of code is unique for many of your pages. You can't just shove it into a page template because on a small set of your pages, you're going to want to set some unique traffic and conversion variables. How was I going to hand edit this code into every page of a thousand+ page site whose content management system already performed slower than I wanted it to?
In fact, how does anyone hand edit this into an existing website with thousands of pages?
When I called Omniture Support, they had two unsatisfying answers. (This by the way is unusual for them. I've called Support several times and been really pleased with the response and enthusiasm) The first answer was "Engage Omniture Professional Services".
The second answer was "hand edit this code into every page of your site" is not an answer that works for any site with more than 100 pages.
The answer, I discovered, lay in the understanding that for most of my pages, this code is exactly the same. If I could just figure out a way to include the code on every page in such a way that I could override those defaults for a few select pages, I could save myself the trouble of hand editing all my content, and only edit those pages that have unique variables.
The Solution To Avoid Hand Editing Analytics Code Into All Your Pages
While I'm sure that there are more elegant ways of handling this, one answer lay in the ability of JavaScript to detect the presence of a function, and call it only if it exists. In short, I realized that I could:- Set the variables with default universal values;
- Check to see if there were any local modifications to those variables on this single page, and if so, set them; and then
- Call the function to report data to SiteCatalyst as normal.
Once I'd had this epiphany, I realized this code would be able to be universally placed on the templates of my content, letting me avoid the "hand edit every page" problem. I would then have to hand edit only pages that required specific values to override the defaults. The result is a block of code that looks like this. The new addition is in color:
<script language="JavaScript" type="text/javascript">
s.pageName=document.title; //set the page title
s.server=""
s.channel=""
s.pageType=""
s.prop1=""
s.prop2=""
s.prop3=""
s.prop4=""
s.prop5=""
/* Conversion Variables */
s.campaign=""
s.state=""
s.zip=""
s.events=""
s.products=""
s.purchaseID=""
s.eVar1=""
s.eVar2=""
s.eVar3=""
s.eVar4=""s.eVar5=""
/* If someone has declared a local function to do some page-specific
* SiteCatalyst tasks on this page, call it! If they haven't, this is skipped. */
if (typeof window.doLocalSC == 'function') {
doLocalSC();
- }
(At this point you call the function that records the data and sends it back to the Omniture servers, based upon the variables set above)
Basically I assume that any page that needs special variables will have a JavaScript function "doLocalSC()" defined. If it doesn't exist, I can continue on and call the SC reporting function. If it does, I can call it and override the default variables, after which I call the SC reporting function. Here's an example of one of those local setting functions:
- <script language="JavaScript" type="text/javascript">
- function doLocalSC() {
- s.prop1 = "ebook";
- s.campaign = "blahblahblah";
- s.pageName=document.getElementsByTagName("h3")[0].innerHTML;
- }
</script>
This would be a landing page for my ebook for a marketing campaign called "blahblahblah". I've set the campaign variable, the traffic property, and also set the pagename a little differently.
This really can reduce the amount of work you need to do to deploy SiteCatalyst, as the main block of code can go into a page template (one edit) and get included on all your content. Then you only need to concern yourself with hand-editing only those pages with truly unique settings to add "doLocalSC()" functions.
I don't have any idea how Omniture's Professional Services folks would suggest tackling this problem, but that's the solution that seems to greatly reduce the work for me. I'd be curious to hear other solutions from other fellow analytics nerds familiar with the product.

Comments