Google Analytics & PHP Header Redirect

blackjack

Regular Member
Joined
Nov 23, 2007
Messages
276
Reaction score
53
Hi

I am using PHP Header redirect and would like to add GA tracking code. How & where should I put GA code?

My current PHP redirect has only 3 lines. PHP opening tag, Header/Location redirect and closing tag.

I want to use PHP redirect because the script rotates three URL and want to see which one has more click/conversion.



Thanks
 
Add the <body> tag after your redirect code.

Put the GA code right before the </body> tag at the end of the file.
 
I tried body tag but the script redirects to the new page before anything else get loaded. so it doesn't work.
 
Use a meta/js redirect, headers are rendered before content, and when a redirect is seen in the header it shouldn't bother downloading the rest of the content.
 
I would suggest you to make 3 goals instead and track the click to conversion.

or virtually set the page name for GA on three landing pages to index?id=(1,2,3)
 
Back
Top