matomopiwiktracker

saving custom scripts in matomo tag manager results in 403


As soon as I add <script> ... </script> to a "custom html" tag in Matomo Tag Manager and hit "save", there is a network request error 403 saying "You don't have permission to access this resource. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request."

This one fails when I click "save":

<script> abc </script>

This one succeeds when I click "save":

abc

Actual behavior: saving fails

Expected behavior: saving succeeds


Solution

  • It is very likely that you are using a Web Application Firewall (WAF) like mod_security that blocks form submissions (and therefore POST parameters) that contains HTML.