Overview
To use AdConsent in a publisher's page along with Boilerplate Gen.2 (snhb), the following steps need to be implemented in the page <head>
section:
Include the AdConsent script in the document
<head>
section before any ad technology script. The script must be loaded synchronously to avoid race conditions while loading the page with scripts using the privacy API from AdConsent.Set AdConsent visual adjustments to fit the page look and feel, as well as the configurations needed to make AdConsent compatible with the publisher's privacy requirements. For more information regarding available AdConsent functions, check the AdConsent API reference.
Load AdEngine v2 (Boilerplate).
If you have previously added AdEngine v2
disableConsent
flag (snhb.options.consent.disableConsent = true
), remove it from snhb options in order to properly fire up AdConsent.If you have a complex domain on your site (e.g.,
co.uk
,com.br
,com.au
, etc.), you need to set AdEngine v2 'cookieDomain
option (snhb.options.cookieDomain = "example.co.uk"
) with your TLD.(optional) Load 3rd party ad technology scripts like AdSense.
⚠️ Make sure that AdConsent is loaded synchronously before any other ad technology scripts to make it function properly. If you load for example GPT before AdConsent, Google will detect this as an invalid configuration and not deliver ads! In the Google report, it will be marked as error 2.1a.
Examples
Starting AdConsent in default mode
Example using AdConsent with all default options. Consider using the AdConsent typical setup example.
<!-- AdConsent loading tag --> <script src="//cdn.snigelweb.com/adconsent/adconsent.js" type="text/javascript"></script> <!-- AdEngine v2 loading tag --> <script async src="AdEngine v2 script URL given to you from Snigel AdOps team" type="text/javascript"></script>
Typical AdConsent setup
This is the typical AdConsent setup used. Use this example, customize styles to your need and change the AdConsent option example values:
setPublisherCC. Two uppercase letter country code of the country that determines the legislation of reference. Normally corresponds to the country code of the country in which the publisher's business entity is established.
setPrivacyPolicy. The link to your privacy policy page
setLogo. The link to your logo that is displayed in the AdConsent GDPR GUI.
<!-- AdConsent loading tag --> <script src="//cdn.snigelweb.com/adconsent/adconsent.js" type="text/javascript"></script> <!-- AdConsent style tag --> <style> #snigel-cmp-framework .sn-b-def.sn-blue {color: #ffffff!important;background-color: #af0e0e!important;border-color: #af0e0e!important;} #snigel-cmp-framework .sn-b-def { border-color: #af0e0e!important;color: #af0e0e!important;} #snigel-cmp-framework .sn-selector ul li { color: #af0e0e!important} #snigel-cmp-framework .sn-selector ul li:after { background-color: #af0e0e!important; } #snigel-cmp-framework .sn-footer-tab .sn-privacy a {color:#af0e0e!important;} #snigel-cmp-framework .sn-arrow:after, #snigel-cmp-framework .sn-arrow:before { background-color: #af0e0e!important; } #snigel-cmp-framework .sn-switch input:checked+span::before { background-color: #af0e0e!important; } #adconsent-usp-link {border: 1px solid #af0e0e!important;color: #af0e0e!important;} #adconsent-usp-banner-optout input:checked+.adconsent-usp-slider {background-color:#af0e0e!important;} #adconsent-usp-banner-btn {color:#ffffff;border: solid 1px #af0e0e!important;background-color: #af0e0e!important;} </style> <!-- AdConsent configuration tag --> <script> adconsent('setPublisherCC', 'DE'); adconsent('setPrivacyPolicy', '//www.mysite.com/privacy'); adconsent.gdpr('setLogo', '//www.mysite.com/logo.jpg'); adconsent.gdpr('enableWelcomeTitle'); adconsent.gdpr('enableWelcomeText'); adconsent.gdpr('reconsiderConsent', 48); </script> <!-- AdEngine v2 loading tag --> <script async src="AdEngine v2 script URL given to you from Snigel AdOps team" type="text/javascript"></script>
Starting AdConsent with Google Analytics enabled and a logo for the TCF 2.0 CMP
<!-- AdConsent loading tag --> <script src="//cdn.snigelweb.com/adconsent/adconsent.js" type="text/javascript"></script> <!-- AdConsent configuration tag --> <script> adconsent('setPublisherCC', 'US'); adconsent('enableGoogleAnalytics', true); adconsent.gdpr('setLogo', '//www.mysite.com/logo.jpg'); </script> <!-- AdEngine v2 loading tag --> <script async src="AdEngine v2 script URL given to you from Snigel AdOps team" type="text/javascript"></script>
Starting AdConsent with visual styles, a specific privacy policy link for each privacy law, and with consent reconsideration after 48h
<!-- AdConsent loading tag --> <script src="//cdn.snigelweb.com/adconsent/adconsent.js" type="text/javascript"></script> <!-- AdConsent style tag --> <style> #snigel-cmp-framework .sn-b-def.sn-blue {color: #ffffff!important;background-color: #af0e0e!important;border-color: #af0e0e!important;} #snigel-cmp-framework .sn-b-def { border-color: #af0e0e!important;color: #af0e0e!important;} #snigel-cmp-framework .sn-selector ul li { color: #af0e0e!important} #snigel-cmp-framework .sn-selector ul li:after { background-color: #af0e0e!important; } #snigel-cmp-framework .sn-footer-tab .sn-privacy a {color:#af0e0e!important;} #snigel-cmp-framework .sn-arrow:after, #snigel-cmp-framework .sn-arrow:before { background-color: #af0e0e!important; } #snigel-cmp-framework .sn-switch input:checked+span::before { background-color: #af0e0e!important; } #adconsent-usp-link {border: 1px solid #af0e0e!important;color: #af0e0e!important;} #adconsent-usp-banner-optout input:checked+.adconsent-usp-slider {background-color:#af0e0e!important;} #adconsent-usp-banner-btn {color:#ffffff;border: solid 1px #af0e0e!important;background-color: #af0e0e!important;} </style> <!-- AdConsent configuration tag --> <script> adconsent('setPublisherCC', 'AT'); adconsent.gdpr('setPrivacyPolicy', '//www.mysite.com/privacyGDPR'); adconsent.ccpa('setPrivacyPolicy', '//www.mysite.com/privacyCCPA'); adconsent.gdpr('reconsiderConsent', 48); </script> <!-- AdEngine v2 loading tag --> <script async src="AdEngine v2 script URL given to you from Snigel AdOps team" type="text/javascript"></script>
Starting AdConsent for the complex domain "mysite.co.uk" with Google Analytics enabled and a logo for the TCF 2.0 CMP
<!-- AdConsent loading tag --> <script src="//cdn.snigelweb.com/adconsent/adconsent.js" type="text/javascript"></script> <!-- AdConsent configuration tag --> <script> adconsent('setPublisherCC', 'US'); adconsent('enableGoogleAnalytics', true); adconsent.gdpr('setLogo', '//www.mysite.com/logo.jpg'); </script> <!-- AdEngine v2 configuration tag --> <script> var snhb = snhb || {}; snhb.queue = snhb.queue || []; snhb.options = { cookieDomain: "mysite.co.uk" }; </script> <!-- AdEngine v2 loading tag --> <script async src="AdEngine v2 script URL given to you from Snigel AdOps team" type="text/javascript"></script>