problem with javascript and google analytics...

by csrpj
4 replies
i'm trying to add google anlytics. i added the code as such, but the tracking status isn't active. and idea what i can do to make it active?

my code (yes the page just redirects, but i'd still like analytics):

<html>
<head>
<title>Drug T-shirts</title>
<script type="text/javascript">
<!--
function delayer(){
window.location = "http://www. affiliate link"
}
//-->
</script>



<script type="text/javascript">

google analytics code

</script>




</head>
<body onLoad="setTimeout('delayer()', 1)">


</body>
</html>
#analytics #google #javascript #problem
  • Profile picture of the author iBBnet
    When I setup my Google Analytics, I had to wait for a couple of days for the tracking to become active. Maybe you just need to wait a little longer and see what happens...
    Signature
    Bryan
    After5PC.net
    Freelance Web Development
    and Graphic Design Services
    {{ DiscussionBoard.errors[2306796].message }}
    • Profile picture of the author ellistev
      Is it working now?
      {{ DiscussionBoard.errors[2334063].message }}
  • Profile picture of the author mywebwork
    I would try setting up a test page, a very simple HTML page that does nothing except hold the Analytics code. Put it on your site and see if it works correctly.

    Once you confirm it works use the same code on the page you show here. If it doesn't work my guess is that because you call the "delayer" function as soon as the body loads the Analytics code never gets the chance to run.

    With the test page you should be able to determine pretty quickly if that is the case.


    Bill
    {{ DiscussionBoard.errors[2334133].message }}
  • Profile picture of the author Juturna
    Try placing it before the ending body tag... That's what I always do and it works perfectly... Also, try recopying your analytics code to your site. Some times that fixes that issue as well.
    {{ DiscussionBoard.errors[2334445].message }}

Trending Topics