Repository navigation
[Docs] Incorrect CSP connect-src configuration in Matomo tracking example #4860
Lychee versionN/A Did you check the latest Lychee version?Yes, I did Which PHP version are you using?PHP 8.5 Detailed description of the problemDescriptionThe External Tracking documentation contains an incorrect Content Security Policy (CSP) configuration for Matomo Analytics. Under Allow loading tracking script, the documentation recommends: SECURITY_HEADER_SCRIPT_SRC_ALLOW=https://analytics.example.com/matomo.js
SECURITY_HEADER_CSP_CONNECT_SRC=https://analytics.example.com/matomo.jsHowever, the ProblemMatomo uses two separate endpoints:
Because the documented This can result in Matomo's JavaScript loading successfully while page views and other tracking events are not recorded. Suggested FixUpdate the documented configuration to: SECURITY_HEADER_SCRIPT_SRC_ALLOW=https://analytics.example.com/matomo.js
SECURITY_HEADER_CSP_CONNECT_SRC=https://analytics.example.comAlternatively, for a more restrictive CSP: SECURITY_HEADER_SCRIPT_SRC_ALLOW=https://analytics.example.com/matomo.js
SECURITY_HEADER_CSP_CONNECT_SRC=https://analytics.example.com/matomo.phpUsing the origin for Steps to reproduce the issueN/A Diagnostics [REQUIRED]N/A Browser & System [REQUIRED]N/A Please confirm (incomplete submissions will not be addressed)
|
Replies: 1 comment 4 replies
|
You're right. SECURITY_HEADER_SCRIPT_SRC_ALLOW=https://analytics.example.com/matomo.js
SECURITY_HEADER_CSP_CONNECT_SRC=https://analytics.example.com(or The docs page lives in the website repo, LycheeOrg/LycheeOrg.github.io, at |
You're right.
connect-srcshould allow the endpoint the tracker sends data to, not the script file, so pointing it atmatomo.jsdoesn't help. Allowing the Matomo origin covers it:(or
https://analytics.example.com/matomo.phpif you'd rather keep it to the exact endpoint).The docs page lives in the website repo, LycheeOrg/LycheeOrg.github.io, at
src/content/docs/docs/administration/external-tracking.md, so a small PR there with this fix would be the quickest way to get it corrected.