RE: Liferay 7.1 swapping "<" and ">" for "&lt;" and "&gt;"

Olaf Kock, modified 1 Year ago. New Member Posts: 4 Join Date: 3/6/24 Recent Posts

Hi, I'm trying to implement a matomo traffic tracking script on an old Liferay 7.1 website.

I managed to make it work flawlessly on some website, but on this specific one I'm getting an issue where all "<" and ">" characters get swapped into "&lt;" and "&gt;", making all the code within the script being interpreted as plain text by the browser.

I'm using the "Configuration > Website Settings > Advanced > Piwik" field to copypaste the matomo script. As I mentioned before it works just fine on multiple Liferay 7.1 websites but on this specific one I'm mentioning I get the odd behaviour I described above.

This makes me think that this specific installation of Liferay might have some different setting somewhere compared to the other ones. Question is: which setting? Can anybody help me understanding what's going on?

 

Thanks a lot

7.1
thumbnail
Jamie Sammons, modified 1 Year ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

If you're copy/pasting the script, make sure it's not already escaped (but well hidden in the place where you copy it from.

Validate if the versions of all the servers are the same (e.g. you might run a version with a bug) - speaking of which: If you run into an issue on 7.1, it's always worth trying to reproduce on the latest version (7.4, for almost 2.5 years now). There's likely no more bugfix for 7.1

If all else goes wrong, as a quick workaround: If you've deployed your own theme (and on 7.1 that's a good assumption), you could also just add the script there without worrying for it to be mangled.

Olaf Kock, modified 1 Year ago. New Member Posts: 4 Join Date: 3/6/24 Recent Posts

Turns out the specific 7.1 version installed on that VM where I'm having this issue is slightly different from the one on my other VMs. Turns out on that specific version the behaviour I've been experiencing is a known issue/bug.

We are already in the process of migrating everything to 7.4 of course, but it's gonna take more time and I wanted to start tracking traffic through matomo on that website immediately.

The idea about putting the script inside the custom theme is really good though, didn't think about it. Thanks! I'll see if I can fix it that way, if not I guess we'll just wait until the 7.4 migration is over (and yep, gonna take several more months lol)

Olaf Kock, modified 1 Year ago. New Member Posts: 4 Join Date: 3/6/24 Recent Posts

Turns out the specific 7.1 version installed on that VM where I'm having this issue is slightly different from the one on my other VMs. Turns out on that specific version the behaviour I've been experiencing is a known issue/bug.

We are already in the process of migrating everything to 7.4 of course, but it's gonna take more time and I wanted to start tracking traffic through matomo on that website immediately.

The idea about putting the script inside the custom theme is really good though, didn't think about it. Thanks! I'll see if I can fix it that way, if not I guess we'll just wait until the 7.4 migration is over (and yep, gonna take several more months lol)