Skip to content

Commit

Permalink
Add cookie consent form (#8)
Browse files Browse the repository at this point in the history
- Also add Google Analytics

Closes #7

* Google Analytics
  • Loading branch information
charneykaye authored May 15, 2024
1 parent 62a8750 commit a6b88b5
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config/_default/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ title = "XJ music documentation"
# Don't use any auto-generated summaries
summaryLength = 10

# Google Analytics
googleAnalytics = "G-GW9VCFXV42"

[outputs]
# add `search` to the home to support Lunr search; This is a mandatory setting
# for the side wide search functionality
Expand Down
8 changes: 7 additions & 1 deletion layouts/partials/custom-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@
#R-body img.bg-white {
background-color: white;
}
</style>
</style>

<link rel="stylesheet" href="/css/cookieconsent.css">

{{- if .Site.GoogleAnalytics }}
{{ template "_internal/google_analytics.html" . }}
{{- end}}
1 change: 1 addition & 0 deletions layouts/partials/menu-footer.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<script type="module" src="/js/cookieconsent-config.js"></script>

<div style="display:flex; flex-direction: row; align-items: center; padding-left: 20px;">
<a href="https://xjmusic.com/">
Expand Down
1 change: 1 addition & 0 deletions static/css/cookieconsent.css

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions static/js/cookieconsent-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import '/js/cookieconsent.umd.js';

/**
* All config. options available here:
* https://cookieconsent.orestbida.com/reference/configuration-reference.html
*/
CookieConsent.run({

page_scripts: true,

categories: {
analytics: {
enabled: true,
}
},

language: {
default: 'en',
translations: {
en: {
consentModal: {
title: 'We Value Your Privacy',
description: 'To provide you with the best experience on our website, we use cookies to measure our performance and improve our content. By clicking "Accept All", you agree to the storing of cookies on your device. You can customize your cookie preferences by selecting "Manage Settings". For more information, please visit our <a href="/privacy"/>Privacy Policy</a>.',
acceptAllBtn: 'Accept all',
acceptNecessaryBtn: 'Reject all',
showPreferencesBtn: 'Manage Individual preferences'
},
preferencesModal: {
title: 'Manage cookie preferences',
acceptAllBtn: 'Accept all',
acceptNecessaryBtn: 'Reject all',
savePreferencesBtn: 'Accept current selection',
closeIconLabel: 'Close modal',
sections: [
{
title: 'No Personally Identifiable Information',
description: 'We use cookies only to measure our performance and improve our content in order to provide you with the best experience on our website'
},
{
title: 'Performance and Analytics',
description: 'These cookies collect information about how you use our website. All of the data is anonymized and cannot be used to identify you.',
linkedCategory: 'analytics'
},
{
title: 'More information',
description: 'For more information, please visit our <a href="/privacy"/>Privacy Policy</a>. For any queries in relation to my policy on cookies and your choices, please <a href="/contact-us">contact us</a>'
}
]
}
}
}
}
});
7 changes: 7 additions & 0 deletions static/js/cookieconsent.umd.js

Large diffs are not rendered by default.

0 comments on commit a6b88b5

Please sign in to comment.