Documentation index

Cookie solution ›

iubenda Cookie Solution: preventing code execution that could install cookies


The iubenda Cookie Solution allows for the management of all aspects of cookie law compliance: a cookie banner for notifying your users, a cookie policy for extended information, and the saving of preferences and blocking of scripts prior to the granting of consent by the user.

How to install the iubenda Cookie Solution

For an installation guide, please see our dedicated guide or our introduction to the Cookie Solution. For WordPress, please read our dedicated post for WordPress that teaches you how to use the iubenda Cookie Solution plugin for WordPress to automate the blocking of scripts.

Note:

  • The iubenda Cookie Solution currently requires at least jQuery 1.4.4 (if the site has an older version, you have to update that version of jQuery. If there is no jQuery at all, iubenda will take care of that for you)

Which cookie-installing scripts should be blocked?

This depends on the legal jurisdiction applicable to your site. Italy, France, Spain and the Netherlands are very familiar with the legal requirement to block cookie scripts until user consent is obtained. All cookies must be blocked except for those that are exempt.

In the case of Italy, the category of exempt cookies are:

  • Technical cookies, preference, session and optimization cookies
  • Cookies for aggregated statistics run by first party solutions (eg. Piwik or other self hosted/self run solutions)
  • Cookies for aggregated statistics by third parties (eg. Google Analytics), but only if the third party is prevented from analysing the data in a disaggregated fashion.

Regarding Google Analytics

In Italy, the condition for Google Analytics to be eligible for “no prior consent necessary” is IP anonymization – however in France, Google Analytics doesn’t seem to be eligible for exceptions, and while they recommend using Piwik – it is the anonymization of the user’s IP that allows for analysis to be carried out in a disaggregated fashion.

To proceed:

  • Google Analytics: follow the guide for the anonymization of Google Analytics IP (just add an additional line to its configuration definition);
  • According to the information we have, Webtrekk and many other analytics tools are already up to standards and do not require further configuration.

Regarding other tools that guarantee the non-usage of cookies

If other third-party tools guarantee not to use cookies, perhaps by providing specific configuration options, they too can be considered to be exempt from prior blocking.

This is the case namely with Youtube, which provides a specific feature to prevent the user from being tracked through cookies.

Using Google Tag Manager to dramatically simplify the application of cookie regulations

Google Tag Manager is a free tool that helps to simplify the application of cookie regulations. It’s compatible wth the iubenda Cookie Solution. You can consult our Google Tag Manager guide here.

Google Tag Manager allows you to avoid tagging scripts as described below, although this is limited to a certain category of scripts (script that define a positions on a page – such as embeds). Although this method is not a panacea, we strongly recommend you use it.

How to implement script blocking for those scripts that may install cookies

Modifications to script

For all other scripts that install or may install cookies, you need to proceed with changes to the code to implement the blocking capability.

To enable blocking of scripts that may install cookies, you must change these scripts so that the iubenda Cookie Solution can prevent their execution where consent has not yet been given.

To do this, you’ll apply the class _iub_cs_activate to the SCRIPT tags. Finally we change the type attribute from ”text/javascript” to “text/plain”.

<script class="_iub_cs_activate" type="text/plain" src="code-source.js">
….
</script>

The src can remain unchanged, but it is advisable to replace it with data-suppressedsrc (only available in safemode) or with suppressedsrc.
Replacing src is in some cases necessary, as the browser, even though the script is blocked, may download and/or interpret the resource and consequently install cookies.

// use of data-suppressedsrc
<script data-suppressedsrc="LINK-TO-SOURCE.js" class="_iub-cs-activate" type="text/plain">

</script>


// OR suppressedsrc
<script suppressedsrc="LINK-TO-SOURCE.js" class="_iub-cs-activate"  type="text/plain">

</script>

Note: for script re-activation, the iubenda Cookie Solution handles src re-activation by controlling the previously described attributes in the following order: data-suppressedsrc (only available in safemode), suppressedsrc and src (if it is left unchanged).

To activate the Javascript inline tag, you must instead apply the class _iub_cs_activate-inline.

<script class="_iub_cs_activate-inline" type="text/plain">
….
</script>

Note: the class _iub_cs_activate-inline needs to be applied to all document.write or document.writeln objects.

Callback

Alternatively, in the case where cookies are activated by portions of Javascript code, it’s possible to proceed via callback to the instance csConfiguration.

// onConsentGiven is still active but deprecated: if both are declarated only onConsentRead will be executed.
_iub.csConfiguration = {
  callback: {
    onConsentRead: function(){ yourFunctionForRegisterCookie() ;}
  }
}

Note: onConsentGiven, specified above, is still available for compatibility reasons with earlier versions; its value will in any case be overridden by onConsentRead if the latter is used.

Modifications of scripts, iframe and img for dependency management

In some cases, in order to properly re-activate a blocked tag it is necessary to wait for the availability of a variable or a javascript object. To properly manage dependencies you’ll find the data-iub-cs-wait-for attribute (only available on the safemode).

<script suppressedsrc="//download.helloworldvariable.js" class="_iub_cs_activate">
</script>

<script data-iub-cs-wait-for="helloWord" class="_iub_cs_activate-inline">
  console.log('print hello world' + helloWorld);
</script>

img and iframe Tags

Various img and iframe tags could install cookies as well. In these cases it’s necessary to add the class _iub_cs_activate (just like for the script tags described above), assign the original value of the src tag to a new attribute called data-suppressedsrc (available only in safemode) or suppressedsrc and assign the value "//cdn.iubenda.com/cookie_solution/empty.html" to src (see the example below to visualize these rules).

<iframe id="player" class="_iub_cs_activate" width="640" height="390" frameborder="0" suppressedsrc="https://www.youtube.com/embed/erVv_Gm7CC4" src="//cdn.iubenda.com/cookie_solution/empty.html"></iframe>

Note: the value data:text/html;base64,PGh0bWw+PGJvZHk+U3VwcHJlc3NlZDwvYm9keT48L2h0bWw+ previously indicated in this guide (it’s the codified base64 version of: Suppressed, which will then be shown by most browsers before the consent instead of the actual output of the script) does not affect the correct blocking and the subsequent activation of the tag, but its use may result in errors in displaying some Android web views. At this address you’ll find a code/encode tool in order to generate any other base64 version of any other string.

noscript Tags

At present the noscript tag that may install cookies in cases in which the user has disabled Javascript in his browser, is in an implementation phase. In order to be prepared for these cases as well we suggest to eliminate noscript tags from the document or to use backend solutions instead, that could after discovering the presence of the cookie _iub_cs-local, selectively include or exclude the noscript tags from the documents.

Practical examples

Below are examples of commonly used scripts and guidance on how to modify them as to comply with cookie law.

Facebook LIKE

BEFORE

<div id="fb-root"></div>
<script>
    (function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.3";
  fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>

AFTER

<div id="fb-root"></div>
<script type="text/plain" class="_iub_cs_activate">
  (function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.3";
  fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>

Google AdSense

BEFORE

<script type="text/javascript">
        google_ad_client = "ca-pub-00000000";
        google_ad_slot = "XXXXXXXXXX";
        google_ad_width = 728;
        google_ad_height = 90;
</script>
<script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>

AFTER

Define the callback on consentGiven on the instance _iub.csConfiguration:

 <head>
 ...
  <script>
     _iub.csConfiguration = {
                           ...
         callback:{
                  onConsentGiven: function(){
                    var t = 1;
                    jQuery('._iub_cs_activate_google_ads').each(function() {
                        var banner = jQuery(this);
                        setTimeout(function(){
                            var client = banner.data('client');
                            var slot = banner.data('slot');
                            var width = banner.data('width');
                            var height = banner.data('height');
                            var adsense_script = '<scr'+'ipt type="text/javascript">\n'
                                    + 'google_ad_client = "'+client+'";'
                                    + 'google_ad_slot = "'+slot+'";'
                                    + 'google_ad_width = '+width+';'
                                    + 'google_ad_height = '+height+';'
                                    + '</scr'+'ipt>';
                            var script = document.createElement('script');
                            var ads = document.createElement('ads');
                            var w = document.write;
                            script.setAttribute('type', 'text/javascript');
                            script.setAttribute('src', 'http://pagead2.googlesyndication.com/pagead/show_ads.js');
                            document.write = (function(params) {
                                ads.innerHTML = params;
                                document.write = w;
                            });
                            banner.html(adsense_script).append(ads).append(script);
                        }, t);
                        t += 300;
                    });
                }
            }
            ..
        };
  </script>
..
</head>

<body>
         ...
<div style="width: 728px;height:90px;" class="_iub_cs_activate_google_ads"
         data-client="ca-pub-00000000"
         data-slot="XXXXXXXXXX"
         data-width="728"
         data-height="90">
</div>
...

</body>

For each banner that appears inside the page, create a div and define the data based on the GoogleAd parameters:

<div style="width: 728px;height:90px;" class="_iub_cs_activate_google_ads"
         data-client="ca-pub-00000000"
         data-slot="XXXXXXXXXX"
         data-width="728"
         data-height="90">
</div>

Google AdSense async

BEFORE

<script  type="text/javacript" async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- test -->
<ins class="adsbygoogle"
     style="display:inline-block;width:728px;height:90px"
     data-ad-client="ca-pub-1535991029626362"
     data-ad-slot="1465347939"></ins>
<script  type="text/javascript">
    (adsbygoogle = window.adsbygoogle || []).push({});
</script>

AFTER

<script async type="text/plain" class="_iub_cs_activate" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- orizzontale -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-XXX"
     data-ad-slot="XXXX"
     data-ad-format="auto"></ins>
<script type="text/plain" class="_iub_cs_activate" >
    (adsbygoogle = window.adsbygoogle || []).push({});
</script>

Google Adwords – Conversion

BEFORE

<script type="text/javascript">
    /* <![CDATA[ */
    var google_conversion_id =CONVERSION_ID;
    var google_conversion_label = "CONVERSION-LABEL";
    var google_custom_params = window.google_tag_params;
    var google_remarketing_only = true;
    /* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
    <div style="display:inline;">
        <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/1030205862/?value=0&amp;guid=ON&amp;script=0"/>
    </div>
</noscript>

AFTER

<script type="text/javascript">
        /* <![CDATA[ */
        var google_conversion_id =CONVERSION_ID;
        var google_conversion_label = "CONVERSION-LABEL";
        var google_custom_params = window.google_tag_params;
        var google_remarketing_only = true;
        /* ]]> */
</script>
<script class="_iub_cs_activate-inline" type="text/plain"     src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
    <div style="display:inline;">
        <img height="1" width="1" style="border-style:none;" alt="" class="_iub_cs_activate" src="data:text/html;base64,PGh0bWw+PGJvZHk+U3VwcHJlc3NlZDwvYm9keT48L2h0bWw+" suppressedsrc="//googleads.g.doubleclick.net/pagead/viewthroughconversion/1036022355/?value=0&amp;label=-KpbCO3v1QQQ0-SB7gM&amp;guid=ON&amp;script=0"/>
    </div>
</noscript>

Google PLUS

Button ACCESS

BEFORE

<span id="signinButton">
  ...
</span>
<script type="text/javascript">
(function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/client:plusone.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
    })();
    function signinCallback(authResult) {
      if (authResult['access_token']) {
      } else if (authResult['error']) {
      }
    }
    function disconnectUser(access_token) {
      var revokeUrl = 'https://accounts.google.com/o/oauth2/revoke?token=' + access_token;
      $.ajax({
        type: 'GET',
        url: revokeUrl,
        async: false,
        contentType: "application/json",
        dataType: 'jsonp',
        success: function(nullResponse) {
        },
        error: function(e) {        }
      });
    }
    $('#revokeButton').click(disconnectUser);
  </script>

AFTER

<span id="signinButton">
  ...
</span>
<script type="text/plain" class="_iub_cs_activate">
(function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/client:plusone.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
    })();
    function signinCallback(authResult) {
      if (authResult['access_token']) {
      } else if (authResult['error']) {
      }
    }
    function disconnectUser(access_token) {
      var revokeUrl = 'https://accounts.google.com/o/oauth2/revoke?token=' + access_token;
      $.ajax({
        type: 'GET',
        url: revokeUrl,
        async: false,
        contentType: "application/json",
        dataType: 'jsonp',
        success: function(nullResponse) {
        },
        error: function(e) {        }
      });
    }
    $('#revokeButton').click(disconnectUser);
