Closed Wylbur closed 2 years ago
That seems feasible, we just need a setting in the admin form and then add a noscript tag to the tracking code like that:
<img src="https://matomo.example.org/matomo.php?idsite={$IDSITE}&rec=1" style="border:0" alt="" />
A PR is available for testing. Caution, it's a "quick shot", don't use on production yet. Note: update.php needs to be run.
Confirming that the js script checkbox appears, and does generate noscript snippet.
Thanks for adding this so quickly!
Thanks for adding this so quickly!
We're not completely done yet.
When creating the PR, I wondered, why the port uses hook_preprocess_layout() instead of hook_preprocess_page(). The D version uses hook_page_alter(), which doesn't exist in B. However, the B equivalent would be hook_preprocess_page (not layout).
@hosef Do you happen to remember, why you chose the layout preprocessor instead of the page preprocessor?
It didn't matter until now, as the hook only adds js (backdrop_add_js can be done in many places). The noscript tag needs real markup in the page, though, and outside the layout (in page_bottom). So now the module has to implement two hooks, which seems inefficient. I'd like to combine all in hook_preprocess_page(), which is a bigger change. So I'd like to know the reason for the previous hook choice.
FTR: I got answer from @hosef in the chat - he doesn't remember why and hook_preprocess_page is also OK.
Matomo provides an option for installing a no script image tracker.
https://matomo.org/faq/how-to/faq_176/
This is a feature request to add this as a feature to the Matomo module.