Analytics
1.8K members online now
Understand information in your reports and troubleshoot reporting issues such as self-referrals, (not set) data, and inaccurate information
 
Guide Me
star_border
Reply

Google tracking a url twice - one with slash and one without slash

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

I have a wordpress website and Google Analytics is tracking these 2 pages separately:

 

1. www.example.com/user-signin

2. www.example.com/user-signin/

 

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.

 

Thanks

1 Expert replyverified_user

Re: Google tracking a url twice - one with slash and one without slash

Rising Star
# 2
Rising Star

Hey Parul, 

 

 

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 

Remove-trailing-slash-Google-Analytics1.png

 

And option #2  - photo credit lunametrics

 Remove-trailing-slash-Google-Analytics2.png

 

 

 

 

Joshua, Rising Star
Was my response helpful? If yes, please mark it as the ‘Best Answer.’