Forum Moderators: coopster

Message Too Old, No Replies

PHP redirect script

Adding Google Analytics code to a PHP redirect script

         

Hollywood007

5:43 pm on May 30, 2006 (gmt 0)

10+ Year Member



I'm having problems adding the Google Analytics tracking script to my PHP redirect script and was wondering if you could help. Basically, I'm using <? header('Location: /index.php');?> to redirect, but I want to add tracking to this page to know how many people are hitting it. How to I accomplish this?

eelixduppy

6:00 pm on May 30, 2006 (gmt 0)



Set up a database or something equivalent and add 1 to the value that it contains whenever the page is requested, before you redirect.

Hollywood007

6:46 pm on May 30, 2006 (gmt 0)

10+ Year Member



I'd rather use Google Analytics to track it so all of my tracking will be in the same place. Is there another method of redirecting other than using the header function?

whoisgregg

6:56 pm on May 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Doesn't Analytics provide wrappers that you can use to pass redirects through?

Look in the documentation for "track file downloads" or something to that effect... they have a system to track PDF files, etc., you just need to adapt that system for your use.

Hollywood007

12:42 pm on May 31, 2006 (gmt 0)

10+ Year Member



Thanks, the javascript solution worked. I appreciate the help!