Track redirect page with Google Analytics

I am trying to track a redirect page using Google Analytics:
I have a page called redirect.php; when I visit the url, for example redirect.php?c=12345678, the php function executes a query in the sql lookup table to decode the code 12345678with the url previously inserted and then redirects 301.

(I am doing a redirect 301to avoid duplicate content.)
I want to track every visit redirect.phpwith analytics, but I can’t.

For instance:

redirect.php?c=87654321redirected to story.php.

Obviously in Analytics I cannot find the page redirect.php. referent story.php organic/google, so I can not rely on the referrer.

Is there any way to track every call forwarding?

+5
source share
2 answers

GA works in a browser. Whenever a user visits a page with a GA script, a request is sent from the user to google notifying about the visit. Since you are creating a 301 header redirect, a GA script is loaded, and therefore google does not know that the user was on this page.

You have

  • Toggle redirect from 301 header to meta-redirect page and GA code
  • Switch to another analytics system, such as Piwik, and manually add data to it on the redirect page.
  • Add your own counter inside a redirect script separate from GA

, , , - GA, redirect.php script, , , 301, .

+7

Google Analytics .

+1

All Articles