Page 1 of 1
Google Analytics Code is Rendering on Pages
Posted: Tue Nov 09, 2010 8:59 am
by fettabachi
This is a clean install of 1.4.8.
The code provided by Google is rendering at the bottom of the page. I simply pasted the Google code in the provided box on the module edit page and enabled the module.
http://izabelladesigns.com/index.php
Thanks for your help.
Re: Google Analytics Code is Rendering on Pages
Posted: Tue Nov 09, 2010 9:13 am
by kedgetech
Mate I checked the code in the page. Some how the rendering not right. Did you copy the code directly from the Analytics ? Its not what it should look like btw !
cats.jpg (318.87 KiB) Viewed 2072 times
As far as I see there might be issue with your copying or problem with template rendering. You can start here i suppose.
Re: Google Analytics Code is Rendering on Pages
Posted: Tue Nov 09, 2010 5:11 pm
by MrMuddy
As mentioned, the analytics code you have looks wrong... you have HTML entities in there instead of the <, > and " characters... as a result, the browser doesn't see them as tags and just stuff it all on the page.
It should look like this in the source :
Code: Select all
<script type="text/javascript">
...
Code
...
</script>
Re: Google Analytics Code is Rendering on Pages
Posted: Tue Nov 09, 2010 6:57 pm
by fettabachi
The script tags are in place in the back end and being converted to HTML entities when rendered by the browser. To be sure, I pasted the code into a plain text document and then copied and pasted again with the same (undesirable) results.
Here's the code;
Code: Select all
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-19244135-5']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
There must be a simple explanation...anyone?
I uninstalled the module and pasted the code into the header.tpl file...badda-boom...badda-bing!
Re: Google Analytics Code is Rendering on Pages
Posted: Wed Nov 10, 2010 5:34 am
by kedgetech
Might be something to do with your template did you build it yourself or purchased it from some where ?
I have never seen this before we support several carts all from 1.3.7 right up to latest ! I have a strong feeling it might be to do with your "Scroll Back to Top" functionlity but I might be wrong.
Cheers
Re: Google Analytics Code is Rendering on Pages
Posted: Fri Nov 12, 2010 6:53 am
by fettabachi
kedgetech wrote:Might be something to do with your template did you build it yourself or purchased it from some where ?
I purchased it from the Opencart Store.
kedgetech wrote:I have a strong feeling it might be to do with your "Scroll Back to Top" functionlity but I might be wrong.
I tested the "Scroll Back to Top" script and it isn't the culprit.
I'll query the template developer for an answer.
Thanks
Re: Google Analytics Code is Rendering on Pages
Posted: Sat Nov 13, 2010 1:31 pm
by kedgetech
Yes absolutly. If you bought the template developer should be able to point you in right direction if there is an issue.
Goodluck.
Re: Google Analytics Code is Rendering on Pages
Posted: Tue Nov 16, 2010 2:10 am
by ktutu
Could someone please tell me where to go to find the pages I should paste the coding into? I.e. catalog/view/theme/etc..... I'm still learning and am not sure which pages need to be modified.
TIA.
Re: Google Analytics Code is Rendering on Pages
Posted: Tue Nov 16, 2010 8:35 am
by Moggin
ktutu, the Google Analytics code is pasted into the appropriate box in the admin panel: Extensions > Modules > Google Analytics. Nice and simple.
Re: Google Analytics Code is Rendering on Pages
Posted: Tue Nov 16, 2010 2:18 pm
by ktutu
I feel like an idiot. Thanks, Moggin.

Re: Google Analytics Code is Rendering on Pages
Posted: Wed Nov 17, 2010 4:26 am
by Moggin
No problem. And don't worry, I feel like an idiot quite frequently
