Hi dudes! I think this is right sub forum for this question because it´s about javascript... I don´t know where to place the Analytics code because my site just redirects to another one. Google Analytics page says that it should be placed just before </body> tag but my <head> looks like that so I think browser doesn´t load the Analytics code if it is just before </body> <head> <title>kesanekajekku -> gurun testi</title> <script type="text/javascript"> <!-- window.location = "http://www.example.com/" //--> </script> <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.example.com"> </head> So, where I should place it? Thanks to you guys!
I don't think so. IMO if your javascript code executes a redirection (just like window.location = "http://www.example.com/"; ) the following code won't be executed. So I think you should put the analytics code before that line. That's: <head> <title>kesanekajekku -> gurun testi</title> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> <script type="text/javascript"> <!-- _uacct = "your_account"; urchinTracker(); window.location = "http://www.example.com/" //--> </script> </head> Code (markup):
Thanks to you, I´ll try this. Is it possible that someones browser doesn´t notify JavaScript redirection which I use (window.location etc..)? I mean do I need to use JavaScript redirect and also the meta-tag redirect if I want permanent redirection? Thanks to you!
I thought you want that method to know how many people are going to your new site from your previous site. I you don't want to know that info, IMO the best way to go is through a 301 redirection set on your .htaccess file on your old site redirecting to your new site.
I want to know everything what google analytics can provide and that´s why the analytics code in page which just redirects to another one. Im just thinking which would be the best script type redirection? freewebs.com doesn´t support PHP so I can´t use it. Is JavaScript the best option?
If you want info from Google Analytics, then you NEED javascript. I'm not sure, but if you use the META tag redirection, probably the Analytics code won't be executed. So IMO your best option is the javascript redirection (window.location assignment) without the META tag redirection.
Yes. You´re right. But is it possible someones browser blocks javascript and then the analytics and redirect code doesn´t work?
Yes, you're right too. A small percentage of people has javascript disabled on their browsers, and will not be redirected to your new site. But, you can put a link on the page allowing that people to manually jump to new site.