Remove Trailing Slash in Google Analytics
If you have Google Analytics set up you might have run into the problem of seeing duplicate urls in your reports. /articles
, /articles/
, /articles?fbclid=...
. More often than not I’ve ended up skimming through the report, doing mental addition as I go. But this problem is easy to fix.
First just go to Google Analytics and click Admin. Then in the far right column under “Views” click Filters -> +Add a Filter.
Set the Filter Name to “Remove Trailing Slash”, select “Custom” -> “Search and Replace”. For the Search String enter /$
; this will look for any trailing slashes. Leave the replace string empty; this will replace the slashes with an empty string.
Click “Verify this Filter” and make sure everything looks good before saving.