1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-11-24 21:20:17 +01:00
hugo-theme-bootstrap4-blog/layouts/partials/cookie-consent.html
Alan Orth 3b360d2eef
Use haven for GDPR popup instead of cookieconsent
Haven is newer and more well maintained (and also it is actually
open source instead of open core with an upsell to a paid subscrip-
tion). Haven is configured to be 100% *opt-in* for Google Analytics,
which means it does not load or send a hit until the user agrees.

This is mostly a drop-in replacement, but translations need to make
sure the following strings are updated:

- cookieAccept
- cookieDecline
2020-05-13 13:19:41 +03:00

39 lines
1.2 KiB
HTML

{{ $cookieConsentScript := resources.Get "js/haven.umd.min.js" | resources.Fingerprint }}
<script src="{{ $cookieConsentScript.Permalink }}"{{ if not .Site.Params.disable_sri }} integrity="{{ $cookieConsentScript.Data.Integrity }}" crossorigin="anonymous"{{ end }}></script>
<script>
Haven.create({
notification: {
policyUrl: "{{ .Site.Params.cookie_consent_info_url | absURL }}",
styles: {
background: '#428bca',
textColor: '#ffffff',
buttonBackgroundColor: '#f71559',
buttonTextColor: '#ffffff',
},
},
translations: {
{{ .Lang }}: {
notification: {
policy: '{{ i18n "cookieLink" }}',
message: '{{ i18n "cookieMessage" }}',
accept: '{{ i18n "cookieAccept" }}',
decline: '{{ i18n "cookieDecline" }}',
}
},
},
services: [
{
name: 'google-analytics',
options: {
id: '{{ .Site.Params.googleAnalytics }}',
},
purposes: ['analytics'],
inject: true,
}
]
});
</script>
{{- /* vim: set ts=2 sw=2 et: */}}