Re: Simple Google Analytics - Support
This is a great mod! I can't believe how easy it was to install the code across the site. Eric, I've been following your blog... thanks for the easy to follow instructions.
One thing I think the mod is missing (correct me if I'm wrong) is the ability to add the code to track subdomains. For example, my main site is www.example.com, but my zen cart is at shop.example.com. To tie the two into one profile, Google's instructions say to add this code on the subdomain pages:
Code:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-xxxx-x";
_udn="example.com";
urchinTracker();
</script>
I was wondering if you could add the ability to enter the udn, or point me in the direction of hacking the code to enter it for my case. Any help is much appreciated... thanks!
Re: Simple Google Analytics - Support
Hello, everyone! I'm sorry if this seems off-topic, but no one responded to my original post about it and I'm hoping it's an easy answer that one of you knows!
I am signed up for Yahoo Search Marketing rather than Google. In order to set up simple analytics, I am supposed to "Copy the HTML code below and insert it between the <HEAD> and </HEAD> tags on your site's conversion page(s)." The code begins "<SCRIPT language="JavaScript" type="text/javascript">...
>> Where is this code supposed to go? <<
Do I add an html header to define_checkout_success.php and put it in there? I am very, very basic with coding, so any help you could give would be appreciated!
Thanks so much!
Re: Simple Google Analytics - Support
Quote:
Originally Posted by
biffer791
I think my best option would be to have google_analytics.php just combine the lines with identical product ids.
or add option_value_ids to the end of the product_id
Here is what your code looks like that is being passed (as you sent it to me). I broke in down into separate lines for easy reading.
Quote:
<textarea id="utmtrans">UTM:T|1613||59.95||0.00|Wayne|PA|US
UTM:I|1613|5|Gaucho Capri|Women\'s Active Bottoms|29.98|1
UTM:I|1613|5|Gaucho Capri|Women\'s Active Bottoms|29.98|1</textarea>
The first line that starts "UTM:T" combines all data for the single transaction.
The remaining two lines "UTM:I" are each of the line items that were passed from the cart.
This is how Google wants it to report. Again keep in mind that the way the items are passed to Google is exactly how Google states they need to be passed. So, to alter the code to combine lines with identical product id's would go against what Google says has to be done to send the data, and would cause problems.
The issue here is not how the module passes data to Google. It is in how you are choosing to:
1) Use the Unique Id as a SKU
2) How products are listed in your store.
Here is an example of what I mean. I ran a checkout procedure on a test cart of mine then recorded the end data that is passed to Google after the sale. What I did was added 2 of the SAME product to my cart then checked out. Here are the results.
Quote:
<form style="display:none;" name="utmform">
<textarea id="utmtrans">UTM:T|13||146.90||5.00|Test|Tennessee|United States
UTM:I|13|26|Microsoft IntelliMouse Explorer|Mice|70.95|2</textarea>
</form>
The first line is again (as it should be) the "transaction" totals (UTM:T). The second line takes the two products and combines them into one line just as it should. I made no alterations to the code here, just added the same item and was on my way. It combined the lines normally.
Why? Because everything about the product was identical. If there were two different "colors" (attributes), then it would have reported two lines (rather than one).
Again, you must keep in mind that you are passing "items" to Google and that if two items differ in one area (such as "color attribute") then they are considered two totally different items.
This is the case with your cart as well. How would you know which product ITEM a customer ordered if your CART combined them into 1 "item"?. You would have no idea what color was ordered if the two different items were combined.
It's this simple. However many individual LINE ITEMS you have listed on your "shopping cart page" (when viewing your cart), that is how many "LINE ITEMS" you will have when passing the data to Google. If you want it to operate differently, you need to alter your products.
Re: Simple Google Analytics - Support
Quote:
Originally Posted by
MyGreyGoose
This is a great mod! I can't believe how easy it was to install the code across the site. Eric, I've been following your blog... thanks for the easy to follow instructions.
One thing I think the mod is missing (correct me if I'm wrong) is the ability to add the code to track subdomains. For example, my main site is
www.example.com, but my zen cart is at shop.example.com. To tie the two into one profile, Google's
instructions say to add this code on the subdomain pages:
Code:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-xxxx-x";
_udn="example.com";
urchinTracker();
</script>
I was wondering if you could add the ability to enter the udn, or point me in the direction of hacking the code to enter it for my case. Any help is much appreciated... thanks!
Glad you like the mod MyGreyGoose, and glad you like the blog to.
Thanks for the suggestion on the mod as well (the addition of the subdomain capability), however, that wouldn't be a feature which "should" not be added (it would need to be added by hand manually) and here is why.
First understand that you can track subdoamin activity several ways. The method you described allows you to track additional subdomains under one website profile.
When you add the line of code (for subdomain tracking "_udn="example.com"; ") that you are specifying, it should ONLY be included on the pages of the subdomain itself (not on the rest of the "root domain" pages).
Google states the following:
Quote:
"You can track subdomains within the same profile as the domain. In order to do so, you'll need to add a line to the tracking code on each page of the subdomain."
Notice the last section that I out in bold. It specifically states "pages in the subdomain". So to add it as an option to the entire module would not work because the module assumes the code is used for one domain.
Now, here are your options to get you where you want (there are a few):
Option 1 - requires programming knowledge:
Manually alter your "tpl_main_page.php" file with some PHP code that gets the url string and splits it to determine if this is a subdomain page or not. If so, add the line of code you need to the tracking.
Then, you may need to set a filter in your Google Analytics account to distinguish between different subdomains (if you have more than one).
Option 2 - easier method, and will work the same as the above
Option two here achieves the same effect as the above, however, rather than tracking subdomains under one website profile, you track them as separate website profiles (under the same Google Analytics account).
You still would need to do a little "manual programming" to achieve the effect as this code should ONLY be included on the pages of the subdomain again.
Under option 2, you create a NEW website profile under the same Google Analytics account for each of the subdomains you want to track. This will give you a unique tracking id for each subdomain.
Now, you still need to alter the tpl_main_page.php code to determine whether the page(s) being viewed are in the subdomain of the site, or the root domain.
However, this time, instead of adding the line of code we talked about above, you would perform an "if then" and list out the entire set of new tracking code for the subdomain ("else" list the code for the root domain).
It gets a little more complicated when tracking subdomains because the code has to bee entered ONLY on the pages of that subdomain being tracked (but it can be accomplished).
Hope that helps. :)
Re: Simple Google Analytics - Support
Quote:
Originally Posted by
chacha-vintage
Hello, everyone! I'm sorry if this seems off-topic, but no one responded to my original post about it and I'm hoping it's an easy answer that one of you knows!
I am signed up for Yahoo Search Marketing rather than Google. In order to set up simple analytics, I am supposed to "Copy the HTML code below and insert it between the <HEAD> and </HEAD> tags on your site's conversion page(s)." The code begins "<SCRIPT language="JavaScript" type="text/javascript">...
>> Where is this code supposed to go? <<
Do I add an html header to define_checkout_success.php and put it in there? I am very, very basic with coding, so any help you could give would be appreciated!
Thanks so much!
Are you asking how to setup Yahoo Search Marketing code using the Simple Google Analytics module, or are you asking how to setup the Google Analytics module in addition to the code you already have entered for Yahoo?
I have done both successfully (and am converting my Yahoo code to a contribution as well), but you can't setup Yahoo using the Google mod. Please clarify your needs so I can assist.
Re: Simple Google Analytics - Support
Well, I probably have a pretty rare situation where my overall site www.example.com is on a separate server and shop.example.com is on it's own server. My main google account is tied to example.com, and ALL of my zen cart is on shop.example.com... so having the option to enter a subdomain in this module would work for me b/c none of that code touches anything that is not that subdomain.
Any way, the fix for me was pretty simple and straight forward: I went to includes\templates\my_template\google_analytics\google_analytics.php and added _udn="example.com"; to the code. I think that'll do the trick. I then went and set up a filter per Google's instructions so that it'll distinguish between my www.example.com and shop.example.com files. I hope it works!
Re: Simple Google Analytics - Support
In order for that to work, just make sure you only include the "_udn" code within the tracking for the subdomain pages only (no the root) and vice versa.
When applying that method, it only should appear on those pages which are being considered "seperate" in your eyes. Otherwise, it will not work.
Re: Simple Google Analytics - Support
Hello, Eric! I'm sorry for the lag in my response. To clarify:
I don't know if I need a mod or not.
All I know is that I'm supposed to add the piece of code (javascript) to the html header on the purchase confirmation page.
So is there an existing file that I would just add it to?
If not, how do I go about getting that code somewhere so that it will be read as the head of that page?
Thanks so much for all your help!
Re: Simple Google Analytics - Support
Hi i need some help i am just trying to sort this out for a friend... I think i have gone through the instructions properly... But i am getting this error
Please Help
Re: Simple Google Analytics - Support
Please ignore the last post i was being dim!!!!