Custom JS being stripped out.
-
Trying to add this to our custom global JS section
<!-- Start of LiveChat (www.livechatinc.com) code -->
<script type="text/javascript">
window.__lc = window.__lc || {};
window.__lc.license = 9014905;
(function() {
var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
})();
</script>
<noscript>
<a href="https://www.livechatinc.com/chat-with/9014905/" rel="nofollow">Chat with us</a>,
powered by <a href="https://www.livechatinc.com/?welcome" rel="noopener nofollow" target="_blank">LiveChat</a>
</noscript>
<!-- End of LiveChat code -->
But the theme keep stripping out the key parts and <script> closing tags making it not work..
Where else can we add custom code properly?
Hello,
You don’t need to wrap JS code with <script>
tags if you want to use our custom JS section.
Kind Regards
But most 3rd party code comes like this already with start and end tags and <noscript> tags which are required.
Your custom JS box is not flexible enough to detect this.
Our code is dedicated to native JS and not to HTML. <noscript>
is an HTML tag. In your case, you need to use other tool to add your custom code. Check this plugin for example https://wordpress.org/plugins/insert-headers-and-footers/
Ok It would be a good idea if the theme had native place to put Google Analytics code and other tracking codes in to theme options without need to install a new plugin ! please
It may be a good idea but it is not allowed by ThemeForest theme requirements since it is a “Plugin territory functionality” https://help.author.envato.com/hc/en-us/articles/360000481223-WordPress-Theme-Plugin-Requirements