Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lego399 4 posts 37 karma points
    Jul 17, 2009 @ 14:36
    Lego399
    0

    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!

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Jul 17, 2009 @ 14:56
    Jan Skovgaard
    1

    Exactly where are you placing the script in your code? Can you please show a snippet of your master template maybe?

  • Lego399 4 posts 37 karma points
    Jul 17, 2009 @ 15:11
    Lego399
    0

    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 &copy; 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>

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Jul 17, 2009 @ 15:15
    Jan Skovgaard
    1

    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

  • Lego399 4 posts 37 karma points
    Jul 17, 2009 @ 15:31
    Lego399
    0

    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]

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jul 17, 2009 @ 15:39
    Peter Dijksterhuis
    100

    You're missing a " (quote) in your last link before the script, that's breaking it

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jul 17, 2009 @ 15:39
  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Jul 17, 2009 @ 15:42
    Jan Skovgaard
    1

    Great spotted Peter :)

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jul 17, 2009 @ 16:01
    Peter Dijksterhuis
    1

    Sometimes you need a third-party to spot the obvious ;)

  • Lego399 4 posts 37 karma points
    Jul 17, 2009 @ 16:15
    Lego399
    0

    Haha, thanks alot guys. Damn, that was stupid. I wondered why it executed the second script but not the first. :v

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

Please Sign in or register to post replies