Google Analytics Code on Shopsite

General ShopSite user discussion

Google Analytics Code on Shopsite

Postby davidroth » Mon Jan 31, 2011 10:35 am

Ok, I've tried this a number of ways. The analytics wizard puts all the google analytics code just before the </body> tag, which is how I've always done it. Now with the new code, it says it should go just before the </HEAD> tag. The problem is that the WIZARD inserts the code just before the closing body tag. See here...

http://www.google.com/support/analytics/bin/answer.py?hl=en_US&answer=174090&utm_id=ad

Ok, now I wouldn't care if I could just insert the code where I want to. I'm able to do it within my custom template for Shopping/Product Pages. I have a shopping cart template, but when I insert the code there, it will only put the code in my ORDER page. It will not insert it into my CHECKOUT or THANK YOU page. It seems to just strip it out.

I'm running the latest Shopsite version, just upgraded from Lexiconn. Any ideas? Why is shopsite still inserting code at the BODY tag, when Google analytics is now calling for it to be done before the HEAD tag?
davidroth
 
Posts: 18
Joined: Mon Oct 02, 2006 5:06 am

Re: Google Analytics Code on Shopsite

Postby davidroth » Mon Jan 31, 2011 11:10 am

I actually have 2 sites and I just tried it on another site and I'm seeing the code just AFTER the closing HEAD tag. Hmmm.
davidroth
 
Posts: 18
Joined: Mon Oct 02, 2006 5:06 am

Re: Google Analytics Code on Shopsite

Postby Jim » Mon Jan 31, 2011 11:39 am

What version of ShopSite are the 2 stores?
What version of Google Analytics are you trying to use?

Google has had at least 3 versions of their analytics code
Asynchronous Google Tracking
New Google Tracking (ga.js)
Old Google Tracking (urchin.js)

ShopSite tries to keep updated to the new features Google adds as we release new versions of ShopSite but older versions of ShopSite won't have the ability to handle the newer versions of the Google code.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Google Analytics Code on Shopsite

Postby davidroth » Mon Jan 31, 2011 11:47 am

Both are ShopSite® Pro 10 sp2 r2.4

And this is the documentation it sends me to, so I'm assuming that it's Asynchronous Google Tracking.

http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html

I've tried both the "new" tracking and the "Asynchronous Google Tracking" and it never places the code before the closing HEAD tag, like Google suggests.

Like I said, I was able to place the code in the template on my Home/Category/Shopping and then the ORDER page so Analytics will track from there. I'm NOT able to get the code to appear on the Checkout/Thank you page.
davidroth
 
Posts: 18
Joined: Mon Oct 02, 2006 5:06 am

Re: Google Analytics Code on Shopsite

Postby Jim » Mon Jan 31, 2011 12:27 pm

Here are some comments from our tech team.
==========================
1) The latest Asynchronous tracking code from Google Analytics can go in
the head section (yes, that is what Google recommends), however ShopSite
also supports both of the older versions of Google Analytics code which
should be placed at the bottom of the HTML contents in order to not slow
down the page load.

2) It is possible that the code that ShopSite generated on the page is
not exactly what the merchant entered in the backoffice, this is because
ShopSite does not use that code verbatim, it just parses it to get the
Google Analytics site ID from the code (such as UA-1234567-2),
which it will then use in its own version of the Google
Analytics code it generates in the page.

The placement of the code may also be determined by whether the store
page domain urls match the shopping cart domain urls. If they don't then different
code is needed to keep the tracking continuous across the different domains.
=====================
So yes, Google does recommend adding the code to the head of the page
but it will work if it is not in the head. Because ShopSite needs to be able to
support what ever form the merchant has configured we place it at the bottom
of the body. (Having the code in the head of the page may slow down page load
if there is a problem contacting Google to get the script)

If the you want to place the code in the head section then
you can turn off the ShopSite built-in Google Analytics
integration, and instead modify your page templates (and
probably shopping cart and customer registration templates, too) and
insert the Google code in the head section of the template(s).
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Google Analytics Code on Shopsite

Postby davidroth » Mon Jan 31, 2011 2:28 pm

Ok thanks Jim.

I have Shopsite installed on a subdomain with a separate host that my top-level domain. Because of that, I need special code inserted that will track it across domains. I think Shopsite is stripping out that code that I need in there. So I'm guessing that my best bet is to try and get it inside the templates. It seemed to work ok on my page/product/checkout pages. For some reason, it's not showing up on my Order/Thank you pages so I'll have to figure that out.
davidroth
 
Posts: 18
Joined: Mon Oct 02, 2006 5:06 am


Return to User Forum

Who is online

Users browsing this forum: No registered users and 81 guests