Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!doctype html>
<html>

<head>
  <script type="text/javascript">
    var _iub = _iub || [];
    _iub.csConfiguration = {
      "countryDetection": true, //automatically detect the user country
      "invalidateConsentWithoutLog": true, //request a new consent whenever the preference has not been found
      "lang": "en",
      "siteId": 896537, //use your siteId
      "cookiePolicyId": 8207462, //use your cookiePolicyId
      "whitelabel": false, //show the iubenda branding on the second layer
      "consentOnContinuedBrowsing": false, //disable consent on scroll and page interaction
      "floatingPreferencesButtonDisplay": "bottom-right", //privacy widget
      "perPurposeConsent": true, //per-category consent
      "banner": {
        "position": "float-top-center",
        "acceptButtonDisplay": true, //display the "Accept" button
        "customizeButtonDisplay": true, //display the "Learn more and customize" button
        "rejectButtonDisplay": true, //display the "Reject" button
        "closeButtonDisplay": true, //display the banner's close button
        "closeButtonRejects": true, //when the banner's close button is clicked, user's consent is considered as denied
        "listPurposes": true, //display purposes in the 1st layer of the cookie banner
        "explicitWithdrawal": true //mention the right to withdraw consent
      }
    };
  </script>
  <script type="text/javascript" src="//cdn.iubenda.com/cs/iubenda_cs.js" charset="UTF-8" async></script>
</head>

