Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1203538
    Simon
    Participant

    Hi team,

    I can’t add this javascript code on cutom / eddit global javascript.
    If i add this code i can’t save.

    <script type="text/javascript">
    window.sendinblue=window.sendinblue||[];window.sendinblue.methods=["identify","init","group","track","page","trackLink"];window.sendinblue.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);window.sendinblue.push(t);return window.sendinblue}};for(var i=0;i<window.sendinblue.methods.length;i++){var key=window.sendinblue.methods[i];window.sendinblue[key]=window.sendinblue.factory(key)}window.sendinblue.load=function(){if(document.getElementById("sendinblue-js"))return;var e=document.createElement("script");e.type="text/javascript";e.id="sendinblue-js";e.async=true;e.src=("https:"===document.location.protocol?"https://":"http://")+"s.sib.im/automation.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)};window.sendinblue.SNIPPET_VERSION="1.0";window.sendinblue.load();window.sendinblue.client_key="uax6d1uu3wj6qfubdzckb";window.sendinblue.page();
    </script>

    Someone have an idea ?
    Simon

    #1203563
    Thai
    Moderator

    Hi Simon,

    Please add the following code under functions.php file locates in your child theme:

    add_action( 'wp_head', 'add_custom_script' );
    function add_custom_script(){
    	?>
    	<script type="text/javascript">
    	window.sendinblue=window.sendinblue||[];window.sendinblue.methods=["identify","init","group","track","page","trackLink"];window.sendinblue.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);window.sendinblue.push(t);return window.sendinblue}};for(var i=0;i<window.sendinblue.methods.length;i++){var key=window.sendinblue.methods[i];window.sendinblue[key]=window.sendinblue.factory(key)}window.sendinblue.load=function(){if(document.getElementById("sendinblue-js"))return;var e=document.createElement("script");e.type="text/javascript";e.id="sendinblue-js";e.async=true;e.src=("https:"===document.location.protocol?"https://":"http://")+"s.sib.im/automation.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)};window.sendinblue.SNIPPET_VERSION="1.0";window.sendinblue.load();window.sendinblue.client_key="uax6d1uu3wj6qfubdzckb";window.sendinblue.page();
    	</script>	
    	<?php
    }

    Hope it helps 🙂

    #1204753
    Simon
    Participant

    Thanks Thai !
    Have a good day !

    #1204765
    Rue Nel
    Moderator

    You’re welcome!
    Thanks for letting us know that it has worked for you.

    #1349536
    Simon
    Participant

    Hi team !

     add_action( 'wp_head', 'add_custom_script' );
    function add_custom_script(){
    	?>
    	<script type="text/javascript">
    	window.sendinblue=window.sendinblue||[];window.sendinblue.methods=["identify","init","group","track","page","trackLink"];window.sendinblue.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);window.sendinblue.push(t);return window.sendinblue}};for(var i=0;i<window.sendinblue.methods.length;i++){var key=window.sendinblue.methods[i];window.sendinblue[key]=window.sendinblue.factory(key)}window.sendinblue.load=function(){if(document.getElementById("sendinblue-js"))return;var e=document.createElement("script");e.type="text/javascript";e.id="sendinblue-js";e.async=true;e.src=("https:"===document.location.protocol?"https://":"http://")+"s.sib.im/automation.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)};window.sendinblue.SNIPPET_VERSION="1.0";window.sendinblue.load();window.sendinblue.client_key="uax6d1uu3wj6qfubdzckb";window.sendinblue.page();
    	</script>	
    	<?php
    } 

    Is there a way to place this code just before the close tag /head ?
    Thanks for help.

    #1349563
    Thai
    Moderator

    Hi There,

    The code is currently before the close </head> tag.

    Did you mean the close </body> tag?

    Thanks.

    #1349596
    Simon
    Participant

    Thank you for your response Thai.

    As you can see on the capture there are some elements between this script and the closing tag /head

    Outside one of these script prevents the automation of Sendinblue. That’s why I would like to see him in last position.

    Thank you in advance !

    #1349625
    Thai
    Moderator

    So please try updating the code to this:

    add_action( 'wp_head', 'add_custom_script', 999 );
    function add_custom_script(){
    	?>
    	<script type="text/javascript">
    	window.sendinblue=window.sendinblue||[];window.sendinblue.methods=["identify","init","group","track","page","trackLink"];window.sendinblue.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);window.sendinblue.push(t);return window.sendinblue}};for(var i=0;i<window.sendinblue.methods.length;i++){var key=window.sendinblue.methods[i];window.sendinblue[key]=window.sendinblue.factory(key)}window.sendinblue.load=function(){if(document.getElementById("sendinblue-js"))return;var e=document.createElement("script");e.type="text/javascript";e.id="sendinblue-js";e.async=true;e.src=("https:"===document.location.protocol?"https://":"http://")+"s.sib.im/automation.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)};window.sendinblue.SNIPPET_VERSION="1.0";window.sendinblue.load();window.sendinblue.client_key="uax6d1uu3wj6qfubdzckb";window.sendinblue.page();
    	</script>	
    	<?php
    }

    Let us know how it goes!

    #1349687
    Simon
    Participant

    I will test this and make you a return as soon as possible.

    thank you Thai.

    #1349695
    Thai
    Moderator

    Let us know how it goes!

  • <script> jQuery(function($){ $("#no-reply-1203538 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>