Skip to content

Commit

Permalink
Hopefully fixed cookies?.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaanavD committed Sep 13, 2024
1 parent 0959589 commit eef96b3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
},
propertyConfiguration: {
// Properties Plugin configuration
gpcDataSharingOptIn: false,
callback: {
userConsentDetails: _getWcpUserConsentDetails
},

env: 'PROD' // Environment can be set to PPE or PROD as needed.
},
webAnalyticsConfiguration: {
Expand Down Expand Up @@ -77,6 +82,7 @@
}
};

var siteConsent = null;
WcpConsent.init(
'en-US',
'cookie-banner',
Expand All @@ -91,6 +97,24 @@
WcpConsent.themes.light
);

function _getWcpUserConsentDetails() {
if (siteConsent) {
return siteConsent.getConsent();
}

// The exact value that you return here is dependent on your site, team and how
// use any data that is stored (work with you privacy team to determine what the
// correct "defaults" (true or false) should be for each item when the code is
// unable to determine (via WCP) if or what the user has (or has not) consented
// to.
return {
Required: [true], // Most likely `true`
Analytics: [true],
SocialMedia: [true],
Advertising: [false]
};
}

function onConsentChanged(categoryPreferences) {
if (categoryPreferences.Analytics) {
// Google Analytics
Expand Down

0 comments on commit eef96b3

Please sign in to comment.