Infoplaza Consent

Demo

Consent status
Necessary
Preferences
Statistics
Marketing

Settings Reset

Code example

<html>
    <head>
        <!-- Infoplaza Consent -->
        <script src="https://consent.infoplaza.nl/v1/ip-consent.min.js"></script>

        <!-- Ads -->
        <script async="async" src="https://www.googletagservices.com/tag/js/gpt.js"></script>
        <script>
            var googletag = googletag || {};
            googletag.cmd = googletag.cmd || [];
            googletag.cmd.push(function () {
                googletag.pubads().enableSingleRequest();
                googletag.pubads().setTargeting('site', 'weersvoorspelling.nl');
                googletag.pubads().collapseEmptyDivs();
                googletag.pubads().setCentering(true);
                googletag.pubads().enableLazyLoad({
                    fetchMarginPercent: 100,
                    renderMarginPercent: 50,
                    mobileScaling: 1.0
                });
                googletag.pubads().disableInitialLoad();
                googletag.enableServices();
            });
        </script>
    </head>

    <body>
        ... PAGE HEADER CONTENT ...

        ... PAGE  MAIN  CONTENT ...

        ... PAGE FOOTER CONTENT ...
        <a href="javascript:ipConsent.settings()">Cookie-instellingen</a>
    
        <!-- Infoplaza Consent -->
        <script>
            var consentMarketing = null;
            var consentStatistics = null;

            ipConsent.init({
                language: 'en', // default: nl
                logo:     'https://www.weersvoorspelling.nl/img/logo/logo-weersvoorspelling-db.svg',
                onChange: function (newConsent, isNew) {
                    // Statistics
                    if (consentStatistics == null) {
                        consentStatistics = newConsent.statistics;

                        // Google Analytics
                        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
                        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
                        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
                        ga('create','UA-17791438-1');
                        ga('set', 'anonymizeIp', !consentStatistics);
                        ga('send', 'pageview');

                        // Tag Manager                    
                        (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-5VFSBNB');
                    }
                    ga('set', 'anonymizeIp', !consentStatistics);                    

                    // Marketing
                    if (consentMarketing !== newConsent.marketing) {
                        consentMarketing = newConsent.marketing;
                        
                        // Google Ads
                        googletag.cmd.push(function() {
                            googletag.pubads().setRequestNonPersonalizedAds(consentMarketing ? 0 : 1);
                        });
                        window.__cmp('getConsentData', undefined, function(data) {
                            googletag.cmd.push(function() {
                                googletag.pubads().setTargeting('iab_string', [data.consentData]);
                                googletag.pubads().setTargeting('consent', [consentMarketing ? 1 : 0]);
                                googletag.pubads().setTargeting('rev_consent', [consentMarketing ? 0 : 1]);
                                googletag.pubads().refresh();            
                            });
                        });
                    }
                }
            });
        </script>
    </body>
</html>