Skip to content

Instantly share code, notes, and snippets.

@baires
Last active March 12, 2020 16:39
Show Gist options
  • Save baires/4e5b1643801d1eb8e5df35be662bf65b to your computer and use it in GitHub Desktop.
Save baires/4e5b1643801d1eb8e5df35be662bf65b to your computer and use it in GitHub Desktop.
<script type="application/javascript">
window.consentManagerConfig = function (exports) {
exports.preferences.onPreferencesSaved(function (prefs) {
// could be used to store consent server side, or send it into an API
})
return {
container: '#consent-manager',
writeKey: 'VHWyTMQuPx5KYcdVotFH8PK6PEr8jHen',
/* initialPreferences allows for customizing which categories already pre-loaded */
initialPreferences: {
marketingAndAnalytics: false,
// functional: true will automatically record consent for functional cookies
functional: true
},
/*
The consent manager ships with a lightweight version of
React (preact) that you can use to customize the consent manager further
*/
bannerContent: exports.React.createElement('span', null, '🍪We like cookies 🍪'),
bannerSubContent: 'Change your preferences 👻',
preferencesDialogTitle: 'Website Data Collection',
preferencesDialogContent: 'We use data collected by cookies and JavaScript libraries.',
cancelDialogTitle: '🤔Are you sure you want to cancel?',
cancelDialogContent: 'Your preferences have not been saved.'
}
}
</script>
<script
src="https://unpkg.com/@segment/consent-manager@4.0.0/standalone/consent-manager.js"
defer
></script>
<div id="consent-manager"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment