Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   problem with javascript and google analytics... (https://www.warriorforum.com/programming/232780-problem-javascript-google-analytics.html)

csrpj 6th July 2010 03:54 AM

problem with javascript and google analytics...
 
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>

iBBnet 6th July 2010 04:00 AM

Re: problem with javascript and google analytics...
 
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...

ellistev 12th July 2010 04:22 PM

Re: problem with javascript and google analytics...
 
Is it working now?

ereadergold 12th July 2010 04:45 PM

Re: problem with javascript and google analytics...
 
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

Juturna 12th July 2010 06:16 PM

Re: problem with javascript and google analytics...
 
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.


All times are GMT -6. The time now is 08:39 PM.