Google tracking a url twice - one with slash and one without slash
I have a wordpress website and Google Analytics is tracking these 2 pages separately:
When I enter the 1st url (without slash), it automatically gets redirected to the 2nd url (with slash).
What can I do to stop it from tracking the 1st URL.
Re: Google tracking a url twice - one with slash and one without slash
This is a little tricking because you're either going to have to use a search-and-replace function or an advanced filter. Either one you should be careful with.
I'd first consider having your website automatically have a 301 redirect to your URL that ends with the trailing slash and have that URL return a 200 response code. I'm assuming your URL without a slash at the end may be returning a 200 response code and thus telling Google Analytics to record it, although i may be wrong.
Here are two ways to fix it, the first is easier but also problematic if your website structure has a more complicated setup and the second is harder is and is also a filter so you need to be careful.
Option #1 - photo credit trevorayers(dot)com
And option #2 - photo credit lunametrics
Was my response helpful? If yes, please mark it as the ‘Best Answer.’