Below is a sample code that can be used to integrate Siteimprove Analytics with Cookie Consent. Make sure you insert your personalized url in sz.src and the correct url of your Cookie Consent javascript.


<script language="javascript">
var siLoaded = false;
var loadSiteimprove = function()
{
  if (!siLoaded)
  {
    var sz = document.createElement('script'); sz.type = 'text/javascript'; sz.async = true;
    sz.src = '//siteimproveanalytics.com/js/siteanalyze_xxxxxxxx.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sz, s);

    siLoaded = true;
  }
}
</script>
<script src="https://cookie.consent.is/cc/xxxxxxxx.js"></script>
<script type="text/javascript">
window.addEventListener("load", function() {
window.cookieconsent.initialise({
  onInitialise: function(status) {
    if (this.hasConsented('analytics')) {
      // User has already allowed the analytics category

      // Load Siteimprove
      loadSiteimprove();
    }
  },
  onAllow: function(category) {
    if (category == 'analytics') {
      // User just allowed the analytics category

      // Load Siteimprove
      loadSiteimprove();
    }
  }
})
});
</script>