• I need to insert multiple analytics script, but it return this error “Invalid HTML markup provided for custom analytics tracker code”. Below is my code

    <script>
      var newURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
      (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','https://www.google-analytics.com/analytics.js','ga');
      ga('create', 'UA-12345678-1', 'auto');  
      ga('set', 'referrer', 'https://instant.facebook.com/instant');
      ga('send', 'event', 'Instant Article', 'Article Read', newURL);
      ga('send', 'pageview');
    </script>
    
    <!-- Begin comScore Tag -->
    <script>
      var _comscore = _comscore || [];
      _comscore.push({ c1: "2", c2: "12345678", options: {url_append: "comscorekw=fbia"}});
      (function() {
    	var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true;
    	s.src = (document.location.protocol == "https:" ? "https://sb" : "https://b") + ".scorecardresearch.com/beacon.js";
    	el.parentNode.insertBefore(s, el);
      })();
    </script>
    <noscript><img src="https://b.scorecardresearch.com/p?c1=2&c2=13578094&cv=2.0&cj=1&comscorekw=fbia"></noscript>
    

    Please can someone advice.

  • The topic ‘Multiple analytics script’ is closed to new replies.