Skip to content

Commit

Permalink
Feat: Push info to dataLayer on accept
Browse files Browse the repository at this point in the history
  • Loading branch information
literat committed Oct 19, 2021
1 parent 1a43014 commit 4203092
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/LmcCookieConsentManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ const LmcCookieConsentManager = (options = defaultOptions) => {
transition: 'slide', // zoom/slide
},
},
onAccept: () => {
alert('Cookie Consent Accepted');
onAccept: (cookie) => {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'CookieConsent-update',
'CookieConsent.analytics': cookie.level.includes('analytics'),
'CookieConsent.ads': cookie.level.includes('targeting'),
'CookieConsent.revision': cookie.revision,
});
},
languages: {
en: configEn,
Expand Down

0 comments on commit 4203092

Please sign in to comment.