Dynamic Web Report – How to inject Matomo tracking code in generated pages?

Hello,

I am trying to add a Matomo analytics tracking code to the pages generated by the Dynamic Web Report plugin.

Here is what I did:

  1. Created a new Gramps note of type “HTML Code”

  2. Pasted the standard Matomo tracking code (containing <script> tags) into that note

  3. In the Dynamic Web Report settings, went to the Pages tab and selected that note as the “HTML header”

However, after generating the report, the Matomo code does not appear anywhere in the generated HTML files — neither in index.html nor in any other page. The <head> section of the generated pages contains no trace of the note content.

Is the “HTML header” field in the Pages tab actually meant to inject raw HTML/JavaScript into the <head> of the generated pages? Or does it serve a different purpose?

If this is not the right approach, is there a supported way to inject a tracking script (like Matomo or Google Analytics) into the pages generated by the Dynamic Web Report?

Thank you for any guidance!

I think you need to edit dynamicweb.py and change the header writing method (write_header) to include your HTML guidelines.
This method is called whenever you create a new HTML page.
I am not a specialist in dynamic web, but I will start in this direction.