Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

Save Automatically?

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>
    <!-- Google Tag Manager -->
    <script>
        (function(w, d, s, l, i) {
            w[l] = w[l] || [];
            w[l].push({
                'gtm.start': new Date().getTime(),
                event: 'gtm.js'
            });
            var f = d.getElementsByTagName(s)[0],
                j = d.createElement(s),
                dl = l != 'dataLayer' ? '&l=' + l : '';
            j.async = true;
            j.src =
                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
            f.parentNode.insertBefore(j, f);
        })(window, document, 'script', 'dataLayer', 'GTM-KJ2TH74');
    </script>
    <!-- End Google Tag Manager -->

    <script type="text/javascript">
        var _iub = _iub || [];
        _iub.csConfiguration = {
            lang: "it",
            siteId: 896537, //usa il tuo siteId
            cookiePolicyId: 8207467, //usa il tuo cookiePolicyId

            enableCcpa: true,
            ccpaApplies: true,

            enableGdpr: true,
            gdprAppliesGlobally: false,
            gdprApplies: true,
            perPurposeConsent: true,

            timeoutLoadConfiguration: 30000,
            consentOnScroll: false, //evita che il consenso venga prestato tramite lo scroll di pagina

            banner: {
                position: 'float-top-center',
                acceptButtonDisplay: true,
                customizeButtonDisplay: true,
                rejectButtonDisplay: true,
            },
            
            callback: {
                onPreferenceExpressedOrNotNeeded: function(preference) {
                    dataLayer.push({
                        iubenda_ccpa_opted_out: _iub.cs.api.isCcpaOptedOut()
                    });

                    if (!preference) {
                        dataLayer.push({
                            event: "iubenda_preference_not_needed"
                        });
                    } else {
                        if (preference.consent === true) {
                            dataLayer.push({
                                event: "iubenda_consent_given"
                            });
                        } else if (preference.consent === false) {
                            dataLayer.push({
                                event: "iubenda_consent_rejected"
                            });
                        } else if (preference.purposes) {
                            for (var purposeId in preference.purposes) {
                                if (preference.purposes[purposeId]) {
                                    dataLayer.push({
                                        event: "iubenda_consent_given_purpose_" + purposeId
                                    });
                                }
                            }
                        }
                    }
                }
            }
        };
    </script>
    <script async src="//cdn.iubenda.com/cs/iubenda_cs.js"></script>
</head>

  <body>
    <header>
        <div class="wrapper">
            <h1>iubenda Cookie Solution</h1>
            <p>Configurazione di Google Tag Manager per il CCPA, il GDPR e il consenso per categoria</p>
        </div>
    </header>

    <section class="wrapper">

        <p>💡 Fai click su "Accetta", "Rifiuta", "Scopri di più e personalizza" e "Non vendere le mie informazioni personali" per personalizzare le impostazioni di consenso all'utilizzo dei cookie.</p>
      
        <div class="scripts">
          <div class="script" id="no-purpose"> Nessuna categoria</div>
          <div class="script" id="no-purpose-sells"> Nessuna categoria - Vendita secondo il CCPA (da bloccare a seguito della richiesta di opt-out)</div>
          <div class="script" id="purpose-1"> Strettamente necessari (non è richiesto il consenso)</div>
          <div class="script" id="purpose-2"> Interazioni e funzionalità semplici</div>
          <div class="script" id="purpose-3"> Esperienza migliorata</div>
          <div class="script" id="purpose-4"> Statistica</div>
          <div class="script" id="purpose-4-sells"> Statistica - Vendita secondo il CCPA (da bloccare a seguito della richiesta di opt-out)</div>
          <div class="script" id="purpose-5"> Targeting e pubblicità</div>
        </div>

        <div class="note">
            <ul>
                <li>Ricordati di usare i dati che trovi nella <a href="https://www.iubenda.com/it/dashboard" target="_blank">tua dashboard</a></li>
                <li>Si tratta di un esempio a puro scopo illustrativo, <strong>nessun consenso viene salvato</strong> (risultato di <code>_iub.csConfiguration.skipSaveConsent = true</code>). Ricarica la pagina per far riapparire il cookie banner.</li>
            </ul>
        </div>

        <h3>Per saperne di più</h3>
        <div class="tip">
          <p>Leggi la guida <a href="https://www.iubenda.com/it/help/629" target="_blank">Come usare Google Tag Manager per bloccare i cookie</a> per maggiori informazioni e dettagli su funzionalità e settaggi.</p>
        </div>

        <p>Altre guide utili:</p>
        <ul class="guides">
          <li><a href="https://www.iubenda.com/it/help/680" target="_blank">Introduzione alla iubenda Cookie Solution</a></li>
          <li><a href="https://www.iubenda.com/it/help/1696" target="_blank">Come personalizzare il cookie banner (guida di base)</a></li>
          <li><a href="https://www.iubenda.com/it/help/623" target="_blank">Come configurare la Cookie Solution (guida avanzata)</a></li>
          <li><a href="https://www.iubenda.com/it/help/21170" target="_blank">CCPA: come mostrare l’avviso di raccolta dati e il link "Non vendere le mie informazioni personali"</a></li>
        </ul>

    </section>
</body>
</html>
              
            
!

CSS

              
                /* non copiare questo CSS (solo per scopi dimostrativi) */

div.scripts .script {
  border-bottom: 1px solid #D5D5D5;
  margin-bottom: -1px;
  padding: 14px 6px;
}

div.scripts .script:last-of-type {
  border-bottom: none;
}

div.scripts .script:before {
  content: '🚫';
}

div.scripts .script.activated:before, 
div#purpose-1:before {
  content: '✅';
}
              
            
!

JS

              
                //non copiare questo JS (solo per scopi dimostrativi)

_iub.csConfiguration.skipSaveConsent = true; //non salvare il consenso, mostra sempre il banner

//evita di settare il cookie per il CCPA
_iub.csConfiguration.callback.onCcpaOptOut = _iub.csConfiguration.callback.onCcpaAcknowledged = function() {
    setTimeout(function() {
        _iub.cs.cookie.resetLocalCookie('usprivacy');
    });
};
              
            
!
999px

Console