<body>
  <header>
    <div class="wrapper">
      <h1>iubenda Cookie Solution</h1>
      <p>How to comply with Italy's new cookie guidelines</p>
    </div>
  </header>

  <section class="wrapper">

    <p>This is an example of a Cookie Solution configuration compliant with Italy's new cookie guidelines (effective January 10, 2022).</p>

    <div class="note">
      <ul>
        <li>You can see the <a href="https://codepen.io/iubenda/pen/MWEVYrO?editors=1000" target="_blank">code here</a></li>
        <li>Remember to use your own credentials from <a href="https://www.iubenda.com/en/dashboard" target="_blank">your iubenda account</a></li>
        <li>This is a sample for pure demonstrative purposes, <strong>no consents are saved</strong> (result of <code>_iub.csConfiguration.skipSaveConsent = true</code>). Just refresh the page to make the cookie banner reappear.</li>
        <li><strong>If you don't see the cookie banner on your first visit</strong>, you may have a consent cookie saved from another demo: <a href="#" onclick="_iub.cs.cookie.resetCookies({local: true,remote: true});alert('Consent cookie deleted. Now click on OK and refresh the page to return to the starting point.')">reset consent</a> and refresh the page to make the cookie banner reappear.</li>
      </ul>
    </div>

    <p>Here's what you have to do to comply with Italy's new cookie guidelines:</p>

    <ul class="guides">
      <li>Activate <strong>"Accept", "Learn more and customize" and "Reject"</strong> (or an "x" to allow users to continue without accepting and close the banner) <strong>buttons</strong></li>
      <li>List <strong>tracking purposes</strong> in the notice</li>
      <li>Mention the <strong>right to withdraw consent</strong></li>
      <li>Offer granular control with <strong>per-category-consent</strong> (more info <a href="#per-category-consent">below</a>)</li>
      <li>Disable <strong>consent on continued browsing</strong> (consent on scroll and page interaction are not valid)</li>
      <li>Enable the <strong>privacy widget</strong> to allow your users to access and edit their tracking preferences at any time (to see it in action in this demo, close the cookie banner and the widget will appear in the bottom right corner)</li>
      <li>Activate your <strong>Cookie Preference Logs</strong> (more info <a href="#cpl">below</a>)</li>
    </ul>

    <hr />

    <h3>Configurator</h3>

    <p>Please note the options checked in the Cookie Solution configurator:</p>

    <img src="https://help.iubenda.com/wp-content/uploads/2022/01/cs-garante-en.png" alt="Cookie Solution configurator" width="480" />

    <p>The privacy widget is customizable by clicking on the "Position" dropdown.</p>

    <p>Also:</p>

    <ul class="guides">
      <li>If you've activated the <a href="https://www.iubenda.com/en/help/7440" target="_blank">TCF</a> and restricted the purposes, you need to make sure they're based on only consent (and <strong>not legitimate interest</strong>). To do this, in the Cookie Solution configurator, go into the "Advanced Options", scroll to "IAB Transparency and Consent Framework". If you've previously restricted purposes, the "Restrict Purposes" section will be extended. Under this section, make sure that "Consent only" is selected.</li>
      <li>The default <strong>validity period of cookie preferences</strong> for the Cookie Solution is 12 months, which already complies with the Garante's indications. If you had customized it, scroll the configurator's "Advanced view" to "Validity period of user's consent preferences (days)", and make sure you set it to at least 180 days.</li>
      <li><strong>Cookie walls</strong> are not allowed.</li>
    </ul>

    <hr />

    <h3>Installation</h3>
    <p>Once saved, copy and paste the snippet on your pages (replacing the previous integration code, if present).</p>

    <p>If you use our plugin for <a href="https://www.iubenda.com/en/help/1215" target="_blank">WordPress</a>, <a href="https://www.iubenda.com/en/help/1323" target="_blank">Joomla!</a>, <a href="https://www.iubenda.com/en/help/4338" target="_blank">PrestaShop</a> or <a href="https://www.iubenda.com/en/help/9591" target="_blank">Magento</a>, you'll have to replace Cookie Solution code that you'll find in the plugin configuration panel.</p>

    <hr />

    <h3 id="cpl">Cookie Preference Logs</h3>

    <p>Like many others across Europe (including the UK, Ireland, Germany, France, Belgium and more), Italy's Data Protection Authority explicitly require you to prove that you have obtained valid consent according to the standards of the GDPR.</p>

    <p>This means that you need to keep records of the cookie preferences your users set when they visit your site.</p>

    <p>Cookie Preference Logs are now available in your dashboard:</p>

    <img src="https://help.iubenda.com/wp-content/uploads/2022/01/cs-dashboard-cpl.png" alt="Cookie Preference Logs" width="600" />

    <p>If you can't access them, you need to activate them. To activate Cookie Preference Logs, <a href="https://www.iubenda.com/en/help/45718" target="_blank">upgrade your Cookie Solution</a>.</p>

    <p>Also, make sure to <strong>request new consent when preference record is not found</strong> (option available in the "Advanced view" of the configurator):</p>

    <img src="https://help.iubenda.com/wp-content/uploads/2022/01/cs-garante-invalidateConsentWithoutLog-en.png" alt="invalidateConsentWithoutLog" width="480" />

    <p>In the embedding code you'll have:</p>

    <p><code>"invalidateConsentWithoutLog": true</code></p>

    <p>If you need it, the advanced options allow you to choose a specific date.</p>

    <hr />

    <h3 id="per-category-consent">Configure per-category consent and block cookies prior to consent</h3>

    <p>Per-category consent gives users granular control on which categories of cookies or other identifiers to give consent to:</p>

    <ul>
      <li>Strictly necessary (purpose id 1, no consent required)</li>
      <li>Basic interactions & functionalities (purpose id 2)</li>
      <li>Experience enhancement (purpose id 3)</li>
      <li>Measurement (purpose id 4)</li>
      <li>Targeting & Advertising (purpose id 5)</li>
    </ul>

    <p>The categories displayed in the modal are automatically detected, but they can also be <a href="https://codepen.io/iubenda/pen/zYYJwYr/left?editors=1000" target="_blank">customized</a>.</p>

    <div class="tip">
      <p>💡 Click on the "Learn more and customize" button to see this feature in action. Grant consent to the "Experience enhancement" category to release the Twitter script below.</p>
    </div>

    <p>To demonstrate how per-category consent and cookie blocking work, we've embed a Twitter follow button:</p>

    <!-- please note type="text/plain" class="_iub_cs_activate" data-suppressedsrc="..." (manual tagging) and data-iub-purposes="3" (per-category consent) -->
    <a href="https://twitter.com/iubenda" class="twitter-follow-button" data-show-count="true" data-size="large">Follow @iubenda</a>
    <script async type="text/plain" class="_iub_cs_activate" data-suppressedsrc="https://platform.twitter.com/widgets.js" data-iub-purposes="3" charset="utf-8"></script>

    <p>Since on CodePen we can't take advantage of our Cookie Solution plugin for <a href="https://www.iubenda.com/en/help/1215" target="_blank">WordPress</a>, <a href="https://www.iubenda.com/en/help/1323" target="_blank">Joomla!</a>, <a href="https://www.iubenda.com/en/help/4338" target="_blank">PrestaShop</a> or <a href="https://www.iubenda.com/en/help/9591" target="_blank">Magento</a> (which automatically blocks the most popular scripts), we've blocked the script through <a href="https://www.iubenda.com/en/help/1229" target="_blank">manual tagging</a>, one of the <a href="https://www.iubenda.com/en/help/3081" target="_blank">methods available</a> with the Cookie Solution.</p>

    <p>As you can see from the cookie policy, the Twitter follow button is part of the <strong>Experience enhancement</strong> purpose (id <code>3</code>). We've added <code>data-iub-purposes="3"</code> to the Twitter script so that the Cookie Solution can properly identify it.</p>

    <p>Click on the <strong>Accept</strong> button - or grant consent to the "Experience enhancement" category - to release the Twitter script (refresh the page to return to the starting point).</p>

    <div class="tip">
      <p>💡 Read our <a href="https://www.iubenda.com/en/help/1205#per-category-consent" target="_blank">advanced guide</a> for more information about per-category consent (including manual tagging, Google Tag Manager and WordPress plugin blocking methods).</p>
    </div>

    <hr />

    <h3>Learn more</h3>
        
    <ul class="guides">
      <li><a href="https://www.iubenda.com/en/help/31246" target="_blank">Italy's new cookie guidelines</a> (and how to comply)</li>
      <li>iubenda Cookie Solution:
      <ul>
        <li><a href="https://www.iubenda.com/en/help/1177" target="_blank">Getting Started</a></li>
        <li><a href="https://www.iubenda.com/en/help/3831" target="_blank">How to Customize the Cookie Banner</a></li>
        <li><a href="https://www.iubenda.com/en/help/3081" target="_blank">Prior Blocking of Cookies</a></li>
        <li><a href="https://www.iubenda.com/en/help/45718" target="_blank">Cookie Preference Logs</a></li>
      </ul>
      </li>
    </ul>

  </section>
</body>

</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                //don't copy this JS (just for demo purposes)

//don't save consent, always show the banner
_iub.csConfiguration.skipSaveConsent = true;
              
            
!
999px

Console