Forum Moderators: DixonJones

Message Too Old, No Replies

Redirects and Google Analytics

         

rlopes

1:59 pm on May 16, 2011 (gmt 0)

10+ Year Member Top Contributors Of The Month



I have a page that only allows visitors coming from inside the same site to see it. If they are referred from somewhere else, they are redirect to my main site's page.

I've placed this PHP command to perform it:

if (strpos($_SERVER[HTTP_REFERER],"site.com")==0) 
{
header("Location: http://www.site.com");
exit();
}


Do you think this will affect Google Analytics reports?

g1smd

2:27 pm on May 16, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That's a 302 redirect. Are you sure that is what you want?

Since the "page" at that URL isn't served there will be no data sent to Google analytics.

Searchengine bots don't send a referrer. They will not be able to access the page and will not index it.

Users of certain Internet Security software and customers behind any caching proxy system used by ISPs (such as AOL and Earthlink customers) will have referrer data stripped from their requests, and so none of those people will see your page.

rlopes

6:05 pm on May 16, 2011 (gmt 0)

10+ Year Member Top Contributors Of The Month



@g1smd Thanks for reply!

> That's a 302 redirect. Are you sure that is what you want?

Now that you mentioned, I'd actually prefer a 301 redirect, but that's another story.

> Since the "page" at that URL isn't served there will be no data sent to Google analytics.

As far as I can see, it will be served if the visitor has reached the page from within the site, and the GA JS will be triggered anyway, won't it?

> Searchengine bots don't send a referrer. They will not be able to access the page and will not index it.

I don't want it to be indexed.

> Users of certain Internet Security software and customers behind any caching proxy system used by ISPs (such as AOL and Earthlink customers) will have referrer data stripped from their requests, and so none of those people will see your page.

This is a good point!
-----------------------------------
Again, thanks for the reply, you opened my eyes to some potential issues.

However my question remains. Why wouldn't GA works if the users actually hit the page?

rlopes

3:51 am on May 28, 2011 (gmt 0)

10+ Year Member Top Contributors Of The Month



I'm still needing help here :(