Skip to content

Instantly share code, notes, and snippets.

@pingpoli
Created October 20, 2020 14:39
Show Gist options
  • Save pingpoli/51f81a79ef26561423add59674f56570 to your computer and use it in GitHub Desktop.
Save pingpoli/51f81a79ef26561423add59674f56570 to your computer and use it in GitHub Desktop.
// by default, personalized ads are turned off
var CCM_showPersonalizedAds = false;
// increase this number when your cookie policy has changed, this will show the popup to all users again
var CCM_versionNumber = 0;
function CCM_getCookieConsent( forceShow )
{
var consent = CCM_getCookie( "ccm_accepted_v"+CCM_versionNumber );
if ( consent != "yes" || forceShow )
{
// if the consent form hasn't been shown to the user, show it
CCM_showPopup();
}
else
{
var personalizedAds = CCM_getCookie( "ccm_personalizedAds" );
if ( personalizedAds == "yes" ) CCM_showPersonalizedAds = true;
// renew the cookies so frequent users don't get the popup all the time
CCM_setCookies( CCM_showPersonalizedAds );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment