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 Code: wrong link in noscript part #16391

Closed
voxspox opened this issue Sep 4, 2020 · 3 comments
Closed

Tracking Code: wrong link in noscript part #16391

voxspox opened this issue Sep 4, 2020 · 3 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@voxspox
Copy link

voxspox commented Sep 4, 2020

Matomo 3.14.0

In "Settings" ... "JavaScript Tracking Code" I find the following tracking code:

<!-- Matomo -->
...
<noscript><p><img src="https://.../matomo.php?idsite=1&amp;rec=1" style="border:0;" alt="" /></p></noscript>
<!-- End Matomo Code -->

I assume the &amp; should be a & for passing parameters correctly 🤔

@Findus23
Copy link
Member

Findus23 commented Sep 4, 2020

I assume the & should be a & for passing parameters correctly thinking

Why do you assume this? Ambiguous ampersands in HTML do have to be encoded for the HTML parser to know you are referring to the & character. (At least I think, unless this change in recent HTML versions)

@tsteur
Copy link
Member

tsteur commented Sep 6, 2020

Thanks @voxspox I tested this and things work correctly this way. If there's something not working this way please comment here and I'll be happy to reopen.

@tsteur tsteur closed this as completed Sep 6, 2020
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Sep 6, 2020
@C-Duv
Copy link

C-Duv commented Jan 7, 2021

Why do you assume this? Ambiguous ampersands in HTML do have to be encoded for the HTML parser to know you are referring to the & character. (At least I think, unless this change in recent HTML versions)

It looks like it did changed (but not recently) to allow ...php?idsite=1&rec=1 not being ambiguous anymore. cf. https://mathiasbynens.be/notes/ambiguous-ampersands:

Later the spec was changed, and the HTML spec now defines ambiguous ampersands as follows:

An ambiguous ampersand is a U+0026 AMPERSAND character (&) that is followed by one or more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL LETTER Z, and U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z, followed by a U+003B SEMICOLON character (;), where these characters do not match any of the names given in the named character references section.

This definition is probably easier to grok as a regular expression: a string contains an ambiguous ampersand if it matches /&([0-9a-zA-Z]+;)/ and if the first back-reference ($1) is not a known character reference.

Thanks for the issue and answer though: When reading ...php?idsite=1&amp;rec=1 in the code of a Matomo-using application I wasn't really sure if I had a bug or not, now I have the reason for my doubts and the confirmation it works. 👍

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

4 participants