Skip to content

Instantly share code, notes, and snippets.

@samuelkahr
Last active January 14, 2020 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuelkahr/343350ad0a466ded566f0d0c8167e800 to your computer and use it in GitHub Desktop.
Save samuelkahr/343350ad0a466ded566f0d0c8167e800 to your computer and use it in GitHub Desktop.
<script type="application/javascript">
window.consentManagerConfig = function(exports) {
var React = exports.React;
var inEU = exports.inEU;
var inCA = function() { return false; };
var initialPreferences = {
'Functional': true
};
var onOptionsClick = function() {
exports.openConsentManager();
};
var shouldRequireConsent = function() {
return inEU() || inCA();
};
if (inCA()) {
initialPreferences = {
'Analytics': true,
'Functional': true,
'Targeting and Advertising': true,
}
}
if (inEU()) {
initialPreferences = {
'Functional': true
}
}
var customCategories = {
'Analytics': {
integrations: [
'Google Analytics',
],
purpose: 'Provide statistical information on site usage, e.g., web analytics so we can improve this website over time.',
},
'Functional': {
integrations: [
'Marketo V2',
'Natero',
'Optimizely Web',
'Salesforce',
],
purpose: 'Enables enhanced functionality, such as videos and live chat. If you do not allow these, then some or all of these functions may not work properly.',
},
'Targeting and Advertising': {
integrations: [
'Google Ads (Classic)',
],
purpose: 'Used to create profiles or personalize content to enhance your shopping experience.',
},
};
var bannerContent = React.createElement(
'div',
{class: 'consentBannerText', style: 'display: flex; align-items: center; justify-content: flex-end; padding: 10px 10px;'},
React.createElement(
'span',
{style: 'flex-grow: 1; text-align: left;'},
'We use cookies (and other similar technologies) to improve your experience on our site and to serve you better. By using our website, you are agreeing to the collection of data as described in our',
'\u00a0',
React.createElement(
'a',
{ href: '/privacy/', target: '_blank' },
'Privacy Policy'
),
'. You can',
'\u00a0',
React.createElement(
'a',
{ onClick: function() { onOptionsClick() } },
'change your preferences'
),
'\u00a0',
'at any time.'
),
);
var prefs = {
bannerBackgroundColor: '#313441',
bannerContent: bannerContent,
bannerSubContent: null,
cancelDialogContent: 'Your preferences have not been saved. By continuing to use our website, you are agreeing to our Website Data Collection Policy',
cancelDialogTitle: 'Are you sure you want to cancel?',
closeBehavior: 'accept',
container: '#consent-manager',
customCategories: customCategories,
implyConsentOnInteraction: false,
initialPreferences: initialPreferences,
preferencesDialogContent: 'We use data collected by cookies and JavaScript libraries, which are necessary for website functioning, to improve user’s browsing experience, analyze site traffic, deliver personalized advertisements, and increase the overall performance of our site.',
preferencesDialogTitle: 'Website Data Collection Preferences',
// shouldRequireConsent: shouldRequireConsent,
shouldRequireConsent: function() {return true},
writeKey: "<string>",
}
return prefs;
}
</script>
@samuelkahr
Copy link
Author

Here is an example of how you can create/configure custom categories in our out of the box consent manager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment