Forum Moderators: DixonJones

Message Too Old, No Replies

Google Analytics changed their snippet code

         

jlara

2:28 pm on Dec 14, 2007 (gmt 0)

10+ Year Member Top Contributors Of The Month



I looks like Google Analytics very recently updated their snippet code:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol)? "https://ssl." : "http://www.");
document.write("\<script src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'>\<\/script>" );
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-#*$!#*$!X-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

It looks like a one stop solution for the http vs. https issue. Also no more mention of Urchin.

Interesting...

The code is a little bit longer as well.

pageoneresults

3:58 pm on Dec 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I caught that too. Unfortunately the instructions are not real clear on what to do. They say not to use both together on the same page. I would assume the first script element is for https and the second for http. If they are together on the page, it doesn't validate. I tried it real quickly yesterday and got asp errors when those two elements are present on a page.

pbradish

2:11 pm on Dec 18, 2007 (gmt 0)

10+ Year Member



I'd be curious to know more about the code before implementing. I was a little afraid to copy and paste due to our HTTP/HTTPS.