Conversation
c56687c to
4da4f63
Compare
64635c5 to
3fe0c07
Compare
jbub
left a comment
There was a problem hiding this comment.
Thanks for the contribution. Lets do it more like the google analytics internal template, maybe we can then merge it upstream as a internal hugo template.
| {{ if .RSSLink }} | ||
| <link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml"> | ||
| {{ end }} | ||
| {{ if .Site.Params.MatomoUrl }}{{ partial "matomo.html" . }}{{ end }} |
There was a problem hiding this comment.
Can we move this at the top of body just after the google_analytics in the header.html ? Also lets do the if check inside the template.
| @@ -0,0 +1,21 @@ | |||
| {{ $siteId := cond (isset .Site.Params "matomositeid") .Site.Params.MatomoSiteId "1" }} | |||
| {{ $clientSideDNT := cond (isset .Site.Params "matomoclientsidednt") .Site.Params.MatomoClientSideDNT true }} | |||
There was a problem hiding this comment.
Lets do the DNT check just like in the google analytics template https://raw.githubusercontent.com/gohugoio/hugo/master/tpl/tplimpl/embedded/templates/google_analytics.html and introduce a param like matomoRespectDoNotTrack. If that option is true it should not even include the tracking snippet, just like in the google analytics. Also be sure to check for user DNT setting in browser var dnt = (navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack);.
There was a problem hiding this comment.
Hmm, I see where you're getting at.
However, this specific flag serves to include a JS snippet that prevents the request from being sent at all if the user's DNT setting is turned on.
So the check you're referring to is in the javascript that is included. https://github.com/matomo-org/matomo/blob/6f5b85b6f7d2195362ae03480120f4cef5ec4dc1/js/piwik.js#L6564
Knowing this, would you still add it yourself? :)
| g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); | ||
| })(); | ||
| </script> | ||
| {{ if .Site.Params.MatomoEnableFallback }} |
There was a problem hiding this comment.
It's a Matomo specific option, not really a fallback for the option on its own, but if the user has JS disabled this 'fallback' provides a way of tracking it using an img element.
So, a better suggestion for the name?
There was a problem hiding this comment.
Do people still disable javascript ? I mean most of today pages are JS heavy :)
There was a problem hiding this comment.
I personally know a few ¯\_(ツ)_/¯
This PR adds the following options to
Params:1)P.S. This is my first encounter with Hugo's templating, if something can be done better, please suggest / correct 👍