Debug not working with urls containing #

In our web application we use links like this one: “”.

I inspected the debug script which is injected by matomo tag manager and found:

if ((document.cookie.indexOf(‘mtmPreview1_8Jipm5bo%3D1’) !== -1 &&’&mtmPreviewMode=0’) === -1 &&’?mtmPreviewMode=0’) === -1) ||’&mtmPreviewMode=8Jipm5bo’) !== -1 ||’?mtmPreviewMode=8Jipm5bo’) !== -1) {

as you can see it uses …

If you use the console you will find that even you have an url containing the debug parameter the result of’?mtmPreviewMode=8Jipm5bo’) will return -1 thus disabling debug.

To reproduce this:
Enable Debug Mode in Matomo Tag Manager
Browse an url which does NOT contain #something in the url
Go to console and enter’?mtmPreviewMode=8Jipm5bo’);
You will receive 0

Now head to an url which contains an #
You will receive -1

Thus the debug mode will not work.

I am not sure whether this is a bug. Can you please confirm.


I am not sure I can reproduce this.

I go to and"?mtmPreviewMode=8Jipm5bo") returns 0.

Put # before ?mtmPreviewMode then it’ll break

That makes sense as everything after # is just part of the hash, but looks at the GET parameters.

I am so stupid. You are right. Now it’s working! Sorry for the inconvenience!

1 Like