Open bwbroersma opened 2 months ago
Currently this custom code is added in the HTML:
<div class="hidethis" aria-hidden="true"> <span id="matomo-url">//matomo.internet.nl/</span> <span id="matomo-siteid">1</span> <span id="matomo-subdomain-tracking">*.internet.nl</span> </div>
It uses the hidethis class to hide it and then uses frontend/js/matomo.js to pass this on as arguments for the Matomo javascript.
hidethis
frontend/js/matomo.js
This is obviously done to comply with CSP & keep it dynamic configurable. Although another approach would be to generate the JS with the parameters. An improvement to the current code would be to use HTML 5 hidden attribute instead of CSS rule: https://github.com/internetstandards/Internet.nl/blob/db713eb3170884fc91ad893b72e37f732fcc595a/frontend/css/style.css#L961-L963
hidden
The current variables are only in the settings.py and base template: https://github.com/internetstandards/Internet.nl/blob/fca192a153dfd6697fa2966cee11fdc5baf029d3/internetnl/settings.py#L109-L114 https://github.com/internetstandards/Internet.nl/blob/fca192a153dfd6697fa2966cee11fdc5baf029d3/interface/templates/base.html#L30-L34 via docker compose env of the app container: https://github.com/internetstandards/Internet.nl/blob/fca192a153dfd6697fa2966cee11fdc5baf029d3/docker/docker-compose.yml#L151-L153
Currently the app (Django) container is serving the /static files, so either fix it during minimizing: https://github.com/internetstandards/Internet.nl/blob/fca192a153dfd6697fa2966cee11fdc5baf029d3/docker/Dockerfile#L204 or, since the Django code doesn't uses these variables, it could be done with a .template and adding a line like this below the line mentioned above:
RUN envsubst < ...matamo.js.template > ...matamo.js
Currently this custom code is added in the HTML:
It uses the
hidethis
class to hide it and then usesfrontend/js/matomo.js
to pass this on as arguments for the Matomo javascript.This is obviously done to comply with CSP & keep it dynamic configurable. Although another approach would be to generate the JS with the parameters. An improvement to the current code would be to use HTML 5
hidden
attribute instead of CSS rule: https://github.com/internetstandards/Internet.nl/blob/db713eb3170884fc91ad893b72e37f732fcc595a/frontend/css/style.css#L961-L963The current variables are only in the settings.py and base template: https://github.com/internetstandards/Internet.nl/blob/fca192a153dfd6697fa2966cee11fdc5baf029d3/internetnl/settings.py#L109-L114 https://github.com/internetstandards/Internet.nl/blob/fca192a153dfd6697fa2966cee11fdc5baf029d3/interface/templates/base.html#L30-L34 via docker compose env of the app container: https://github.com/internetstandards/Internet.nl/blob/fca192a153dfd6697fa2966cee11fdc5baf029d3/docker/docker-compose.yml#L151-L153
Currently the app (Django) container is serving the /static files, so either fix it during minimizing: https://github.com/internetstandards/Internet.nl/blob/fca192a153dfd6697fa2966cee11fdc5baf029d3/docker/Dockerfile#L204 or, since the Django code doesn't uses these variables, it could be done with a .template and adding a line like this below the line mentioned above: