A few days ago I tried to setup Google Analytics on my website. But when I add the tracking script it just displays the script in the bottom of the page, just like it didn't execute. I have tried with multiple browsers on multiple computers, and they all display the same thing.
Yes that placement looks fine. I am not sure I understand the problem? If you log into your google analytics account you can see whether or not data is being collected.
When you choose view source in a browser the script code should be visible as it is. I can't really see the problem?
Google Analytics tracking script doesn't execute
A few days ago I tried to setup Google Analytics on my website. But when I add the tracking script it just displays the script in the bottom of the page, just like it didn't execute. I have tried with multiple browsers on multiple computers, and they all display the same thing.
The text it displays is (including link):
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape(" "));
It should be noted that I'm using this script in the master template for my site.
The script is
<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">
try {
var pageTracker = _gat._getTracker("UA-4910122-6");
pageTracker._trackPageview();
} catch(err) {}</script>
I have tried with the legacy script which gives the same result.
Please help me!
Exactly where are you placing the script in your code? Can you please show a snippet of your master template maybe?
Sure, the script is being placed right before the </body> tag. Mostly because google says it has to be placed there.
<div id="footer" class="fixed">
This page was last updated at: <umbraco:Item field="updateDate" runat="server"></umbraco:Item>
<br/>
<br/>
Copyright © 2009 GMod School. All rights reserved. Design by <a href="http://www.nodethirtythree.com/">NodeThirtyThree Design</a>. <a href="http://lego399.dk/umbraco/>admin</a>
</div>
<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">
try {
var pageTracker = _gat._getTracker("UA-4910122-6");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>
</asp:Content>
Yes that placement looks fine. I am not sure I understand the problem? If you log into your google analytics account you can see whether or not data is being collected.
When you choose view source in a browser the script code should be visible as it is. I can't really see the problem?
/Jan
It says it's reciving data, but I don't see any pageviews in the report.
[img]http://imgkk.com/i/auB7crLp.png[/img]
[img]http://imgkk.com/i/Pza95d50.png[/img]
You're missing a " (quote) in your last link before the script, that's breaking it
href="http://lego399.dk/umbraco"
Great spotted Peter :)
Sometimes you need a third-party to spot the obvious ;)
Haha, thanks alot guys. Damn, that was stupid. I wondered why it executed the second script but not the first. :v
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.