</script>

Button +1

BEFORE (Asincrono)

<script type="text/javascript">
(function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
</script>
<g:plusone></g:plusone>

AFTER (Asincrono)

<script type="text/plain" class="_iub_cs_activate">
(function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
</script>
<g:plusone></g:plusone>

Google ANALYTICS

The following is only implemented when using the features of Google Analytics that allow for the tracking of a unique user. In all other cases it is suggested to anonymize the IP as explained in the initial part of this guide.

BEFORE (Asincrono)

<script>
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-00000000-1']);
    _gaq.push(['_trackPageview']);
    (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
</script>

AFTER (Asincrono)

<script type="text/plain" class="_iub_cs_activate">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-00000000-1']);
    _gaq.push(['_trackPageview']);
    (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == iosdocument.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
</script>

ADD THIS

BEFORE (Sincrono)

<script src="http://s7.addthis.com/js/250/addthis_widget.js"></script>

AFTER (Sincrono)

<script type="text/plain"  class="_iub_cs_activate" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>

BEFORE (Asincrono)

<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-555a0dcc7bd36db3" async="async"></script>

AFTER (Asincrono)

<script type="text/plain" class="_iub_cs_activate" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-555a0dcc7bd36db3" async="async"></script>

ADDTHIS BUTTON

BEFORE

<script type="text/javascript">
var addthis_config = {
     pubid: "YOUR-PROFILE-ID"
}
</script>
<a href="http://www.addthis.com/bookmark.php?v=250" class="addthis_button">
<img   src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" border="0" alt="Share" />
</a>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js">
</script>

AFTER

<script type="text/plain">
    var addthis_config = {
        pubid: "YOUR-PROFILE-ID"
    }
</script>
<a href="http://www.addthis.com/bookmark.php?v=250" class="addthis_button">
<img
src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif"
width="125" height="16" border="0" alt="Share" />
</a>
<script type="text/plain" class="_iub_cs_activate" src="http://s7.addthis.com/js/250/addthis_widget.js">

DISQUS

BEFORE

<div id="disqus_thread"></div>
<script>
    var disqus_shortname = 'example'; // required: replace example with your forum shortname
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>

AFTER

<script type="text/plain" class="_iub_cs_activate">
    var disqus_shortname = 'example'; // required: replace example with your forum shortname
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>

TWITTERFOLLOW BUTTON

BEFORE

<a class="twitter-follow-button "
   href="https://twitter.com/twitter"
   data-show-count="false"
   data-size="large">
  Follow @twitter
</a>
<script>
window.twttr=(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return;js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);t._e=[  ];t.ready=function(f){t._e.push(f);};return     t;}(document,"script","twitter-wjs"));
</script>

AFTER

<a class="twitter-follow-button "
   href="https://twitter.com/twitter"
   data-show-count="false"
   data-size="large">
  Follow @twitter
</a>
<script type="text/plain" class="_iub_cs_activate">
window.twttr=(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return;js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);t._e=[];t.ready=function(f){t._e.push(f);};return t;}(document,"script","twitter-wjs"));
</script>

TWEET BUTTON

BEFORE

<a class="twitter-share-button"
   href="https://twitter.com/share">
  Tweet
</a>
<script>
    window.twttr=(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);t._e=[];t.ready=function(f){t._e.push(f);};return t;}(document,"script","twitter-wjs"));
</script>

AFTER

<a class="twitter-share-button"
   href="https://twitter.com/share">
  Tweet
</a>
<script type="text/plain" class="_iub_cs_activate">
    window.twttr=(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);t._e=[];t.ready=function(f){t._e.push(f);};return t;}(document,"script","twitter-wjs"));
</script>

TWITTER TIMELINE

BEFORE

<a class="twitter-timeline" href="https://twitter.com/USERNAME" data-widget-id="000000000000000000">
Tweet di @USERNAME
</a>
<script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

AFTER

<a class="twitter-timeline" href="https://twitter.com/USERNAME" data-widget-id="000000000000000000">
Tweet di @USERNAME
</a>
<script type="text/plain" class="_iub_cs_activate">
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
</script>

TWITTER MENTION

BEFORE

<a href="https://twitter.com/intent/tweet?screen_name=USERNAME" class="twitter-mention-button" data-related="USERNAME">Tweet to @USERNAME</a>
<script>
function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>

AFTER

<a class="twitter-timeline" href="https://twitter.com/USERNAME" data-widget-id="000000000000000000">
Tweet di @USERNAME
</a>
<script type="text/plain" class="_iub_cs_activate">
function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
</script>

YOUTUBE

The following applies only in cases where you do not use the option that lets you include Youtube videos without installing cookies to visitors of the site.

PLAYER

BEFORE

<div id="player"></div>
<script type="text/javascript">
    var tag = document.createElement('script');
    tag.src = "https://www.youtube.com/iframe_api";
    var firstScriptTag = document.getElementsByTagName('script')[0];
    firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
    var player;
    function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
            height: 'XXX',
            width: 'XXX',
            videoId: '00000000-00',
            events: {
                'onReady': onPlayerReady,
                'onStateChange': onPlayerStateChange
            }
        });
    }
    function onPlayerReady(event) {
        event.target.playVideo();
    }
    var done = false;
    function onPlayerStateChange(event) {
        if (event.data == YT.PlayerState.PLAYING && !done)            {
            setTimeout(stopVideo, 6000);
            done = true;
        }
    }
    function stopVideo() {
        player.stopVideo();
    }
</script>

AFTER

<div id="player"></div>
<script type="text/plain" class="_iub_cs_activate">
    var tag = document.createElement('script');
    tag.src = "https://www.youtube.com/iframe_api";
    var firstScriptTag = document.getElementsByTagName('script')[0];
    firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
    var player;
    function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
            height: 'XXX',
            width: 'XXX',
            videoId: '00000000-00',
            events: {
                'onReady': onPlayerReady,
                'onStateChange': onPlayerStateChange
            }
        });
    }
    function onPlayerReady(event) {
        event.target.playVideo();
    }
    var done = false;
    function onPlayerStateChange(event) {
        if (event.data == YT.PlayerState.PLAYING && !done)            {
            setTimeout(stopVideo, 6000);
            done = true;
        }
    }
    function stopVideo() {
        player.stopVideo();
    }
</script>

PLAYER IFRAME

BEFORE

<iframe id="player" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/M7lc1UVf-VE?enablejsapi=1&origin=http://example.com" frameborder="0">
</iframe>

AFTER

<div id="myIframe"></div>
<script type="text/html" class="_iub_cs_activate">
     document.getElementById('myIframe').innerHTML = '<iframe id="player" type="text/plain" width="640" height="390" src="http://www.youtube.com/embed/M7lc1UVf-VE?enablejsapi=1&origin=http://example.com" frameborder="0"></iframe>';    
</script>

SHARETHIS

BEFORE

<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
 <script>
    stLight.options({
        publisher:'insert-your-key-here'
    });

    stWidget.addEntry({
        "service":"sharethis",
        "element":document.getElementById('button_1'),
        "url":"http://sharethis.com",
        "title":"sharethis",
        "type":"large",
        "text":"ShareThis" ,
        "image":"http://www.softicons.com/download/internet-icons/social-superheros-icons-by-iconshock/png/256/sharethis_hulk.png",
    "summary":"this is description1"
    });

    stWidget.addEntry({
        "service":"sharethis",
        "element":document.getElementById('button_2'),
        "url":"http://sharethis.com/2",
        "title":"sharethis",
        "type":"large",
        "text":"ShareThis" ,
        "image":"http://farm4.static.flickr.com/3571/3427619794_13dae8e979_o.png",
        "summary":"this is description2"
    });

    function addMore(){
        stWidget.addEntry({
            "service":"sharethis",
            "element":document.getElementById('button_3'),
            "url":"http://sharethis.com/3",
            "title":"sharethis",
            "type":"large",
            "text":"ShareThis" ,
            "image":"http://icons.iconarchive.com/icons/iconshock/high-detail-social/256/sharethis-icon.png",
            "summary":"this is description3"
        });
    }
</script>

AFTER

<script type="text/plain" class="_iub_cs_activate" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/plain" >

    stLight.options({
        publisher:'insert-your-key-here'
    });

    stWidget.addEntry({
        "service":"sharethis",
        "element":document.getElementById('button_1'),
        "url":"http://sharethis.com",
        "title":"sharethis",
        "type":"large",
        "text":"ShareThis" ,
        "image":"http://www.softicons.com/download/internet-icons/social-superheros-icons-by-iconshock/png/256/sharethis_hulk.png",
    "summary":"this is description1"
    });

    stWidget.addEntry({
        "service":"sharethis",
        "element":document.getElementById('button_2'),
        "url":"http://sharethis.com/2",
        "title":"sharethis",
        "type":"large",
        "text":"ShareThis" ,
        "image":"http://farm4.static.flickr.com/3571/3427619794_13dae8e979_o.png",
        "summary":"this is description2"
    });

    function addMore(){
        stWidget.addEntry({
            "service":"sharethis",
            "element":document.getElementById('button_3'),
            "url":"http://sharethis.com/3",
            "title":"sharethis",
            "type":"large",
            "text":"ShareThis" ,
            "image":"http://icons.iconarchive.com/icons/iconshock/high-detail-social/256/sharethis-icon.png",
            "summary":"this is description3"
        });
    }
</script>

Mixpanel

BEFORE

