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
  #31  
Old 04-18-2008, 04:34 AM
 
intel352 intel352 is offline
 

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

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

Thanks for posting that
__________________
-Jon Langevin
WARNING: Unethical developer - NOT RECOMMENDED
See details here
Reply With Quote
  #32  
Old 04-18-2008, 06:29 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

Quote:
Originally Posted by GeeCee
I have contacted QT support and they sent me the official patch files, I've attached them to this post as a zip along with the contents of the message they sent in a readme.txt

There are 2 files basically and have to be applied in number order.

This code is working well?
Reply With Quote
  #33  
Old 04-18-2008, 06:46 AM
 
GeeCee GeeCee is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 111
 

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

I don't know yet, I've applied the patch without problems and the new Google Analytics code shows up ok, but will need to wait for few days to see if it's working properly.

I have no reason to suspect that an official patch from QT wouldn't work though.
__________________
X-Cart Gold v4.1.10
Manchester, UK
Get SEO, PPC or just advice from Intrinsic Marketing
Reply With Quote
  #34  
Old 04-20-2008, 01:19 PM
 
homeworldz homeworldz is offline
 

Advanced Member
  
Join Date: Feb 2008
Posts: 68
 

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

can you post your working ga_code.tpl

This is mine, but gives page errors.

Quote:
{*$Id: ga_code.tpl,v 1.1.2.4 2008/01/09 11:17:53 ferz Exp $*}
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." :
"http://www.");
document.write(unescape("\<script src='" + gaJsHost "google-analytics.com/ga.js' type='text/javascript'>\<\/script>" ));
</script>

<script type="text/javascript">
var pageTracker =
_gat._getTracker("{$config.Google_Analytics.ganaly tics_code}");
pageTracker._initData();
pageTracker._trackPageview();
</script>

__________________
x-cart 4.1.9
Reply With Quote
  #35  
Old 04-21-2008, 12:07 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

Quote:
Originally Posted by homeworldz
can you post your working ga_code.tpl

This is mine, but gives page errors.

This, I wrote myself:

PHP Code:
<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("{$config.Google_Analytics.ganalytics_code}");
pageTracker._initData();
pageTracker._trackPageview();
</
script
Reply With Quote
  #36  
Old 04-21-2008, 12:28 AM
 
homeworldz homeworldz is offline
 

Advanced Member
  
Join Date: Feb 2008
Posts: 68
 

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

Thankyou,

Page errors have now gone.
__________________
x-cart 4.1.9
Reply With Quote
  #37  
Old 04-23-2008, 03:43 AM
 
GeeCee GeeCee is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 111
 

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

I can report that GA is picking up data correctly, however I've noticed that with the new code my site no longer validates for XHTML, with it complaining about the new GA code. I've got an outstanding ticket with Qualitool about this and will post back here when I get it sorted.
__________________
X-Cart Gold v4.1.10
Manchester, UK
Get SEO, PPC or just advice from Intrinsic Marketing
Reply With Quote
  #38  
Old 04-23-2008, 10:26 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

Hi GeeCee. Which code are you using? As far as I can tell, both intel's and Yurij's code are XHTML valid.

Possibly give us a snippet of the HTML code that is printed out. (excluding Account ID)
__________________
Doms
kube v4.1.9
Reply With Quote
  #39  
Old 04-24-2008, 12:40 AM
 
GeeCee GeeCee is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 111
 

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

This is the GA code as seen by View Source on my site:

Code:
<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("\<script src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'>\<\/script>" )); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("xxxxxxxxxx"); pageTracker._initData(); pageTracker._trackPageview(); </script></body> </html>

This is the the validation output from http://validator.w3.org/:

Quote:
Validation Output: 7 Errors

1. Error Line 405, Column 105: document type does not allow element "script" here.

┘ics.com/ga.js' type='text/javascript'>\<\/script>" ));

?

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
2. Warning Line 405, Column 107: character "<" is the first character of a delimiter but occurred as data.

┘s.com/ga.js' type='text/javascript'>\<\/script>" ));

?

This message may appear in several cases:
* You tried to include the "<" character in your page: you should escape it as "&lt;"
* You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&amp;", which is always safe.
* Another possibility is that you forgot to close quotes in a previous tag.
3. Error Line 408, Column 30: document type does not allow element "script" here.

<script type="text/javascript">

?

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
4. Error Line 412, Column 15: end tag for "script" omitted, but OMITTAG NO was specified.

</script></body>

?

You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
5. Info Line 403, Column 9: start tag was here.

</table><script type="text/javascript">

6. Error Line 405, Column > 80: XML Parsing Error: StartTag: invalid element name.

┘gaJsHost + "google-analytics.com/ga.js' type='text/javascript'>\<\/script>" ┘┘

?
7. Error Line 412, Column 16: XML Parsing Error: Opening and ending tag mismatch: script line 403 and body.

</script></body>

?
8. Error Line 413, Column 7: XML Parsing Error: Opening and ending tag mismatch: body line 30 and html.

</html>

?
9. Error Line 413, Column 7: XML Parsing Error: Premature end of data in tag html line 3.

</html>
__________________
X-Cart Gold v4.1.10
Manchester, UK
Get SEO, PPC or just advice from Intrinsic Marketing
Reply With Quote
  #40  
Old 04-24-2008, 01:02 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

Adding //<![CDATA [ //]]> within the script should solve the problem. I think this is because there is a script within a script.

Code:
<script type="text/javascript"> //<![CDATA[ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("\<script src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'>\<\/script>" )); //]]> </script>

Hope this helps.
__________________
Doms
kube v4.1.9
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 08:19 AM.

   

 
X-Cart forums © 2001-2020