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

Tracking is not working when page title contains apostrophe #10838

Closed
fred-the-coder opened this issue Nov 5, 2016 · 4 comments
Closed

Tracking is not working when page title contains apostrophe #10838

fred-the-coder opened this issue Nov 5, 2016 · 4 comments
Assignees
Labels
answered For when a question was asked and we referred to forum or answered it.
Milestone

Comments

@fred-the-coder
Copy link

Hi,

I was not understanding why tracking for one of my website was not working...I used bugzilla to check what was happening on network side and discover a 403 error on GET /piwik.php.

I tryed to play with the URL. I saw that parameter "action_name" has page title as value. I found that if I remove the apostrophe in page title it was working fine!
My web site name contains an apostrophe (character = ' ) and site name is used in all website pages title...

Not sure it is a bug, maybe it's "working as expected"...if not a bug, I would like to know if there is a workaround...?

Right now I replace the apostrophe with a space...

Thank you for your reply.

@tsteur
Copy link
Member

tsteur commented Nov 6, 2016

I have tried to reproduce this but couldn't. I think we pretty much do not even send a 403 when tracking. Likely you have some kind of security mod active which prevents forwarding the call to Piwik and directly blocks it. I'd recommend to ask your sys-admin / hoster or have a look at your server configuration.

@tsteur tsteur closed this as completed Nov 6, 2016
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Nov 6, 2016
@tsteur tsteur self-assigned this Nov 6, 2016
@tsteur tsteur modified the milestones: 3.0.0-b2, 2.17.1 Nov 6, 2016
@fred-the-coder
Copy link
Author

OK,
Thank you for your answer!
Remind that tracking is working when I remove the apostrophe in page title. Page title which is part of the URL sent for tracking....

@tsteur
Copy link
Member

tsteur commented Nov 7, 2016

Yes, that's what the security mod is likely blocking, the apostrophe. Please check with your hoster / sys admin it's likely a security mod or security plugin.

@ADKlineDesign
Copy link

ADKlineDesign commented Jun 21, 2018

Hi - I had the same type of problem. The occurrence of the word "and" in the "action_name" parameter resulted in a 403 error on GET /piwik.php.

For those who cannot resolve this via their hosting provider, the solution is to filter the page title before providing it to Matomo.

Replace the following lines in the Matomo Tracking Code:

var _paq = _paq || [];
_paq.push(['trackPageView']);

With:

var filtered_page_title = document.title.replace('to_be_filtered ',''),
    _paq = _paq || [];
_paq.push(['setDocumentTitle', filtered_page_title ]);
_paq.push(['trackPageView']);

This will remove the offending item ("to_be_filtered") from the page title before providing that title to Matomo (in my case this was the word "and").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

3 participants