Mobile app version of vmapp.org
Login or Join
Alves908

: Google Analytics when 404 handler is used as 'mod_rewrite'? I'm consulting on a web site which in order to provide clean URL's uses the 404 handler to catch what would otherwise be a 404 and

@Alves908

Posted in: #GoogleAnalytics #Http #HttpHeaders #ModRewrite

I'm consulting on a web site which in order to provide clean URL's uses the 404 handler to catch what would otherwise be a 404 and serve the correct content.

In case that's not clear the 404 handler is being used to do what would otherwise be done by mod_rewrite.

So :
somedomain.com/fruit/apples/description
... does not exist on somedomain.com so the 404 handler, a PHP script, is invoked, parses the URL requested and then makes an internal requests for:
somedomain.com?foodtype=1&fooddesc=2&contenttype=3
The resulting content then gets sent but in doing so it reports a 404 to the user agent.

The client is interested in using Google Analytics in order to track usage of the site.

My question is will GA provide anything useful in terms of results or will the 404 being returned by the server cause GA to discard the response ?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Alves908

2 Comments

Sorted by latest first Latest Oldest Best

 

@Sue5673885

Actually you don't need to do this, it's OK to return a 404. See the question about soft 404s here:.


You can return a 404 response code while serving whatever content you
want.


And further down it says


your server should return a 404 if there’s nothing there to find


Sometimes the Google crawler looks for URL that are very unlikely to exist to see if you never return a 404. I suspect if you do never return a 404 they mark you down.

10% popularity Vote Up Vote Down


 

@Shelley277

What LazyOne said. Return a 200 from the handler. Otherwise GA will report it as a Page Not Found, which is what you are telling them anyways.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme