Jump to content
thirty bees forum
  • 0

Why my custom js code gets commented out?


the.rampage.rado

Question

I would like to add this code to my site for one antifraud module:
 

<script>
	(function(){
		function s() {
			var e = document.createElement('script');
			e.type = 'text/javascript';
			e.async = true;
			e.src = ('https:' === document.location.protocol ? 'https://' : 'http://') + 'cdn.fraudlabspro.com/s.js';
			var s = document.getElementsByTagName('script')[0];
			s.parentNode.insertBefore(e, s);
		}			  
		(window.attachEvent) ? window.attachEvent('onload', s) : window.addEventListener('load', s, false);
	})();
</script>

but it get's commented out:
 

<script type="text/javascript">/* <![CDATA[ */;window.addEventListener('load',function(){if(typeof window.cookieconsent!=='undefined'){window.cookieconsent.initialise({"position":"bottom-right","static":false,"theme":"edgeless","palette":{"popup":{"background":"#004c99","text":"#ffffff"},"button":{"background":"#f1d600","text":"#000000"}},"geoip":false,"content":{"message":SOME MESSAGE FROM THE COOKIE MODULE}});}});;window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}
gtag('js',new Date());gtag('config','G-R6CE3JK4G6');;(function(){function s(){var e=document.createElement('script');e.type='text/javascript';e.async=true;e.src=('https:'===document.location.protocol?'https://':'http://')+'cdn.fraudlabspro.com/s.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(e,s);}
(window.attachEvent)?window.attachEvent('onload',s):window.addEventListener('load',s,false);})();/* ]]> */</script>
</body></html>

despite I have accepted the cookies in the popupbanner?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

It's not commented out. If you beautify the result content, you will get this

/* <![CDATA[ */

;window.addEventListener('load', function () {
    if (typeof window.cookieconsent !== 'undefined') {
        window.cookieconsent.initialise({
            "position": "bottom-right",
            "static": false,
            "theme": "edgeless",
            "palette": {
                "popup": {"background": "#004c99", "text": "#ffffff"},
                "button": {"background": "#f1d600", "text": "#000000"}
            },
            "geoip": false,
            "content": {"message": SOME MESSAGE FROM THE COOKIE MODULE}
        });
    }
});
;window.dataLayer = window.dataLayer || [];

function gtag() {
    dataLayer.push(arguments);
}

gtag('js', new Date());
gtag('config', 'G-R6CE3JK4G6');
;(function () {
    function s() {
        var e = document.createElement('script');
        e.type = 'text/javascript';
        e.async = true;
        e.src = ('https:' === document.location.protocol ? 'https://' : 'http://') + 'cdn.fraudlabspro.com/s.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(e, s);
    }

    (window.attachEvent) ? window.attachEvent('onload', s) : window.addEventListener('load', s, false);
})();

/* ]]> */

The all comments are closed.

There is, however, syntax error in this javascript snippet, related to text  SOME MESSAGE FROM THE COOKIE MODULE

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...