Adding Javascript to all pages - script not working

I have added the following javascript to the custom JS box in the muffin options layout > custom css & js :

<!--Add the following script at the bottom of the web page (before </body></html>)-->
<script type="text/javascript" defer="defer" src="https://mylivechat.com/chatinline.aspx?hccid=14105379"></script>

This appears to not work, maybe its to do with it not being placed directly before </body></html> as requested (there is about 50 lines of code between the code above and the </body></html> 

Here is a section of source code from the page in which it appears :

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

//]]>
</script>

50 LINES OF CODE HERE

</body>
</html>
All that appears on the page is: //]]>
Hope someone can help me with this

Custom CSS & JS

Comments

  • Hi,

    this won`t work because code from custom JS section is placed in header. But if you want to place code before end of </body>, then use "Google Remarketing" field in Theme options > Getting started > General section.
  • Hi , I want to  place  some js code in 'custom js'  and use it on another page.

    The code is like
    var aAllDays = new Array( 
    "2017-05-05,17:30",
    "2017-05-16,18:00",
    "2017-06-02,17:30",
    "2017-06-20,18:00",
    "2017-07-20,18:00",
    "2017-08-20,18:00"
    )
    var strLocal = "de-DE";
    // de-DE oder en-GB oder fr-FR etc locale

    var strNow = new Date();
    strNow = Date.now();

    var aDate = strNow.split("-");
    objNow = new Date(aDate[0],aDate[1]-1,aDate[2]);

  • @ckett We have section for JS and it's BeTheme Options > Custom CSS & JS  > Custom JS section but please notice that some codes won't work from that section and in some cases it is necessary do modify theme files. Also, please notice that customization are not included and this was explained in Item Support Policy:

    Item support does not include services to modify or extend the item beyond the original features, style and functionality described on the item page. For customization services that will help you tailor the item to your specific requirements, we recommend contacting the author to see if they privately offer paid customisation services or checking out the great service providers on Envato Studio.
  • I can change the page code, it work in other websites, but will a BeTheme Update work then ?
  • ( modify the theme file for the page )
  • Yes, files would change with the update of course and that's why you can use child theme instead.
  • edited March 2018
    Why is it that when I place any script into Appearance > BeTheme Options > Custom CSS & JS > JS, I get an extra bit of code beneath my footer?: 

    This happens no matter what script I paste into this field.
  • maxiwalker
    This happens mostly to users that paste the google analytics code not correctly.
    Please check the code you have pasted again.
    thanks
  • edited March 2018
    We currently have the Google Analytics for WordPress by MonsterInsights plugin installed on our site, so our GA tracking code is not placed into the Appearance > BeTheme Options > SEO > General > Google Analytics field. 
    Could that plugin be causing the issue? 
  • Can you please send a link to your page so we can inspect the code and the console. You only use google analytics or did you insert more scripts?
    thanks
Sign In or Register to comment.