<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Optimizing The SiteCatalyst Page Code</title>
	<atom:link href="http://webanalyticsland.com/sitecatalyst-implementation/optimizing-the-sitecatalyst-page-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://webanalyticsland.com/sitecatalyst-implementation/optimizing-the-sitecatalyst-page-code/</link>
	<description>Omniture SiteCatalyst Implementation Optimization.</description>
	<lastBuildDate>Fri, 20 Aug 2010 16:55:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Nariman Haghighi</title>
		<link>http://webanalyticsland.com/sitecatalyst-implementation/optimizing-the-sitecatalyst-page-code/comment-page-1/#comment-123</link>
		<dc:creator>Nariman Haghighi</dc:creator>
		<pubDate>Thu, 17 Dec 2009 14:16:44 +0000</pubDate>
		<guid isPermaLink="false">http://webanalyticsland.com/?p=43#comment-123</guid>
		<description>@ThirdWishER: like the strategy of using setTimeout to delay the s.t() invocation (I&#039;ve tested it successfully, even with a delay as large as 5000 ms); however, I&#039;m not sure why this works as t() will invoke a document.write which you can confirm by overriding     document.write = function(s) { alert(s); } and watching it alert the  tag. 

My understanding is that a document.write after onload will replace the body so why does setTimeout(DoSCWork, 5000) work when the following replaces the body?

    function helloWorld() {
        document.write(&quot;hello world!&quot;);
    }
    
    setTimeout(helloWorld, 5000); 

@VaBeachKevin: where&#039;s the &quot;here&#039;s how I currently do it&quot; post?</description>
		<content:encoded><![CDATA[<p>@ThirdWishER: like the strategy of using setTimeout to delay the s.t() invocation (I&#8217;ve tested it successfully, even with a delay as large as 5000 ms); however, I&#8217;m not sure why this works as t() will invoke a document.write which you can confirm by overriding     document.write = function(s) { alert(s); } and watching it alert the  tag. </p>
<p>My understanding is that a document.write after onload will replace the body so why does setTimeout(DoSCWork, 5000) work when the following replaces the body?</p>
<p>    function helloWorld() {<br />
        document.write(&#8220;hello world!&#8221;);<br />
    }</p>
<p>    setTimeout(helloWorld, 5000); </p>
<p>@VaBeachKevin: where&#8217;s the &#8220;here&#8217;s how I currently do it&#8221; post?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VaBeachKevin</title>
		<link>http://webanalyticsland.com/sitecatalyst-implementation/optimizing-the-sitecatalyst-page-code/comment-page-1/#comment-115</link>
		<dc:creator>VaBeachKevin</dc:creator>
		<pubDate>Mon, 23 Nov 2009 20:26:50 +0000</pubDate>
		<guid isPermaLink="false">http://webanalyticsland.com/?p=43#comment-115</guid>
		<description>No, you need to call the s_code.js file before you set any of the variables. This is one instance where you would want the s_code file to be called high up in the page. If you set a lot of variables right in the page you may want to do something like
&lt;strong&gt;sProp1=&quot;Whatever&quot;;&lt;/strong&gt;

and then in the s_code.js file have
&lt;strong&gt;if (window.sProp1) s.prop1=sProp1;&lt;/strong&gt;</description>
		<content:encoded><![CDATA[<p>No, you need to call the s_code.js file before you set any of the variables. This is one instance where you would want the s_code file to be called high up in the page. If you set a lot of variables right in the page you may want to do something like<br />
<strong>sProp1=&#8221;Whatever&#8221;;</strong></p>
<p>and then in the s_code.js file have<br />
<strong>if (window.sProp1) s.prop1=sProp1;</strong></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VaBeachKevin</title>
		<link>http://webanalyticsland.com/sitecatalyst-implementation/optimizing-the-sitecatalyst-page-code/comment-page-1/#comment-114</link>
		<dc:creator>VaBeachKevin</dc:creator>
		<pubDate>Mon, 23 Nov 2009 20:15:49 +0000</pubDate>
		<guid isPermaLink="false">http://webanalyticsland.com/?p=43#comment-114</guid>
		<description>I couldn&#039;t agree with you more! I actually have changed the way I personally do things myself and what I do is pretty different than what I have listed here. When I originally wrote this I took my personal experiences along with what Omniture did themselves on their own site and put together a few suggestions. If you look at this very own site, you will see what I am doing is pretty different. I guess my coding has evolved a bit ;) Stay tuned for a &quot;Here&#039;s how I currently do it&quot; post coming very soon. Thanks for your input!</description>
		<content:encoded><![CDATA[<p>I couldn&#8217;t agree with you more! I actually have changed the way I personally do things myself and what I do is pretty different than what I have listed here. When I originally wrote this I took my personal experiences along with what Omniture did themselves on their own site and put together a few suggestions. If you look at this very own site, you will see what I am doing is pretty different. I guess my coding has evolved a bit <img src='http://webanalyticsland.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Stay tuned for a &#8220;Here&#8217;s how I currently do it&#8221; post coming very soon. Thanks for your input!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nos</title>
		<link>http://webanalyticsland.com/sitecatalyst-implementation/optimizing-the-sitecatalyst-page-code/comment-page-1/#comment-113</link>
		<dc:creator>nos</dc:creator>
		<pubDate>Thu, 19 Nov 2009 11:44:32 +0000</pubDate>
		<guid isPermaLink="false">http://webanalyticsland.com/?p=43#comment-113</guid>
		<description>Is it possible to set variables such as s.events on your page prior to loading the global JS file? Note I have s.t() in the global file so I thought it shouldn&#039;t be an issue. However, my custom code isnt being picked up.</description>
		<content:encoded><![CDATA[<p>Is it possible to set variables such as s.events on your page prior to loading the global JS file? Note I have s.t() in the global file so I thought it shouldn&#8217;t be an issue. However, my custom code isnt being picked up.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ThirdWishER</title>
		<link>http://webanalyticsland.com/sitecatalyst-implementation/optimizing-the-sitecatalyst-page-code/comment-page-1/#comment-112</link>
		<dc:creator>ThirdWishER</dc:creator>
		<pubDate>Tue, 27 Oct 2009 23:27:39 +0000</pubDate>
		<guid isPermaLink="false">http://webanalyticsland.com/?p=43#comment-112</guid>
		<description>This blog entry is pretty misleading. All of the &quot;performance enhancements&quot; are pretty negligible. One of the recommendation actually makes the page even slower.  The part I am referring to is where you recommend to more the s_code.js file to the top.  

Modern web site performance best practices tell you to delay the loading of JavaScript to the end of the page. This is for code that is not required toward the top of the page.  I am not sure if you know this or not, but JavaScript loading causes a blocking effect. By telling people to move something to the top, the browser will now need to process the download of the file and processing of the JavaScript blocks before it can continue to the next tag of HTML.  Considering that the s_code is a terribly written piece of code, it&#039;s a very costly change. Having it at the top will cause some sites to appear with a white background, while their are loading this support file, instead of continuing to load important files like CSS, other JS library files.

Here is what I have done when creating sites that use SiteCatalyst bloated code.

1. Add all of the code mentioned below to the very bottom of the page, right before the closing body tag. This will assure that you&#039;re content loads first, the user is able to interact with your page before SiteCatalyst takes it over.

2. You can remove the noscript tag, but other than the 187 bytes the removal saves, it doesn&#039;t hurt anything to leave it there. It ONLY processes when you have JavaScript is disabled. So this change doesn&#039;t matter, it could actually break your support if you remove it since they told you not to.

3. Other than the properties, this is the meat of the code...  the most costly one too: var s_code=s.t();if(s_code)document.write(s_code)

I have found a way to make sure that the processing of this code is not blocking anything else, like the onload event from triggering.  So what I did is I wrapped that code in a function like this:

function DoSCWork()
{
    var s_code=s.t();if(s_code)document.write(s_code)
}

I also added this line after the function:

setTimeout(DoSCWork, 50);

What this does is it delays the execution for 50 milliseconds.  The delay doesn&#039;t matter as much as what the side effect is. By calling it through set timeout, it will execute that code a-sync.  This way the rest of the page can continue while the SC code executes in the background.

This also removes the dependency on omniture&#039;s terrible code and unreliable DNS, since it doesn&#039;t resolve quickly all the time.

----------

These suggestions should help anyone that has a high traffic site and should minimize the hit of dealing with omniture so you are not held hostage since they refuse to fix their problems.

I am having more advanced issues where I can&#039;t do anything about it.  The way that S_Code.js is setup, the browser has to take even longer to interpret their code strings to executable code. Their use of the &quot;new Function&quot; class slows down processing even more. Sometimes it hangs the browser if you have pages with large amount of content. I have a situation where I HAVE TO DISPLAY 1000+ table rows of results. The results render ultra fast, but the fact that SC is doing a document write of s.t() is really messing up performance for me.  In my example it&#039;s harder to deal with, because I can&#039;t change their minified JS.

If anyone has any suggestions to encapsulating the execution of s_code.js, please let me know.</description>
		<content:encoded><![CDATA[<p>This blog entry is pretty misleading. All of the &#8220;performance enhancements&#8221; are pretty negligible. One of the recommendation actually makes the page even slower.  The part I am referring to is where you recommend to more the s_code.js file to the top.  </p>
<p>Modern web site performance best practices tell you to delay the loading of JavaScript to the end of the page. This is for code that is not required toward the top of the page.  I am not sure if you know this or not, but JavaScript loading causes a blocking effect. By telling people to move something to the top, the browser will now need to process the download of the file and processing of the JavaScript blocks before it can continue to the next tag of HTML.  Considering that the s_code is a terribly written piece of code, it&#8217;s a very costly change. Having it at the top will cause some sites to appear with a white background, while their are loading this support file, instead of continuing to load important files like CSS, other JS library files.</p>
<p>Here is what I have done when creating sites that use SiteCatalyst bloated code.</p>
<p>1. Add all of the code mentioned below to the very bottom of the page, right before the closing body tag. This will assure that you&#8217;re content loads first, the user is able to interact with your page before SiteCatalyst takes it over.</p>
<p>2. You can remove the noscript tag, but other than the 187 bytes the removal saves, it doesn&#8217;t hurt anything to leave it there. It ONLY processes when you have JavaScript is disabled. So this change doesn&#8217;t matter, it could actually break your support if you remove it since they told you not to.</p>
<p>3. Other than the properties, this is the meat of the code&#8230;  the most costly one too: var s_code=s.t();if(s_code)document.write(s_code)</p>
<p>I have found a way to make sure that the processing of this code is not blocking anything else, like the onload event from triggering.  So what I did is I wrapped that code in a function like this:</p>
<p>function DoSCWork()<br />
{<br />
    var s_code=s.t();if(s_code)document.write(s_code)<br />
}</p>
<p>I also added this line after the function:</p>
<p>setTimeout(DoSCWork, 50);</p>
<p>What this does is it delays the execution for 50 milliseconds.  The delay doesn&#8217;t matter as much as what the side effect is. By calling it through set timeout, it will execute that code a-sync.  This way the rest of the page can continue while the SC code executes in the background.</p>
<p>This also removes the dependency on omniture&#8217;s terrible code and unreliable DNS, since it doesn&#8217;t resolve quickly all the time.</p>
<p>&#8212;&#8212;&#8212;-</p>
<p>These suggestions should help anyone that has a high traffic site and should minimize the hit of dealing with omniture so you are not held hostage since they refuse to fix their problems.</p>
<p>I am having more advanced issues where I can&#8217;t do anything about it.  The way that S_Code.js is setup, the browser has to take even longer to interpret their code strings to executable code. Their use of the &#8220;new Function&#8221; class slows down processing even more. Sometimes it hangs the browser if you have pages with large amount of content. I have a situation where I HAVE TO DISPLAY 1000+ table rows of results. The results render ultra fast, but the fact that SC is doing a document write of s.t() is really messing up performance for me.  In my example it&#8217;s harder to deal with, because I can&#8217;t change their minified JS.</p>
<p>If anyone has any suggestions to encapsulating the execution of s_code.js, please let me know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VaBeachKevin</title>
		<link>http://webanalyticsland.com/sitecatalyst-implementation/optimizing-the-sitecatalyst-page-code/comment-page-1/#comment-84</link>
		<dc:creator>VaBeachKevin</dc:creator>
		<pubDate>Tue, 18 Aug 2009 15:39:55 +0000</pubDate>
		<guid isPermaLink="false">http://webanalyticsland.com/?p=43#comment-84</guid>
		<description>Yes if you have the s.t() call outside your body tags it could effect any onclick tracking that you are doing. But placing the call to the s_code file, and only this call, outside the body tags should not effect any suctom link tracking (s.tl calls) that you are doing. But we ahve seen that by placing the s_code call outside the body tags it will effect other things, such as the Connection Types report. My suggestion is to place the s_code call somewhere between the opening and closing body tags to prevent any errors that may occur. We&#039;d rather be safe than sorry. :)</description>
		<content:encoded><![CDATA[<p>Yes if you have the s.t() call outside your body tags it could effect any onclick tracking that you are doing. But placing the call to the s_code file, and only this call, outside the body tags should not effect any suctom link tracking (s.tl calls) that you are doing. But we ahve seen that by placing the s_code call outside the body tags it will effect other things, such as the Connection Types report. My suggestion is to place the s_code call somewhere between the opening and closing body tags to prevent any errors that may occur. We&#8217;d rather be safe than sorry. <img src='http://webanalyticsland.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://webanalyticsland.com/sitecatalyst-implementation/optimizing-the-sitecatalyst-page-code/comment-page-1/#comment-83</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Tue, 18 Aug 2009 04:50:09 +0000</pubDate>
		<guid isPermaLink="false">http://webanalyticsland.com/?p=43#comment-83</guid>
		<description>Richard is correct here.  Any onclick tracking you&#039;re doing on a site will not work correctly if you have your reference outside of the body tag.</description>
		<content:encoded><![CDATA[<p>Richard is correct here.  Any onclick tracking you&#8217;re doing on a site will not work correctly if you have your reference outside of the body tag.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VaBeachKevin</title>
		<link>http://webanalyticsland.com/sitecatalyst-implementation/optimizing-the-sitecatalyst-page-code/comment-page-1/#comment-16</link>
		<dc:creator>VaBeachKevin</dc:creator>
		<pubDate>Thu, 02 Apr 2009 19:09:43 +0000</pubDate>
		<guid isPermaLink="false">http://webanalyticsland.com/?p=43#comment-16</guid>
		<description>I have implemented SiteCatalyst on over 90 sites and have never seen any issues with having the s_code file in the head, but that doesn&#039;t mean there is something I have missed. I will absolutely review some of my implementations and see if there has been something I have overlooked. The only reason I said to move it it just for housekeeping reasons (I&#039;m anal about my code) and I like to keep everything nice and neat. You make some real good points and I appreciate it. Thanks for your input.</description>
		<content:encoded><![CDATA[<p>I have implemented SiteCatalyst on over 90 sites and have never seen any issues with having the s_code file in the head, but that doesn&#8217;t mean there is something I have missed. I will absolutely review some of my implementations and see if there has been something I have overlooked. The only reason I said to move it it just for housekeeping reasons (I&#8217;m anal about my code) and I like to keep everything nice and neat. You make some real good points and I appreciate it. Thanks for your input.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard</title>
		<link>http://webanalyticsland.com/sitecatalyst-implementation/optimizing-the-sitecatalyst-page-code/comment-page-1/#comment-15</link>
		<dc:creator>Richard</dc:creator>
		<pubDate>Thu, 02 Apr 2009 15:07:24 +0000</pubDate>
		<guid isPermaLink="false">http://webanalyticsland.com/?p=43#comment-15</guid>
		<description>Sorry, looks like I forgot to edit the question and answer that I copied from the SiteCatalyst knowledgebase.  Where my previous comment says &quot;What are the repercussions of placing the SiteCatalyst code in the tag&quot;, that should read:

What are the repercussions of placing the SiteCatalyst code in the [head].  I left that as an HTML tag that the comment code on this site is cleaning up.  Sorry for the confusion.</description>
		<content:encoded><![CDATA[<p>Sorry, looks like I forgot to edit the question and answer that I copied from the SiteCatalyst knowledgebase.  Where my previous comment says &#8220;What are the repercussions of placing the SiteCatalyst code in the tag&#8221;, that should read:</p>
<p>What are the repercussions of placing the SiteCatalyst code in the [head].  I left that as an HTML tag that the comment code on this site is cleaning up.  Sorry for the confusion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard</title>
		<link>http://webanalyticsland.com/sitecatalyst-implementation/optimizing-the-sitecatalyst-page-code/comment-page-1/#comment-14</link>
		<dc:creator>Richard</dc:creator>
		<pubDate>Thu, 02 Apr 2009 15:02:27 +0000</pubDate>
		<guid isPermaLink="false">http://webanalyticsland.com/?p=43#comment-14</guid>
		<description>Perhaps Omniture doesn&#039;t care about any of the impacted features for their own website.  How many people are going to have www.omniture.com set as their homepage?  
 
However, I can 100% absolutely tell you that they discourage this practice.  I have spoken directly with principal members of their engineering team, and I have a quote for you from the SiteCatalyst knowledge base.
 
This question was answered on Sep 18, 2008, and the question was &quot;What are the repercussions of placing the SiteCatalyst code in the  tag?&quot;
 

If the SiteCatalyst code is placed in the  tag, several features will be impacted. Certain aspects of SiteCatalyst tracking rely on the existence of the body object, which is not created until the  tag is reached. Specifically, Custom Link Tracking, file downloads, exit links, and ClickMap tracking require the document body and will not work correctly if SiteCatalyst code is placed outside of the  tags. Additionally, SiteCatalyst code relies on having a valid document and body for many of the other things it tracks (home page, connection type, browser height, browser width, etc. ). For this reason, Omniture recommends that you place the SiteCatalyst code as high on the page as possible within the body tags. SiteCatalyst JavaScript code should never be placed in the  of the document.

 
Now, you may say that this simply is referring to the .t() function call which triggers the page view.  However, I can tell you that I have tested implementations myself with the .js file reference in the [head] and the .t() call in the body, and the impacts are real.  You can refuse to believe this if you wish, but this has been vetted and tested over and over.

Specifically, IE 6.0, 7.0 &amp; 8.0 will not populate the connection type and homepage flags if the .js reference is in the [head], no matter where you put the .t() call to trigger the page view.

There may be other impacts for which I have not specifically tested, but to say there is no impact created by placing the .js reference in the [head] is misleading your readers.

Outside of that, I totally agree with your other points in this article, and thank you for the opportunity to express my opinion on your site.</description>
		<content:encoded><![CDATA[<p>Perhaps Omniture doesn&#8217;t care about any of the impacted features for their own website.  How many people are going to have <a href="http://www.omniture.com" rel="nofollow">http://www.omniture.com</a> set as their homepage?  </p>
<p>However, I can 100% absolutely tell you that they discourage this practice.  I have spoken directly with principal members of their engineering team, and I have a quote for you from the SiteCatalyst knowledge base.</p>
<p>This question was answered on Sep 18, 2008, and the question was &#8220;What are the repercussions of placing the SiteCatalyst code in the  tag?&#8221;</p>
<p>If the SiteCatalyst code is placed in the  tag, several features will be impacted. Certain aspects of SiteCatalyst tracking rely on the existence of the body object, which is not created until the  tag is reached. Specifically, Custom Link Tracking, file downloads, exit links, and ClickMap tracking require the document body and will not work correctly if SiteCatalyst code is placed outside of the  tags. Additionally, SiteCatalyst code relies on having a valid document and body for many of the other things it tracks (home page, connection type, browser height, browser width, etc. ). For this reason, Omniture recommends that you place the SiteCatalyst code as high on the page as possible within the body tags. SiteCatalyst JavaScript code should never be placed in the  of the document.</p>
<p>Now, you may say that this simply is referring to the .t() function call which triggers the page view.  However, I can tell you that I have tested implementations myself with the .js file reference in the [head] and the .t() call in the body, and the impacts are real.  You can refuse to believe this if you wish, but this has been vetted and tested over and over.</p>
<p>Specifically, IE 6.0, 7.0 &amp; 8.0 will not populate the connection type and homepage flags if the .js reference is in the [head], no matter where you put the .t() call to trigger the page view.</p>
<p>There may be other impacts for which I have not specifically tested, but to say there is no impact created by placing the .js reference in the [head] is misleading your readers.</p>
<p>Outside of that, I totally agree with your other points in this article, and thank you for the opportunity to express my opinion on your site.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
