Add support for Google Analytics with Content security policy headers
This commit is contained in:
parent
8bc6904c8a
commit
60e8fcc73e
2 changed files with 12 additions and 0 deletions
|
|
@ -11,3 +11,9 @@ _paq.push(['setTrackerUrl', matomoTrackingApiUrl]);
|
||||||
_paq.push(['setSiteId', idSite]);
|
_paq.push(['setSiteId', idSite]);
|
||||||
_paq.push(['trackPageView']);
|
_paq.push(['trackPageView']);
|
||||||
_paq.push(['enableLinkTracking']);
|
_paq.push(['enableLinkTracking']);
|
||||||
|
|
||||||
|
var googleAnalytics = {{ .Site.GoogleAnalytics }};
|
||||||
|
|
||||||
|
var _gaq = window._gaq || [];
|
||||||
|
_gaq.push(['_setAccount', googleAnalytics]);
|
||||||
|
_gaq.push(['_trackPageView']);
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,9 @@
|
||||||
<script src="{{ $script.RelPermalink }}"></script>
|
<script src="{{ $script.RelPermalink }}"></script>
|
||||||
<script defer src="https://{{ .Site.Params.piwikTrackerUrl }}/matomo.js"></script>
|
<script defer src="https://{{ .Site.Params.piwikTrackerUrl }}/matomo.js"></script>
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|
||||||
|
{{ if .Site.GoogleAnalytics -}}
|
||||||
|
{{ $script := resources.Get "js/tracking.js" | resources.ExecuteAsTemplate "js/tracking.js" . | minify | fingerprint -}}
|
||||||
|
<script src="{{ $script.RelPermalink }}"></script>
|
||||||
|
<script defer src="https://ssl.google-analytics.com/ga.js"></script>
|
||||||
|
{{ end -}}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue