X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   [PATCH] Update to non-legacy Google Analytics code (https://forum.x-cart.com/showthread.php?t=38092)

AG9V 03-06-2008 07:44 PM

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...

intel352 03-06-2008 08:54 PM

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 :roll:
That's okay, I'm sure all of the initially scared users will start to creep back to this thread :lol:

AG9V 03-07-2008 05:46 AM

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?

kube 03-07-2008 05:57 AM

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

intel352 03-07-2008 07:49 AM

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

AG9V 03-07-2008 10:19 AM

Re: [PATCH] Update to non-legacy Google Analytics code
 
Thanks for this patch! Works great

exsecror 03-21-2008 06:19 PM

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.

intel352 04-03-2008 10:29 PM

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.

Yurij 04-04-2008 01:26 AM

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:'"':'\"'}"


DreamCatcher 04-04-2008 06:10 AM

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!


All times are GMT -8. The time now is 07:37 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.