Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

[PATCH] Update to non-legacy Google Analytics code

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 03-06-2008, 07:44 PM
 
AG9V AG9V is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 73
 

Default Re: [PATCH] Update to non-legacy Google Analytics code

OK, so after making a complete ass out of myself, I successfully patched my installation of X-Cart.

Sorry for the false alarm, Jon...
__________________
X-Cart Gold 4.1.10
XCSEO Pro 1.1.7
IIS 7 / Windows 2008
PHP Version 5.2.6
MySQL Version 5.0.51a
Reply With Quote
  #12  
Old 03-06-2008, 08:54 PM
 
intel352 intel352 is offline
 

X-Wizard
  
Join Date: Dec 2005
Posts: 1,071
 

Default Re: [PATCH] Update to non-legacy Google Analytics code

Quote:
Originally Posted by AG9V
OK, so after making a complete ass out of myself, I successfully patched my installation of X-Cart.

Sorry for the false alarm, Jon...

Just HAD to scare off everybody
That's okay, I'm sure all of the initially scared users will start to creep back to this thread
__________________
-Jon Langevin
WARNING: Unethical developer - NOT RECOMMENDED
See details here
Reply With Quote
  #13  
Old 03-07-2008, 05:46 AM
 
AG9V AG9V is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 73
 

Default Re: [PATCH] Update to non-legacy Google Analytics code

I do have a question about the GA code that should show after applying this patch.

The old GA code looks like this in my "View Source"
Quote:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-3328223-1";
urchinTracker();
</script>


The new GA code should look like this:

Quote:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3328223-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

Is the new GA code what we should be seeing in our pages after applying the GA Module patch?
__________________
X-Cart Gold 4.1.10
XCSEO Pro 1.1.7
IIS 7 / Windows 2008
PHP Version 5.2.6
MySQL Version 5.0.51a
Reply With Quote
  #14  
Old 03-07-2008, 05:57 AM
  kube's Avatar 
kube kube is offline
 

X-Adept
  
Join Date: Sep 2005
Location: London: a small place East of Wales
Posts: 529
 

Default Re: [PATCH] Update to non-legacy Google Analytics code

Yes, that looks about right AG9V...

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._initData();
pageTracker._trackPageview();
</script>

Where UA-xxxxxx-x is your GA Account ID

check here too...
https://www.google.com/support/googleanalytics/bin/answer.py?answer=55480&hl=en_US

Regards,
Doms
__________________
Doms
kube v4.1.9
Reply With Quote
  #15  
Old 03-07-2008, 07:49 AM
 
intel352 intel352 is offline
 

X-Wizard
  
Join Date: Dec 2005
Posts: 1,071
 

Default Re: [PATCH] Update to non-legacy Google Analytics code

After the patch, you should see something like this:

Code:
<script src="http://www.google-analytics.com/ga.js" type="text/javascript"> </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-278520-9"); pageTracker._initData(); pageTracker._trackPageview(); </script>

The difference is that google's original code detects HTTPS, and writes it's url accordingly for the .js file. The google analytics module in X-Cart detects HTTPS in the PHP code, and determines the URL, so that the JS code is simplified.

Cheers
__________________
-Jon Langevin
WARNING: Unethical developer - NOT RECOMMENDED
See details here
Reply With Quote
  #16  
Old 03-07-2008, 10:19 AM
 
AG9V AG9V is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 73
 

Default Re: [PATCH] Update to non-legacy Google Analytics code

Thanks for this patch! Works great
__________________
X-Cart Gold 4.1.10
XCSEO Pro 1.1.7
IIS 7 / Windows 2008
PHP Version 5.2.6
MySQL Version 5.0.51a
Reply With Quote
  #17  
Old 03-21-2008, 06:19 PM
 
exsecror exsecror is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,284
 

Default Re: [PATCH] Update to non-legacy Google Analytics code

One thing that is missing intel that I noticed in the diff is that the new eCommerce tracking code data is not in there.
Reply With Quote
  #18  
Old 04-03-2008, 10:29 PM
 
intel352 intel352 is offline
 

X-Wizard
  
Join Date: Dec 2005
Posts: 1,071
 

Default Re: [PATCH] Update to non-legacy Google Analytics code

Quote:
Originally Posted by exsecror
One thing that is missing intel that I noticed in the diff is that the new eCommerce tracking code data is not in there.


Updated original post with new diff containing ga_commerce_form.tpl changes.
Really, I don't believe it matters much as the new ga.js file supported the utmtrans method, but this update should remove any doubts.

Cheers.
__________________
-Jon Langevin
WARNING: Unethical developer - NOT RECOMMENDED
See details here
Reply With Quote
  #19  
Old 04-04-2008, 01:26 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: [PATCH] Update to non-legacy Google Analytics code

If the in product titles or parthner or .... is found " - You need to escape it...

Examples:
PHP Code:
"{$partner|default:'Main stock'|replace:'"':'\"'}",

...........

        
"{$product.productcode|replace:'"':'\"'}",
        
"{$product.product|replace:'"':'\"'}",
        
"{$product.category|default:'Unknown category'|replace:'"':'\"'}"
Reply With Quote
  #20  
Old 04-04-2008, 06:10 AM
  DreamCatcher's Avatar 
DreamCatcher DreamCatcher is offline
 

Senior Member
  
Join Date: Mar 2004
Posts: 178
 

Default Re: [PATCH] Update to non-legacy Google Analytics code

qualiteam has an official patch for this as well. Awesome work though thank you for sharing!
__________________
X-Cart 4.7.8 Pro
php 7.x
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:21 AM.

   

 
X-Cart forums © 2001-2020