<script type="text/javascript">
(function(f,b){if(!b.__SV){
var a,e,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=f.createElement("script");a.type="text/javascript";a.async=!0;a.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";e=f.getElementsByTagName("script")[0];e.parentNode.insertBefore(a,e)}})(document,window.mixpanel||[]);
mixpanel.init("YOUR TOKEN");
</script>

AFTER

<script  type="text/plain"  class="_iub_cs_activate">
(function(f,b){if(!b.__SV){
var a,e,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=f.createElement("script");a.type="text/javascript";a.async=!0;a.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";e=f.getElementsByTagName("script")[0];e.parentNode.insertBefore(a,e)}})(document,window.mixpanel||[]);
mixpanel.init("YOUR TOKEN");
</script>

Vimeo

BEFORE

<iframe src="//player.vimeo.com/video/VIDEOID" width="width" height="height" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

AFTER

<iframe class="_iub_cs_activate" src="data:text/html;base64,PGh0bWw+PGJvZHk+U3VwcHJlc3NlZDwvYm9keT48L2h0bWw+" suppressedsrc="//player.vimeo.com/video/video-id" width="width" height="height" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

YOUTUBE IFrame (new version)

BEFORE

<iframe id="player" type="text/html" src="http://www.youtube.com/embed/VIDEO-ID?enablejsapi=1&origin=http://example.com" frameborder="0" width="width" height="height" ></iframe>

AFTER

<iframe id="player" type="text/plain" class="_iub_cs_activate" src="data:text/html;base64,PGh0bWw+PGJvZHk+U3VwcHJlc3NlZDwvYm9keT48L2h0bWw+" suppressedsrc="http://www.youtube.com/embed/VIDEO-ID?enablejsapi=1&origin=http://example.com" frameborder="0" width="width" height="height"></iframe>

GOOGLE TRACK with img tag

BEFORE

<img src='http://pubads.g.doubleclick.net/gampad/ad?iu=/ui_id/ad_unit&sz=1x1&t=&c=c_id'/>

AFTER

<img class="_iub_cs_activate" src="data:text/html;base64,PGh0bWw+PGJvZHk+U3VwcHJlc3NlZDwvYm9keT48L2h0bWw+" suppressedsrc='http://pubads.g.doubleclick.net/gampad/ad?iu=/ui_id/ad_unit&sz=1x1&t=&c=c_id'/>

Google Tag Publisher

BEFORE

<head>
  …
  <script type="text/javascript">
      var googletag = googletag || {};
      googletag.cmd = googletag.cmd || [];
      (function () {
          var gads = document.createElement("script");
          gads.async = true;
          gads.type = "text/javascript";
          var useSSL = "https:" == document.location.protocol;
          gads.src = (useSSL ? "https:" : "http:") + "//www.googletagservices.com/tag/js/gpt.js";
          var node = document.getElementsByTagName("script")[0];
          node.parentNode.insertBefore(gads, node);
      })();
  </script>
  <script type="text/javascript">
      googletag.cmd.push(function () {
          googletag.pubads().set("adsense_background_color", "FFFFFF");
      });
  </script>
  <script>
      googletag.cmd.push(function () {
          googletag.defineSlot("/1234/travel/asia/food", [728, 90], "div-gpt-ad-123456789-0")
                  .addService(googletag.pubads())
                  .setTargeting("interests", ["sports", "music", "movies"]);
          googletag.defineSlot("/1234/travel/asia/food", [
                      [468, 60],
                      [728, 90],
                      [300, 250]
                  ], "div-gpt-ad-123456789-1")
                  .addService(googletag.pubads())
                  .setTargeting("gender", "male")
                  .setTargeting("age", "20-30");
          googletag.pubads().setTargeting("topic", "basketball");
          googletag.pubads().enableSingleRequest();
          googletag.enableServices();
      });
  </script>
  ...
</head>
<body>
..

<div id="div-gpt-ad-123456789-0" style="width: width; height: height;">
  <script type="text/javascript">
      googletag.cmd.push(function () {
          googletag.display("div-gpt-ad-123456789-0");
      });
  </script>
</div>
<div id="div-gpt-ad-123456789-1" STYLE="height:height;width:width;">
  <script type="text/javascript">
      googletag.cmd.push(function () {
          googletag.display("div-gpt-ad-123456789-1");
      });
  </script>
</div>

..
</body>

AFTER

<head>
  ..
  <script type="text/plain" class="_iub_cs_activate">
        var googletag = googletag || {};
        googletag.cmd = googletag.cmd || [];
        (function() {
            var gads = document.createElement("script");
            gads.async = true;
            gads.type = "text/javascript";
            var useSSL = "https:" == document.location.protocol;
            gads.src = (useSSL ? "https:" : "http:") + "//www.googletagservices.com/tag/js/gpt.js";
            var node =document.getElementsByTagName("script")[0];
            node.parentNode.insertBefore(gads, node);
        })();

  </script>
  <script type="text/plain" class="_iub_cs_activate">
        googletag.cmd.push(function() {
            googletag.pubads().set("adsense_background_color", "FFFFFF");
        });

  </script>
  <script type="text/plain" class="_iub_cs_activate">
        googletag.cmd.push(function() {
              googletag.defineSlot("/6355419/Travel/Europe/France/Paris", [728, 90], "div-gpt-ad-123456789-0")
                .addService(googletag.pubads())
                .setTargeting("interests", ["sports", "music", "movies"]);
              googletag.defineSlot("/1234/travel/asia/food", [[468, 60], [728, 90], [300, 250]], "div-gpt-ad-123456789-1")
                .addService(googletag.pubads())
                .setTargeting("gender", "male")
                .setTargeting("age", "20-30");
              googletag.pubads().setTargeting("topic","basketball");
              googletag.pubads().enableSingleRequest();
              googletag.enableServices();
            });

  </script>
  ..
</head>
<body>
..
<div id="div-gpt-ad-123456789-0" style="width: width; height: height;">
  <script type="text/plain" class="_iub_cs_activate">
          googletag.cmd.push(function () {
              googletag.display("div-gpt-ad-123456789-0");
          });

  </script>
</div>
<div id="div-gpt-ad-123456789-1" STYLE="height: height;width: width;">
  <script type="text/plain" class="_iub_cs_activate">
          googletag.cmd.push(function () {
              googletag.display("div-gpt-ad-123456789-1");
          });

  </script>
</div>
..
</body>

Sharethis – Smart Hovering Bar

BEFORE (asincrono)

<script type="text/javascript">
  var switchTo5x=true;
    (function() {
    var stscr = document.createElement('script'); stscr.type = 'text/javascript'; stscr.async = true;
      stscr.src ="http://w.sharethis.com/button/buttons.js";
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(stscr, s);
    stscr.onload=stCB;
    stscr.onreadystatechange=function(){if(stscr.readyState=='loaded'){stCB();}};})();
    function stCB(){
      stLight.options({
          publisher:'6beba854-ee6d-4ae1-a4f3-b69815c8ef63'
        });
    }
  </script>
  <script type="text/javascript">
    var timeOut = null;
    var shiftButtons = function() { 
    var sharebox = document.getElementById('sharebox');
    if(document.documentElement.clientWidth<1100){
      document.getElementById('verticalbuttons').style.display='none';
      document.getElementById('horizontalbuttons').style.display='block';  
      sharebox.style.position="relative";
      sharebox.style.left="auto";
      sharebox.style.top="auto";
      sharebox.style.marginBottom="6px";
      sharebox.style.marginLeft="auto";
      sharebox.style.marginRight="auto";
      sharebox.style.width="500px";
    } else {
      sharebox.style.position="fixed";
      sharebox.style.left="50%";
      sharebox.style.marginLeft="-566px";
      sharebox.style.top="20px";
      sharebox.style.width="90px";
      document.getElementById('verticalbuttons').style.display='block';
      document.getElementById('horizontalbuttons').style.display='none';
    }
  };
    
  window.onresize = function(){
     if(timeOut != null) clearTimeout(timeOut);
     setTimeout(shiftButtons, 1000);
  };
</script>

<div id="sharebox" style="position: fixed; left: 50%; top: 20px; margin-left: -566px;">
  <div id="horizontalbuttons" style="display:none">
    <span class="st_fblike_hcount" displayText="ShareThis"></span>
    <span class="st_twitter_hcount" displayText="ShareThis"></span>
    <span class="st_sharethis_button" displayText="ShareThis"></span>
    <span class="st_email_button" displayText="Email"></span>
  </div>
  <div id="verticalbuttons">
    <span class="st_fblike_vcount" displayText="ShareThis"></span><br/>
    <span class="st_twitter_vcount" displayText="ShareThis"></span><br/>
    <span class="st_sharethis_vcount" displayText="ShareThis"></span><br/>
    <span class="st_email_button" displayText="Email"></span><br/>
  </div>
</div>

AFTER (asincrono)

<script class="_iub_cs_activate-inline" type="text/plain">
      var switchTo5x=true;
      (function() {
        var stscr = document.createElement('script'); stscr.type = 'text/javascript'; stscr.async = true;
        stscr.src ="http://w.sharethis.com/button/buttons.js";
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(stscr, s);
        stscr.onload=stCB;
        stscr.onreadystatechange=function(){if(stscr.readyState=='loaded'){stCB();}};}
      )();
      function stCB(){
            stLight.options({
                    publisher:'e06c2f3092ca86c408bf781f8806b81f'
                });
      }
  </script>
  <script class="_iub_cs_activate" type="text/plain">
    var timeOut = null;
    var shiftButtons = function() {
    var sharebox = document.getElementById('sharebox');
    if(document.documentElement.clientWidth<1100){
      document.getElementById('verticalbuttons').style.display='none';
      document.getElementById('horizontalbuttons').style.display='block';
      sharebox.style.position="relative";
      sharebox.style.left="auto";
      sharebox.style.top="auto";
      sharebox.style.marginBottom="6px";
      sharebox.style.marginLeft="auto";
      sharebox.style.marginRight="auto";
      sharebox.style.width="500px";
    } else {
      sharebox.style.position="fixed";
      sharebox.style.left="50%";
      sharebox.style.marginLeft="-566px";
      sharebox.style.top="20px";
      sharebox.style.width="90px";
      document.getElementById('verticalbuttons').style.display='block';
      document.getElementById('horizontalbuttons').style.display='none';
    }
  };

  window.onresize = function(){
     if(timeOut != null) clearTimeout(timeOut);
     setTimeout(shiftButtons, 1000);
  };
</script>

<div id="sharebox" style="position: fixed; left: 50%; top: 20px; margin-left: -566px;">
  <div id="horizontalbuttons" style="display:none">
    <span class="st_fblike_hcount" displayText="ShareThis"></span>
    <span class="st_twitter_hcount" displayText="ShareThis"></span>
    <span class="st_sharethis_button" displayText="ShareThis"></span>
    <span class="st_email_button" displayText="Email"></span>
  </div>
  <div id="verticalbuttons">
    <span class="st_fblike_vcount" displayText="ShareThis"></span><br/>
    <span class="st_twitter_vcount" displayText="ShareThis"></span><br/>
    <span class="st_sharethis_vcount" displayText="ShareThis"></span><br/>
    <span class="st_email_button" displayText="Email"></span><br/>
  </div>
</div>

Google Maps

BEFORE (asincrono)

<script>
          function initialize() {
              var mapOptions = {
                  zoom: 8,
                  center: new google.maps.LatLng(-34.397, 150.644)
              };
              var map = new google.maps.Map(document.getElementById('map-canvas'),
                      mapOptions);
          }

          function loadScript() {
              var script = document.createElement('script');
              script.type = 'text/javascript';
              script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp' +
                      '&signed_in=true&callback=initialize';
              document.body.appendChild(script);
          }
          window.onload = loadScript;
      </script>

AFTER (asincrono)

<script type="text/plain"  class="_iub_cs_activate">
          function initialize() {
              var mapOptions = {
                  zoom: 8,
                  center: new google.maps.LatLng(-34.397, 150.644)
              };
              var map = new google.maps.Map(document.getElementById('map-canvas'),
                      mapOptions);
          }
          function loadScript() {
              var script = document.createElement('script');
              script.type = 'text/javascript';
              script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp' +
                      '&signed_in=true&callback=initialize';
              document.body.appendChild(script);
          }
          loadScript();
          //window.onload = loadScript();
</script>

BEFORE (sincrono)

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
      <script>
          var map;
          function initialize() {
              var mapOptions = {
                  zoom: 8,
                  center: new google.maps.LatLng(-34.397, 150.644)
              };
              map = new google.maps.Map(document.getElementById('googleMap'),
                      mapOptions);
          }
          google.maps.event.addDomListener(window, 'load', initialize);
      </script>

AFTER (sincrono)

<script src="http://maps.googleapis.com/maps/api/js?v=3.exp"></script>
      <script type="text/plain" class="_iub_cs_activate">
        var map;
        function initialize() {
              var mapOptions = {
                  zoom: 8,
                  center: new google.maps.LatLng(-34.397, 150.644)
              };
              map = new google.maps.Map(document.getElementById('googleMap'),
                      mapOptions);
        }
        initialize();
        //google.maps.event.addDomListener(window, 'load', initialize);
        </script>

Google Maps iframe

BEFORE

<iframe width="600" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed?pb=!1m23!1m12!1m3!1d47525.82470843965!2d12.530161413183587!3d41.88502730861466!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!4m8!3e6!4m0!4m5!1s0x132f6196f9928ebb%3A0xb90f770693656e38!2sRome%2C+Italy!3m2!1d41.9027835!2d12.4963655!5e0!3m2!1sen!2sde!4v1436895739887"></iframe>

AFTER

<iframe class="_iub_cs_activate" width="600" height="450" frameborder="0" style="border:0" src="//cdn.iubenda.com/cookie_solution/empty.html" suppressedsrc="https://www.google.com/maps/embed?pb=!1m23!1m12!1m3!1d47525.82470843965!2d12.530161413183587!3d41.88502730861466!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!4m8!3e6!4m0!4m5!1s0x132f6196f9928ebb%3A0xb90f770693656e38!2sRome%2C+Italy!3m2!1d41.9027835!2d12.4963655!5e0!3m2!1sen!2sde!4v1436895739887" allowfullscreen>
      </iframe>

Google Calendar widget

BEFORE

    <iframe width="573" height="446" frameborder="0" scrolling="no" style=" border-width:0 " src="http://www.google.com/calendar/hosted/YOURURL"></iframe>

AFTER

    <iframe width="573" height="446" frameborder="0" scrolling="no" style=" border-width:0 " class="_iub_cs_activate" src="data:text/html;base64,PGh0bWw+PGJvZHk+U3VwcHJlc3NlZDwvYm9keT48L2h0bWw+" suppressedsrc="http://www.google.com/calendar/hosted/YOURURL"></iframe>

Note: look closely at this part, class="_iub_cs_activate" src="data:text/html;base64,PGh0bWw+PGJvZHk+U3VwcHJlc3NlZDwvYm9keT48L2h0bWw+" suppressedsrc=".

Google Custom Search / Google Site Search

BEFORE

<script type="text/javascript">
      (function() {
          var cx = '006879106247619883145:quvjfulgdfo';
          var gcse = document.createElement('script');
          gcse.type = 'text/javascript';
          gcse.async = true;
          gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
                  '//cse.google.com/cse.js?cx=' + cx;
          var s = document.getElementsByTagName('script')[0];
          s.parentNode.insertBefore(gcse, s);
      })();
  </script>
<gcse:search></gcse:search>

AFTER

<script type="text/plain" class="_iub_cs_activate-inline">
      (function() {
          var cx = '006879106247619883145:quvjfulgdfo';
          var gcse = document.createElement('script');
          gcse.type = 'text/javascript';
          gcse.async = true;
          gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
                  '//cse.google.com/cse.js?cx=' + cx;
          var s = document.getElementsByTagName('script')[0];
          s.parentNode.insertBefore(gcse, s);
      })();
  </script>
<gcse:search></gcse:search>

Storify

BEFORE (sincrono)

<script src="//storify.com/YOURSITE/YOUR-LINK-TO-JS.js"></script>

AFTER (sincrono)

<script type="text/plain" class="_iub_cs_activate">
        (function() {
        var dsq = document.createElement('script');
        dsq.type = 'text/javascript';
        dsq.async = true;
        dsq.src = '//storify.com/YOURSITE/YOUR-LINK-TO-JS.js';
        (document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
</script>

AdRoll

BEFORE

<script type="text/javascript">
        adroll_adv_id = "XXXXXXXXXXXXXXXXXXXXXX";
        adroll_pix_id = "XXXXXXXXXXXXXXXXXXXXXX";
        (function () {
            var oldonload = window.onload;
            window.onload = function () {
                __adroll_loaded = true;
                var scr = document.createElement("script");
                var host = (("https:" == document.location.protocol) ? "https://s.adroll.com" : "http://a.adroll.com");
                scr.setAttribute('async', 'true');
                scr.type = "text/javascript";
                scr.src = host + "/j/roundtrip.js";
                ((document.getElementsByTagName('head') || [null])[0] || document.getElementsByTagName('script')[0].parentNode).appendChild(scr);
                if (oldonload) {
                    oldonload()
                }
            };
        }());
</script>
<script type="text/javascript">
        adroll_conversion_value_in_dollars = 49.95;
        adroll_custom_data = {"ORDER_ID": "12345", "USER_ID":"98765"}
</script>
<script type="text/javascript">
        adroll_conversion_value = 10;
        adroll_currency = "USD"
</script>

AFTER

<script type="text/plain" class="_iub_cs_activate">
        adroll_adv_id = "XXXXXXXXXXXXXXXXXXXXXX";
        adroll_pix_id = "XXXXXXXXXXXXXXXXXXXXXX";
        (function () {
            var oldonload = window.onload;
            //window.onload =
            function onLoad() {
                __adroll_loaded = true;
                var scr = document.createElement("script");
                var host = (("https:" == document.location.protocol) ? "https://s.adroll.com" : "http://a.adroll.com");
                scr.setAttribute('async', 'true');
                scr.type = "text/javascript";
                scr.src = host + "/j/roundtrip.js";
                ((document.getElementsByTagName('head') || [null])[0] ||       document.getElementsByTagName('script')[0].parentNode).appendChild(scr);
            };
            onLoad();
        }());
</script>
<script type="text/javascript">
        adroll_conversion_value_in_dollars = 49.95;
        adroll_custom_data = {"ORDER_ID": "12345", "USER_ID":"98765"}
</script>
<script type="text/javascript">
        adroll_conversion_value = 10;
        adroll_currency = "USD"
</script>

Kissmetrics

BEFORE

<script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-00000000-1']);
        _gaq.push(['_trackPageview']);
        (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();
</script>
<!-- KISSmetrics tracking snippet -->
<script type="text/javascript" >
        var _kmq = _kmq || [];
        var _kmk = _kmk || 'foo';
        function _kms(u){
          setTimeout(function(){
              var d = document, f = d.getElementsByTagName('script')[0],
                      s = d.createElement('script');
              s.type = 'text/javascript'; s.async = true; s.src = u;
              f.parentNode.insertBefore(s, f);
          }, 1);
        }
        _kms('//i.kissmetrics.com/i.js');
        _kms('//scripts.kissmetrics.com/' + _kmk + '.2.js');
</script>

AFTER

<script type="text/plain" class="_iub_cs_activate">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-00000000-1']);
        _gaq.push(['_trackPageview']);
        (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();
</script>
<!-- KISSmetrics tracking snippet -->
<script type="text/plain"  class="_iub_cs_activate">
        var _kmq = _kmq || [];
        var _kmk = _kmk || 'e76b907358e7b934865c0d9319153da8a43008c1';
        function _kms(u){
          setTimeout(function(){
              var d = document, f = d.getElementsByTagName('script')[0],
                      s = d.createElement('script');
              s.type = 'text/javascript'; s.async = true; s.src = u;
              f.parentNode.insertBefore(s, f);
          }, 1);
        }
        _kms('//i.kissmetrics.com/i.js');
        _kms('//scripts.kissmetrics.com/' + _kmk + '.2.js');
</script>

4w Marketing

BEFORE

<script type="text/javascript">
       m3ads_system = "4WM";
       m3ads_partnernumber = 5000;
       m3ads_containerclass = "container class";
       m3ads_numberadverts = x;
       m3ads_logoimagewidth = xx;
       m3ads_logoimageheight = xx;
       m3ads_subpartner = "ads_subpartner";
       m3ads_customheader = x;
</script>
<script  type="text/javascript" src="//cdn.feed.4wnet.com/resources/scripts/jsAds-1.4.min.js"></script>

AFTER

1) define the callBack for onConsentGiven on the instance _iub.csConfiguration

onConsentGiven: function () { 
$('.4wNET.hidden').removeClass('hidden');
}

2) include the entire script that loads the banner in a div with “display:none” set

<div class=”4wNET hidden” style=”display:none”>
    <script type="text/javascript">
         m3ads_system = "4WM";
         m3ads_partnernumber = 5000;
     m3ads_containerclass = "container class";
m3ads_numberadverts = x;
m3ads_logoimagewidth = xx;
m3ads_logoimageheight = xx;
m3ads_subpartner = "ads_subpartner";
m3ads_customheader = x;
    </script>
    <script  type="text/javascript" src="//cdn.feed.4wnet.com/resources/scripts/jsAds-1.4.min.js"></script>
</div>

MediaMond

BEFORE

<script type="text/javascript" src="http://mediamond.js.ad.dotandad.com/MediamondAds.js" language="javascript" id="mediamondBaseJS"></script>
<script type="text/javascript" language="javascript">
var mediamondAd=new MediamondAds();
mediamondAd.setTagPfx("page-prefix");
mediamondAd.setFifPath("/"); 
mediamondAd.setPositionsList("1o_u,sn_u,rn_u,rn_2,rn_3,rn_4,rn_5,rn_6,rn_7,rn_8,rn_9,rn_10,bp_1,bp_2,bp_3,bp_4,bp_5");
mediamondAd.setFunGen("fun-gen");
mediamondAd.setResponsiveSizes({"pixel":"x"});
try{mediamondAd.setKeywords("");}catch(e){}
mediamondAd.setDNT(-1);
mediamondAd.callAdserver();
</script>

AFTER

<script type=”text/javascript”>
  function iubendaIsConsentGiven(){
            if( 'consentIsGiven' in window && (consentIsGiven === true || consentIsGiven === false)) 
    return consentIsGiven;
            if(!('_iub' in window && 'csConfiguration' in _iub)) return false;
            var siteId = _iub.csConfiguration.siteId || '';
            var cookiePolicyId = _iub.csConfiguration.cookiePolicyId || '';
            var cs = document.cookie.split(';');
            var consentIsGiven = false;
            for (var i = 0; i < cs.length; i++) {
                while (cs[i].charAt(0) == ' ') cs[i] = cs[i].substring(1);
                if(cs[i].indexOf('_iub_cs-s'+ siteId) == 0||cs[i].indexOf('_iub_cs-'+ cookiePolicyId) == 0) {
                    consentIsGiven = true;
                    break;
                }
            }
            window.consentIsGiven = consentIsGiven;
            return consentIsGiven;
}
</script>
<script type="text/javascript" src="http://mediamond.js.ad.dotandad.com/MediamondAds.js" language="javascript" id="mediamondBaseJS"></script>
<script type="text/javascript" language="javascript">
var mediamondAd=new MediamondAds();
mediamondAd.setTagPfx("page-prefix");
mediamondAd.setFifPath("/"); 
mediamondAd.setPositionsList("1o_u,sn_u,rn_u,rn_2,rn_3,rn_4,rn_5,rn_6,rn_7,rn_8,rn_9,rn_10,bp_1,bp_2,bp_3,bp_4,bp_5");
mediamondAd.setFunGen("fun-gen");
mediamondAd.setResponsiveSizes({"pixel":"x"});
try{mediamondAd.setKeywords("");}catch(e){}
if (typeof iubendaIsConsentGiven == 'function' && typeof _iub.csConfiguration !== "undefined") {
           var isConsentGiven  = iubendaIsConsentGiven(  _iub.csConfiguration.siteId,
                                                                                                       _iub.csConfiguration.cookiePolicyId);
  if (!isConsentGiven) mediamondAd.setDNT(-1);
}
mediamondAd.callAdserver();
</script>

Trip Advisor – Badge Widget

BEFORE

<div id="DIV-ID" class="CLASS-DIV">
  <ul id="UL-ID" class="CLASS-UL">
    <li id="LI-ID" class="CLASS-LI">
      <a target="_blank" href="http://www.tripadvisor.co.uk/"><img src="http://www.tripadvisor.co.uk/img/cdsi/partner/tripadvisor_logo_DIMENSIONS.png" alt="TripAdvisor"/></a>
    </li>
  </ul>
</div>
<script src="http://www.jscache.com/wejs?wtype=TYPE&amp;uniq=UNIQ&amp;locationId=LocationId&amp;icon=knifeAndFork&amp;lang=en_UK&amp;display_version=2"></script>

AFTER

1. Add to the basic configuration of the iubenda script the reloadOnConsent as displayed below:

<script>
  _iub.csConfiguration ? _iub.csConfiguration : _iub.csConfiguration = {}
  _iub.csConfiguration.reloadOnConsent = true;
</script>
//insert it into <head> tag after iubenda configuration

2. Define onConsentGiven in order to control the cookies:

<script type='text/javascript'>
      function isConsentGiven() {
          if('consentIsGiven' in window && (consentIsGiven === true || consentIsGiven === false)) return consentIsGiven;
          if(!('_iub' in window && 'csConfiguration' in _iub)) return false;
          var siteId = _iub.csConfiguration.siteId || '';
          var cookiePolicyId = _iub.csConfiguration.cookiePolicyId || '';
          var cs = document.cookie.split(';');
          var consentIsGiven = false;
          for (var i = 0; i < cs.length; i++) {
              while (cs[i].charAt(0) == ' ') cs[i] = cs[i].substring(1);
              if(cs[i].indexOf('_iub_cs-s'+ siteId) == 0||cs[i].indexOf('_iub_cs-'+ cookiePolicyId) == 0) {
                  consentIsGiven = true;
                  break;
              }
          }
          window.consentIsGiven = consentIsGiven;
          return consentIsGiven;
      }
    </script>

3. Replace the original TripAdvisor element with this resource

<script>
      if(isConsentGiven()){ //per ogni elemento di TripAdvisor
        document.write('<div id="DIV-ID" class="CLASS-DIV"><ul id="UL-ID" class="CLASS-UL"><li id="LI-ID" class="CLASS-LI"><a target="_blank" href="http://www.tripadvisor.co.uk/"><img src="http://www.tripadvisor.co.uk/img/cdsi/partner/tripadvisor_logo_DIMENSIONS.png" alt="TripAdvisor"\/><\/a><\/li><\/ul><\/div>');
        document.write('<script src="http://www.jscache.com/wejs?wtype=TYPE&amp;uniq=UNIQ&amp;locationId=LocationId&amp;icon=knifeAndFork&amp;lang=en_UK&amp;display_version=2"><\/script>');
      }
    </script>

Trip Advisor – Read Review Widget

BEFORE

<div id="DIV-ID" class="CLASS-DIV">
  <ul id="UL-ID" class="CLASS-UL">
    <li id="LI-ID" class="CLASS-LI">
      <a target="_blank" href="http://www.tripadvisor.co.uk/"><img src="http://www.tripadvisor.co.uk/img/cdsi/partner/tripadvisor_logo_DIMENSIONS.png" alt="TripAdvisor"/></a>
    </li>
  </ul>
</div>
<script src="http://www.jscache.com/wejs?wtype=TYPE&amp;uniq=UNIQ&amp;locationId=LocationId&amp;icon=knifeAndFork&amp;lang=en_UK&amp;display_version=2"></script>

AFTER

1. Add to the basic configuration of the iubenda script the reloadOnConsent as displayed below:

<script>
  _iub.csConfiguration ? _iub.csConfiguration : _iub.csConfiguration = {}
  _iub.csConfiguration.reloadOnConsent = true;
</script>
//insert it into <head> tag after iubenda configuration

2. Define onConsentGiven in order to control the cookies:

<script type='text/javascript'>
      function isConsentGiven() {
          if('consentIsGiven' in window && (consentIsGiven === true || consentIsGiven === false)) return consentIsGiven;
          if(!('_iub' in window && 'csConfiguration' in _iub)) return false;
          var siteId = _iub.csConfiguration.siteId || '';
          var cookiePolicyId = _iub.csConfiguration.cookiePolicyId || '';
          var cs = document.cookie.split(';');
          var consentIsGiven = false;
          for (var i = 0; i < cs.length; i++) {
              while (cs[i].charAt(0) == ' ') cs[i] = cs[i].substring(1);
              if(cs[i].indexOf('_iub_cs-s'+ siteId) == 0||cs[i].indexOf('_iub_cs-'+ cookiePolicyId) == 0) {
                  consentIsGiven = true;
                  break;
              }
          }
          window.consentIsGiven = consentIsGiven;
          return consentIsGiven;
      }
    </script>

3. Replace the original TripAdvisor element with this resource

<script>
      if(isConsentGiven()){ //per ogni elemento di TripAdvisor
        document.write('<div id="DIV-ID" class="CLASS-DIV"><ul id="UL-ID" class="CLASS-UL"><li id="LI-ID" class="CLASS-LI"><a target="_blank" href="http://www.tripadvisor.co.uk/"><img src="http://www.tripadvisor.co.uk/img/cdsi/partner/tripadvisor_logo_DIMENSIONS.png" alt="TripAdvisor"\/><\/a><\/li><\/ul><\/div>');
        document.write('<script src="http://www.jscache.com/wejs?wtype=TYPE&amp;uniq=UNIQ&amp;locationId=LocationId&amp;icon=knifeAndFork&amp;lang=en_UK&amp;display_version=2"><\/script>');
      }
    </script>

Trip Advisor – Write Review Widget

BEFORE

<div id="DIV-ID" class="CLASS-DIV">
  <ul id="UL-ID" class="CLASS-UL">
    <li id="LI-ID" class="CLASS-LI">
      <a target="_blank" href="http://www.tripadvisor.co.uk/"><img src="http://www.tripadvisor.co.uk/img/cdsi/partner/tripadvisor_logo_DIMENSIONS.png" alt="TripAdvisor"/></a>
    </li>
  </ul>
</div>
<script src="http://www.jscache.com/wejs?wtype=TYPE&amp;uniq=UNIQ&amp;locationId=LocationId&amp;icon=knifeAndFork&amp;lang=en_UK&amp;display_version=2"></script>

AFTER

1. Add to the basic configuration of the iubenda script the reloadOnConsent as displayed below:

<script>
  _iub.csConfiguration ? _iub.csConfiguration : _iub.csConfiguration = {}
  _iub.csConfiguration.reloadOnConsent = true;
</script>
//insert it into <head> tag after iubenda configuration

2. Define onConsentGiven in order to control the cookies:

<script type='text/javascript'>
      function isConsentGiven() {
          if('consentIsGiven' in window && (consentIsGiven === true || consentIsGiven === false)) return consentIsGiven;
          if(!('_iub' in window && 'csConfiguration' in _iub)) return false;
          var siteId = _iub.csConfiguration.siteId || '';
          var cookiePolicyId = _iub.csConfiguration.cookiePolicyId || '';
          var cs = document.cookie.split(';');
          var consentIsGiven = false;
          for (var i = 0; i < cs.length; i++) {
              while (cs[i].charAt(0) == ' ') cs[i] = cs[i].substring(1);
              if(cs[i].indexOf('_iub_cs-s'+ siteId) == 0||cs[i].indexOf('_iub_cs-'+ cookiePolicyId) == 0) {
                  consentIsGiven = true;
                  break;
              }
          }
          window.consentIsGiven = consentIsGiven;
          return consentIsGiven;
      }
    </script>

3. Replace the original TripAdvisor element with this resource

<script>
        if(isConsentGiven()){
            document.write('<div id="DIV-ID" class="CLASS-DIV"><ul id="UL-ID" class="CLASS-UL"><li id="LI-ID" class="CLASS-LI"><a target="_blank" href="http://www.tripadvisor.co.uk/"><img class="_iub_cs_activate" src="data:text/html;base64,PGh0bWw+PGJvZHk+U3VwcHJlc3NlZDwvYm9keT48L2h0bWw+" suppressedsrc="http://www.tripadvisor.co.uk/img/cdsi/img2/branding/150_logo-11900-2.png" alt="TripAdvisor"\/><\/a><\/li><\/ul><\/div>');
            document.write('<script src="http://www.jscache.com/wejs?wtype=cdswritereviewlg&amp;uniq=YOUR-UNIQ&amp;locationId=YOUR-LOCATION&amp;lang=en_UK&amp;border=false&amp;langversion=2"><\/script>');
        }
    </script>

PayPal ( Buy Now button)

BEFORE

<script src="https://www.paypalobjects.com/js/external/paypal-button.min.js?merchant=YOUR_MERCHANT_ID"
            data-button="buynow"
            data-name="My product"
            data-amount="1.00"
            async></script>

AFTER

<script type="text/plain" class="_iub_cs_activate" src="https://www.paypalobjects.com/js/external/paypal-button.min.js?merchant=YOUR_MERCHANT_ID"
            data-button="buynow"
            data-name="My product"
            data-amount="0.01"
            async
    ></script>

Amazon

BEFORE

<iframe src="http://rcm-eu.amazon-adsystem.com/e/cm?t=previsionivin-21&o=29&p=26&l=ur1&category=it_generic&banner=0JV8RQREJ41NGBW1S402&f=ifr" width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>

AFTER

<iframe type="text/plain" class="_iub_cs_activate" src="data:text/html;base64,PGh0bWw+PGJvZHk+U3VwcHJlc3NlZDwvYm9keT48L2h0bWw+" suppressedsrc="http://rcm-eu.amazon-adsystem.com/e/cm?t=previsionivin-21&o=29&p=26&l=ur1&category=it_generic&banner=0JV8RQREJ41NGBW1S402&f=ifr" width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>

JUCE

Note:

for IE 11 -> 7 an error message will appear in the banner box before cookies are accepted. After cookies are accepted, the error message will disappear.

BEFORE

<iframe marginwidth="0" marginheight="0" frameborder="0" scrolling="no" allowtransparency="true" src="http://srv.juiceadv.com/banner_iframe.asp?user=2630&amp;tipo=20" width="250" height="250"></iframe>

AFTER

<iframe marginwidth="0" marginheight="0" frameborder="0" scrolling="no" allowtransparency="true" type="text/plain" class="_iub_cs_activate" src="data:text/html;base64,PGh0bWw+PGJvZHk+U3VwcHJlc3NlZDwvYm9keT48L2h0bWw+" suppressedsrc="http://srv.juiceadv.com/banner_iframe.asp?user=2630&amp;tipo=20" width="250" height="250"></iframe>

MYLIVECHAT

BEFORE

<script type="text/javascript" defer="defer" src="https://mylivechat.com/chatinline.aspx?hccid=90864984"></script>

AFTER

<script type="text/plain" class="_iub_cs_activate" src="data:text/html;base64,PGh0bWw+PGJvZHk+U3VwcHJlc3NlZDwvYm9keT48L2h0bWw+" suppressedsrc="https://mylivechat.com/chatinline.aspx?hccid=90864984"></script>

Feedjit

BEFORE

Note:

for IE 7 – 8 Cookie Consent doesn’t work correctly.

<script type="text/javascript"   src="http://feedjit.com/serve/?vv=1022&amp;tft=3&amp;dd=0&amp;wid=c30f97c47f08b51d&amp;pid=0&amp;proid=0&amp;bc=FFFFFF&amp;tc=000000&amp;brd1=012B6B&amp;lnk=135D9E&amp;hc=FFFFFF&amp;hfc=2853A8&amp;btn=C99700&amp;ww=250&amp;wne=10&amp;wh=Live+Traffic+Feed&amp;hl=0&amp;hlnks=0&amp;hfce=0&amp;srefs=0&amp;hbars=0"></script><noscript><a onclick="javascript:xspLeavingTheSite=false;" href="http://feedjit.com/">Feedjit Live Blog Stats</a></noscript>

AFTER

<script type="text/plain" class="_iub_cs_activate-inline" src="http://feedjit.com/serve/?vv=1022&amp;tft=3&amp;dd=0&amp;wid=c30f97c47f08b51d&amp;pid=0&amp;proid=0&amp;bc=FFFFFF&amp;tc=000000&amp;brd1=012B6B&amp;lnk=135D9E&amp;hc=FFFFFF&amp;hfc=2853A8&amp;btn=C99700&amp;ww=250&amp;wne=10&amp;wh=Live+Traffic+Feed&amp;hl=0&amp;hlnks=0&amp;hfce=0&amp;srefs=0&amp;hbars=0"></script><noscript><a onclick="javascript:xspLeavingTheSite=false;" href="http://feedjit.com/">Feedjit Live Blog Stats</a></noscript>

Google Fonts

BEFORE

<script type="text/javascript">
          (function() {
              var link_element = document.createElement("link"),
                      s = document.getElementsByTagName("script")[0];
              if (window.location.protocol !== "http:" && window.location.protocol !== "https:") {
                  link_element.href = "http:";
              }
              link_element.href += "//fonts.googleapis.com/css?family=FAMILY";
              link_element.rel = "stylesheet";
              link_element.type = "text/css";
              s.parentNode.insertBefore(link_element, s);
          })();
</script>

AFTER

<script class="_iub_cs_activate" type="text/plain">
            (function() {
                var link_element = document.createElement("link"),
                    s = document.getElementsByTagName("script")[0];
                if (window.location.protocol !== "http:" && window.location.protocol !== "https:") {
                    link_element.href = "http:";
                }
                link_element.href += "//fonts.googleapis.com/css?family=FAMILY";
                link_element.rel = "stylesheet";
                link_element.type = "text/css";
                s.parentNode.insertBefore(link_element, s);
            })();
</script>

Criteo

BEFORE

<script>
        <!--//<![CDATA[
        document.MAX_ct0 ='';
        var m3_u = (location.protocol=='https:'?'https://cas.criteo.com/delivery/ajs.php?':'http://cas.criteo.com/delivery/ajs.php?');
        var m3_r = Math.floor(Math.random()*99999999999);
        document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
        document.write ("zoneid=ZONE-ID");document.write("&amp;nodis=1");
        document.write ('&amp;cb=' + m3_r);
        if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
        document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
        document.write ("&amp;loc=" + escape(window.location));
        if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
        if (document.context) document.write ("&context=" + escape(document.context));
        if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {
            document.write ("&amp;ct0=" + escape(document.MAX_ct0));
        }
        if (document.mmm_fo) document.write ("&amp;mmm_fo=1");

        document.write ("'></scr"+"ipt>");
        //]]>-->
</script>

AFTER

<script type="text/plain" class="_iub_cs_activate-inline">
        <!--//<![CDATA[
        document.MAX_ct0 ='';
        var m3_u = (location.protocol=='https:'?'https://cas.criteo.com/delivery/ajs.php?':'http://cas.criteo.com/delivery/ajs.php?');
        var m3_r = Math.floor(Math.random()*99999999999);
        var src = m3_u+"zoneid=ZONEID&amp;nodis=1"+'&amp;cb=' + m3_r;
        if (document.MAX_used != ',')
            src += "&amp;exclude=" + document.MAX_used;
        if(document.charset)
            src +='&amp;charset='+document.charset
        else{
            if(document.characterSet)
                src +='&amp;charset='+document.characterSet
        }
        src +="&amp;loc=" + escape(window.location);
        if (document.referrer) src +="&amp;referer=" + escape(document.referrer);
        if (document.context)  src +="&context=" + escape(document.context);
        if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {
            src +="&amp;ct0=" + escape(document.MAX_ct0);
        }
        if (document.mmm_fo) src +="&amp;mmm_fo=1";
        document.write ("<scr"+"ipt type='text/javascript' src='"+src+"'>");
        document.write ("<\/scr"+"ipt>");
        //]]>-->
</script>

Facebook Like Box

BEFORE

  <div class="fb-like-box"
       data-width="245" data-height="290"
       data-href="http://www.facebook.com/digital.inspiration"
       data-border-color="#F4F4F4" data-show-faces="true"
       data-stream="false" data-header="false">
  </div>
  <div id="fb-root"></div>
  <script>
    (function(d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.3&appId=210311129007974";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
  </script>

AFTER

<div class="fb-like-box"
       data-width="245" data-height="290"
       data-href="http://www.facebook.com/digital.inspiration"
       data-border-color="#F4F4F4" data-show-faces="true"
       data-stream="false" data-header="false">
  </div>
  <div id="fb-root"></div>
    <script type="text/plain" class="_iub_cs_activate">
    (function(d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.3&appId=210311129007974";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
    </script>

Facebook Page plugin

(The example Page plugin below doesn’t work for IE 7)

BEFORE

<div class="fb-page" data-href="https://www.facebook.com/facebook" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true" data-show-posts="true">
  <div class="fb-xfbml-parse-ignore">
    <blockquote cite="https://www.facebook.com/facebook">
      <a href="https://www.facebook.com/facebook">Facebook</a>
    </blockquote>
  </div>
</div>
<script>
    (function(d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.3&appId=210311129007974";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
</script>

AFTER

<div class="fb-page" data-href="https://www.facebook.com/facebook" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true" data-show-posts="true">
  <div class="fb-xfbml-parse-ignore">
    <blockquote cite="https://www.facebook.com/facebook">
      <a href="https://www.facebook.com/facebook">Facebook</a>
    </blockquote>
  </div>
</div>
<script type="text/plain" class="_iub_cs_activate">
    (function(d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.3&appId=210311129007974";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
    </script>

recaptcha

BEFORE

<head>
..
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
..
</head>
<body>
..
<form action="?" method="POST">
  <div id="html_element"></div>
  <br>
  <div class="g-recaptcha" data-sitekey="SITE-KEY"></div>
  <input type="submit" value="Submit">
</form>
..
</body>

AFTER

<head>
..
<script type="text/plain" class="_iub_cs_activate" src="https://www.google.com/recaptcha/api.js" async defer></script>
..
</head>
<body>
..
<form action="?" method="POST">
  <div id="html_element"></div>
  <br>
  <div class="g-recaptcha" data-sitekey="SITE-KEY"></div>
  <input type="submit" value="Submit">
</form>
..
</body>

Stripe

BEFORE

<form action="" method="POST">
     <script
          src="https://checkout.stripe.com/checkout.js" class="stripe-button"
          data-key="pk_test_6pRNASCoBOKtIshFeQd4XMUh"
          data-amount="2000"
          data-name="Demo Site"
          data-description="2 widgets ($20.00)"
          data-image="/128x128.png">
      </script>
</form>

AFTER

<form action="" method="POST">
      <script
          src="https://checkout.stripe.com/checkout.js" class="stripe-button _iub_cs_activate"
          type="text/plain"
          data-key="pk_test_6pRNASCoBOKtIshFeQd4XMUh"
          data-amount="2000"
          data-name="Demo Site"
          data-description="2 widgets ($20.00)"
          data-image="/128x128.png">
      </script>
</form>

Optimizely

BEFORE

<head>
..
      <script src="//cdn.optimizely.com/js/3129550290.js"></script>
..    
</head>

AFTER

<head>
..
    <script type="text/plain" class="_iub_cs_activate" src="//cdn.optimizely.com/js/3129550290.js"></script>
..
</head>

Spotify listen

BEFORE

    <iframe src="https://embed.spotify.com/?uri=spotify:track:4th1RQAelzqgY7wL53UGQt" width="300" height="380" frameborder="0" allowtransparency="true"></iframe>

AFTER

    <iframe class="_iub_cs_activate" src="http://cdn.iubenda.com/cookie_solution/empty.html" suppressedsrc="https://embed.spotify.com/?uri=spotify:track:4th1RQAelzqgY7wL53UGQt" width="300" height="380" frameborder="0" allowtransparency="true"></iframe>

Spotify follow

BEFORE

<iframe src="https://embed.spotify.com/follow/1/?uri=spotify:artist:1vCWHaC5f2uS3yhpwWbIA6&size=detail&theme=light" width="300" height="56" scrolling="no" frameborder="0" style="border:none; overflow:hidden;" allowtransparency="true"></iframe>

AFTER

<iframe class="_iub_cs_activate" src="http://cdn.iubenda.com/cookie_solution/empty.html" suppressedsrc="https://embed.spotify.com/follow/1/?uri=spotify:artist:1vCWHaC5f2uS3yhpwWbIA6&size=detail&theme=light" width="300" height="56" scrolling="no" frameborder="0" style="border:none; overflow:hidden;" allowtransparency="true"></iframe>

Soundcloud

BEFORE

<iframe id="sc-widget" src="https://w.soundcloud.com/player/?url=http://api.soundcloud.com/users/USER-ID/favorites" width="100%" height="465" scrolling="no" frameborder="no"></iframe>
    <script src="https://w.soundcloud.com/player/api.js" type="text/javascript"></script>
    <script type="text/javascript">
        (function(){
            var widgetIframe = document.getElementById('sc-widget'),
                    widget       = SC.Widget(widgetIframe);
            widget.bind(SC.Widget.Events.READY, function() {
                widget.bind(SC.Widget.Events.PLAY, function() {
                    // get information about currently playing sound
                    widget.getCurrentSound(function(currentSound) {
                        console.log('sound ' + currentSound.get('') + 'began to play');
                    });
                });
                // get current level of volume
                widget.getVolume(function(volume) {
                    console.log('current volume value is ' + volume);
                });
                // set new volume level
                widget.setVolume(50);
                // get the value of the current position
            });
        }());
    </script>

AFTER

<iframe class="_iub_cs_activate" id="sc-widget" src="http://cdn.iubenda.com/cookie_solution/empty.html" suppressedsrc="https://w.soundcloud.com/player/?url=http://api.soundcloud.com/users/USER-ID/favorites" width="100%" height="465" scrolling="no" frameborder="no"></iframe>
    <script class="_iub_cs_activate" type="text/plain">
        var script = document.createElement("script"), tag = document.getElementsByTagName("script")[0];
        script.type = "text/javascript";
        if(script.readyState) {  //IE
            script.onreadystatechange = function() {
              if ( script.readyState === "loaded" || script.readyState === "complete" ) {
                script.onreadystatechange = null;
                    callback();
              }
            };
        } else {  //Others
            script.onload = function() {
              callback();
            };
        }
        script.src = "https://w.soundcloud.com/player/api.js"
        tag.parentNode.insertBefore(script, tag);
        function callback(){
            var widgetIframe = document.getElementById('sc-widget'),
                    widget = SC.Widget(widgetIframe);

            widget.bind(SC.Widget.Events.READY, function() {
                widget.bind(SC.Widget.Events.PLAY, function() {
                    // get information about currently playing sound
                    widget.getCurrentSound(function(currentSound) {
                        console.log('sound ' + currentSound.get('') + 'began to play');
                    });
                });
                // get current level of volume
                widget.getVolume(function(volume) {
                    console.log('current volume value is ' + volume);
                });
                // set new volume level
                widget.setVolume(50);
                // get the value of the current position
            });
        }
    </script>

Uservoice

BEFORE

<script type="text/javascript">
        // Include the UserVoice JavaScript SDK (only needed once on a page)
        UserVoice=window.UserVoice||[];
        (function(){
            var uv=document.createElement('script');
            uv.type='text/javascript';
            uv.async=true;
            uv.src='//widget.uservoice.com/YOUR_KEY.js';
            var s=document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(uv,s)
        })();

        //
        // UserVoice Javascript SDK developer documentation:
        // https://www.uservoice.com/o/javascript-sdk
        //

        // Set colors
        UserVoice.push(['set', {
            accent_color: '#448dd6',
            trigger_color: 'white',
            trigger_background_color: 'rgba(46, 49, 51, 0.6)'
        }]);

        // Identify the user and pass traits
        // To enable, replace sample data with actual user traits and uncomment the line
        UserVoice.push(['identify', {
            //email:      'john.doe@example.com', // User’s email address
            //name:       'John Doe', // User’s real name
            //created_at: 1364406966, // Unix timestamp for the date the user signed up
            //id:         123, // Optional: Unique id of the user (if set, this should not change)
            //type:       'Owner', // Optional: segment your users by type
            //account: {
            //  id:           123, // Optional: associate multiple users with a single account
            //  name:         'Acme, Co.', // Account name
            //  created_at:   1364406966, // Unix timestamp for the date the account was created
            //  monthly_rate: 9.99, // Decimal; monthly rate of the account
            //  ltv:          1495.00, // Decimal; lifetime value of the account
            //  plan:         'Enhanced' // Plan name for the account
            //}
        }]);

        // Add default trigger to the bottom-right corner of the window:
        UserVoice.push(['addTrigger', {mode: 'smartvote', trigger_position: 'bottom-right' }]);

        // Or, use your own custom trigger:
        //UserVoice.push(['addTrigger', '#id', { mode: 'smartvote' }]);

        // Autoprompt for Satisfaction and SmartVote (only displayed under certain conditions)
        UserVoice.push(['autoprompt', {}]);
    </script>

AFTER

 <script type="text/plain" class="_iub_cs_activate">
        // Include the UserVoice JavaScript SDK (only needed once on a page)
        UserVoice=window.UserVoice||[];
        (function(){
            var uv=document.createElement('script');
            uv.type='text/javascript';
            uv.async=true;
            uv.src='//widget.uservoice.com/YOUR_KEY.js';
            var s=document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(uv,s)
        })();

        //
        // UserVoice Javascript SDK developer documentation:
        // https://www.uservoice.com/o/javascript-sdk
        //

        // Set colors
        UserVoice.push(['set', {
            accent_color: '#448dd6',
            trigger_color: 'white',
            trigger_background_color: 'rgba(46, 49, 51, 0.6)'
        }]);

        // Identify the user and pass traits
        // To enable, replace sample data with actual user traits and uncomment the line
        UserVoice.push(['identify', {
            //email:      'john.doe@example.com', // User’s email address
            //name:       'John Doe', // User’s real name
            //created_at: 1364406966, // Unix timestamp for the date the user signed up
            //id:         123, // Optional: Unique id of the user (if set, this should not change)
            //type:       'Owner', // Optional: segment your users by type
            //account: {
            //  id:           123, // Optional: associate multiple users with a single account
            //  name:         'Acme, Co.', // Account name
            //  created_at:   1364406966, // Unix timestamp for the date the account was created
            //  monthly_rate: 9.99, // Decimal; monthly rate of the account
            //  ltv:          1495.00, // Decimal; lifetime value of the account
            //  plan:         'Enhanced' // Plan name for the account
            //}
        }]);

        // Add default trigger to the bottom-right corner of the window:
        UserVoice.push(['addTrigger', {mode: 'smartvote', trigger_position: 'bottom-right' }]);

        // Or, use your own custom trigger:
        //UserVoice.push(['addTrigger', '#id', { mode: 'smartvote' }]);

        // Autoprompt for Satisfaction and SmartVote (only displayed under certain conditions)
        UserVoice.push(['autoprompt', {}]);
    </script>

viralize

BEFORE

<script type="text/javascript" src="https://ads.viralize.tv/display/?wid=demo&amp;preview=1&amp;f=iframe&amp;cid=CID" data-wid="demo" ></script>

AFTER

<script type="text/plain" class="_iub_cs_activate" src="https://ads.viralize.tv/display/?wid=demo&amp;preview=1&amp;f=iframe&amp;cid=CID" data-wid="demo"></script>

Foursquare

BEFORE

<script type='text/javascript'>
        (function() {
            window.___fourSq = {"uid":"606"};
            var s = document.createElement('script');
            s.type = 'text/javascript';
            s.src = 'http://platform.foursquare.com/js/widgets.js';
            s.async = true;
            var ph = document.getElementsByTagName('script')[0];
            ph.parentNode.insertBefore(s, ph);
        })();
    </script>

AFTER

<script type='text/plain' class="_iub_cs_activate">
        (function() {
            window.___fourSq = {"uid":"606"};
            var s = document.createElement('script');
            s.type = 'text/javascript';
            s.src = 'http://platform.foursquare.com/js/widgets.js';
            s.async = true;
            var ph = document.getElementsByTagName('script')[0];
            ph.parentNode.insertBefore(s, ph);
        })();
</script>

Bing Tracker

BEFORE

<script>(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:"TAG_ID"};o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")},n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){var s=this.readyState;s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,"script","//bat.bing.com/bat.js","uetq");</script>
    <script> var uetq = uetq || [];  uetq.push({ 'gv': ORDER_TOTAL });</script>
    <noscript><img src="//bat.bing.com/action/0?ti=TAG_ID&Ver=2&gv=ORDER_TOTAL" height="0" width="0" style="display:none; visibility:hidden;" /></noscript>

AFTER

<script type="text/plain" class="_iub_cs_activate">
        var ORDER_TOTAL = 10;
        (function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:"TAG_ID"};o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")},n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){var s=this.readyState;s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,"script","//bat.bing.com/bat.js","uetq");
    </script>
    <script> var uetq = uetq || [];  uetq.push({ 'gv': 10 });</script>
    <noscript>
      <img class="_iub_cs_activate" src="//cdn.iubenda.com/cookie_solution/empty.html"  suppressedsrc="//bat.bing.com/action/0?ti=TAG_ID&Ver=2&gv=ORDER_TOTAL" height="0" width="0" style="display:none; visibility:hidden;" />
    </noscript>

Altervista Banner

BEFORE

<script type="text/javascript">
/* <![CDATA[ */
  document.write('<s'+'cript type="text/javascript" src="http://ad.altervista.org/js.ad/size=728X90/?ref='+encodeURIComponent(location.hostname+location.pathname)+'&r='+new Date().getTime()+'"></s'+'cript>');
/* ]]> */
</script>

AFTER

You need to add the reference to Google Tag Manager within the tag HEAD

// add googletag file in tag head
<script type="text/plain" class="_iub_cs_activate">
        var googletag = googletag || {};
        googletag.cmd = googletag.cmd || [];
        (function() {
            var gads = document.createElement("script");
            gads.async = true;
            gads.type = "text/javascript";
            var useSSL = "https:" == document.location.protocol;
            gads.src = (useSSL ? "https:" : "http:") + "//www.googletagservices.com/tag/js/gpt.js";
            var node =document.getElementsByTagName("script")[0];
            node.parentNode.insertBefore(gads, node);
        })();
  </script>

then modify the original script Altervista in this way:

<script class="_iub_cs_activate-inline" type="text/plain">
/* <![CDATA[ */
  document.write('<s'+'cript type="text/javascript" src="http://ad.altervista.org/js.ad/size=728X90/?ref='+encodeURIComponent(location.hostname+location.pathname)+'&r='+new Date().getTime()+'"></s'+'cript>');
/* ]]> */
</script>

Here you can find an alternative block, suitable for special configurations of the AlterVista banner:

// Alternative block snippet for Altervista.
// If multiple banners exist in page, customize method's name basing on banner dimension or position. 
// Eg: renderBanner300250, renderBannerHeader
<body>

...
<script type="text/javascript">
  /*<![CDATA[*/
    function renderBannerX(){
      var src = "http://ALTERVISTA-AD-SCRIPT/size=YOUR-SIZE/?ref="+encodeURIComponent(location.hostname+location.pathname);
      var scriptClose = "<\/script>";
      var scriptForDocWrite = '<s'+'cript language=\"javascript\" src=\"'+src+'\">';
      return "<script type=\"text/javascript\">document.write('"+scriptForDocWrite+"');" + scriptClose;
    }  
  /*]]>*/
</script>
<script type="text/plain" class="_iub_cs_activate-inline">
    document.write(renderBannerX());
</script>
...

</body>

Still have questions?

Visit our support forum Email us