Validation problem for code in footer
-
I have been using for years matomo/piwik integration through json code in footer of amp pages. Since last version of ampforwp I get json script validation errors. The problem is that suddenly, the slashes in the code below get stripped when showing in html code of the page. I validate the code below in amp validator and then it gets borken, in the second example.
<amp-analytics><script type="application/json"> { "triggers": { "trackPageview": { "on": "visible", "request": "pageview" } }, "requests": { "base": "https://www.102mg.ro/stats/matomo.php?idsite=1&rec=1&action_name=${title}&url=${sourceUrl}&rand=${random}&apiv=1&urlref=${documentReferrer}&res=${screenWidth}x${screenHeight}&lang=${browserLanguage}>_ms=${serverResponseTime}&cs=${documentCharset}&_cvar={\"1\":[\"errorName\",\"${errorName}\"],\"2\":[\"errorMessage\",\"${errorMessage}\"]}", "pageview": "${base}" } } </script></amp-analytics>
Example 2, actual output in the page:
<amp-analytics><script type="application/json"> { "triggers": { "trackPageview": { "on": "visible", "request": "pageview" } }, "requests": { "base": "https://www.102mg.ro/stats/matomo.php?idsite=1&rec=1&action_name=${title}&url=${sourceUrl}&rand=${random}&apiv=1&urlref=${documentReferrer}&res=${screenWidth}x${screenHeight}&lang=${browserLanguage}>_ms=${serverResponseTime}&cs=${documentCharset}&_cvar={"1":["errorName","${errorName}"],"2":["errorMessage","${errorMessage}"]}", "pageview": "${base}" } } </script></amp-analytics>
Please help, I want to use the json code, as the normal implementation of matomo doesn’t track properly.
Thank you!
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Validation problem for code in footer’ is closed to new replies.