Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing slashes - tracked as two separate pages #17055

Open
agendartobias opened this issue Jan 6, 2021 · 7 comments
Open

Trailing slashes - tracked as two separate pages #17055

agendartobias opened this issue Jan 6, 2021 · 7 comments
Labels
c: New plugin For features that probably will not be added to Matomo, but could be implemented as plugins.

Comments

@agendartobias
Copy link

A given page is being tracked as two separate pages due to trailing slashes in the URL. For example:

/login
/login/

Is there any way to make Matomo recognize that the two URLs are actually a single page?

@mobiliodevelopment
Copy link

Actually this are two different URLs and should be counted independent.

Example:
/login -> /login
/login/ -> /login/index.html or index.htm

@tsteur tsteur added the c: New plugin For features that probably will not be added to Matomo, but could be implemented as plugins. label Jan 10, 2021
@tsteur tsteur added this to the Backlog (Help wanted) milestone Jan 10, 2021
@tsteur
Copy link
Member

tsteur commented Jan 10, 2021

Hi @agendartobias AFAIK there isn't a way yet to recognise the two URLs as a single page. It's unlikely we'll work on this as it is technically two different URLs. However, I'll keep the issue open as someone should be able to implement this feature in a plugin without too much effort. Happy to guide them in the right direction if someone is keen.

@dl-lim
Copy link

dl-lim commented Jun 8, 2021

I agree with this issue. It is skewing how the data is presented when we pull from this to other BI solutions, unless plenty of transformation is being performed at a granular level.

Actually this are two different URLs and should be counted independent.

Example:
/login -> /login
/login/ -> /login/index.html or index.htm

If this is the case, then /login/ should already be logged as /login/index.html . What is the point of logging /login/ then?

By this, shouldn't / be the largest then, since ALL visits go thru / ? - which actually isn't the case in our data. It appears to be inconsistent where this is applied.

@artus70
Copy link

artus70 commented Jun 22, 2021

The URL /login could mean the same as /login/, but it doesn't have to. Therefore, I plead for it to become configurable.

By being able to combine it, cases like this (same URL as single page and as directory) could be avoided:

grafik

(I'd love to have the upper URL shown/positioned as the index page of the lower URL instead of being shown separately!)

@vladimir-shmidt
Copy link

Usually server treat /login and /login/ the same. index.html or index.php is the next level of discussion but there is a good approach to combine (group) such requests and treat as the same url

I wonder have matomo some ability or extension point to solve it?

I thought it is SPA problem with router but haven't found anything criminal - client can put what ever he want's like login and login/ and login/?variable=value even application don't have any variables. So client redirection can solve trailing slash a bit but it is much easy to group queries in matomo statistics for me (in case there is a way to do it :) )

@tassoman
Copy link
Contributor

tassoman commented Jan 9, 2024

I'll keep the issue open as someone should be able to implement this feature in a plugin without too much effort. Happy to guide them in the right direction if someone is keen.

@tsteur I'm interested on such kind of aggregation, but I can't understand if it can be done at tracking time (maybe a plugin extending the tracker?) or if can be done at reporting time (maybe a plugin working during report creation job) 🤔

Any idea about it? Are there example plugins working at tracking time or reporting time?

@artus70
Copy link

artus70 commented Jan 9, 2024

at tracking time

I've no working example but this approach would be okay for me, i.e. by setting this in the JS of the pages:

_paq.push(['treatAsDirectory', 1]);

By doing it this way it's optional, as I suggested before (#17055 (comment)).

The Matomo Javascript could then save it as if it had a trailing slash. At least on my site, it's no difference if I call a page with or without trailing slash. In case a slash is given we automatically redirect the visitor to the URL without the slash.

I guess this approach would be the easiest to implement.

Of course Matomo in addition could treat the above mentionend JS setting to save this information someware internally to be able to generate the corresponding URLs (without the slash) in its output. But for me, that's not a must.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: New plugin For features that probably will not be added to Matomo, but could be implemented as plugins.
Projects
None yet
Development

No branches or pull requests

7 participants