# Trailing slashes sometimes removed

**URL:** <https://community.piwik.pro/t/trailing-slashes-sometimes-removed/2886>\
**Category:** Reports and working with data\
**Created:** [September 12, 2023, 5:02pm UTC](https://community.piwik.pro/t/trailing-slashes-sometimes-removed/2886 "2023-09-12T17:02:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rachel\_Witner](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/rachel_witner/32/1492_2.png) [@Rachel\_Witner](https://community.piwik.pro/u/Rachel_Witner)\
**Post date:** [September 12, 2023, 5:02pm UTC](https://community.piwik.pro/t/trailing-slashes-sometimes-removed/2886/1 "2023-09-12T17:02:27Z")

</div>

For certain page paths, it looks like the trailing comma is being removed sometimes but not others. For example:

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/e/e9681e871d605639a85d8405daa1af538ad031bf.png)

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/3/3412bd6f8d38d5797742090fca1551d73f054ecb.png)

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/9/93991dc70bcae999345673bc1e811eb971be063c.png)

Is there any way to combine page paths like this so it only shows page paths either with trailing slashes or without?

---

<div class="post-metadata">

**Author:** ![Oliwer\_Kaczmarek](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/oliwer_kaczmarek/32/3888_2.png) [@Oliwer\_Kaczmarek](https://community.piwik.pro/u/Oliwer_Kaczmarek)\
**Post date:** [September 13, 2023, 10:21am UTC](https://community.piwik.pro/t/trailing-slashes-sometimes-removed/2886/2 "2023-09-13T10:21:53Z")

</div>

Hi @Rachel_Witner,

Short answer: It’s not possible to change values of dimensions after they were already tracked, but it’s possible to add/remove the slash before sending the data to Piwik PRO.

Why slashes appear sometimes and sometimes they don’t: Both `/fragrance-oil-finder` and `/fragrance-oil-finder/` will point to the same page on your website, because of that visitors sometimes will use one and sometimes the other one. To minimize the usage of one of them you have to make sure that all links in your website use particular standard either ending the path with “/” or without it.

How to send data to Piwik PRO with particular standard: With custom setup it’s possible to check each URL and remove the slash or add it (depending on what standard you’d like to use) before sending the tracking request.

Here’s how to achieve that (solution for adding missing “/” at the end):

1. Go to _Menu → Tag Manager → Tags_

2. Click on `Add a tag` and give it a name.

3. Select `Custom code (async)` and click `Next`

4. Use this script:

```auto
<script>
    var _paq = _paq || [];
    (function(){
      var urlArr = {{ Page Url }}.split("?");
      if(urlArr[0].slice(-1) !== "/") urlArr[0] += "/";
      if(urlArr.length > 1) _paq.push(["setCustomUrl", urlArr[0] + "?" + urlArr[1]]);
      else _paq.push(["setCustomUrl", urlArr[0]]);
    })();
</script>

```

1. In _Tag triggers_ click on `Choose existing trigger` and select the _All page views_ trigger
2. Add this tag by clicking on `OK` button.
3. Go to _Menu → Tag Manager → Settings → Tag priority_
4. Select the new created tag and put it as first in priority. To make sure everything works fine right after it add a Piwik PRO tag.

This solution will work only on new data and will not change the already gathered one.

Best,  
Oliwer

---

<div class="post-metadata">

**Author:** ![Dataguy](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@Dataguy](https://community.piwik.pro/u/Dataguy)\
**Post date:** [June 18, 2025, 8:08am UTC](https://community.piwik.pro/t/trailing-slashes-sometimes-removed/2886/3 "2025-06-18T08:08:30Z")

</div>

Hi!

I’m trying the same set up to clean up our data.

Added the script in a new tag, set it to fire before Piwik Pro tag.

How do I check in debugger that it is working as intened?  
By checking the variables (page url in this case) in debuggers eventlog it doesnt seem to add a trailing slash. But perhaps it wont show there?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jfidala](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/jfidala/32/4263_2.png) [@jfidala](https://community.piwik.pro/u/jfidala)\
**Post date:** [June 18, 2025, 11:01am UTC](https://community.piwik.pro/t/trailing-slashes-sometimes-removed/2886/4 "2025-06-18T11:01:26Z")

</div>

@Dataguy I’ve tested the script on my Piwik PRO instance - if you add it correctly it should work and add trailing slash in tracker debugger.

Go to **Analytics** module → **Settings** → and there you will find **Tracker debugger** on left side. Find your session and you will see if its working
