Custom Code Not Working



  • I’ve just added my Google Analytics code to the new “Add extra JavaScript to your pages” part of the custom code section, but it’s not showing up on the website.

    I’ve cleared the cache. Is there anything else I need to do or is this not working properly?



  • Can you take a screenshot of how you added it? I take it as you removed the extra script wrapper, right? Is it displaying in the front?
    You can share a url if you have it on a server



  • @Nemo I just added the full code provided by Google Analytics which was:

    <script type=“text/javascript”><!–//–><![CDATA[//><!–
    (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-xxxxxx-xx’, ‘auto’);
    ga(‘send’, ‘pageview’);
    //–><!]]></script>

    No, it’s not appearing in the front.



  • Right, the script tag must be removed, I guess we will implement a free html box as well, or parse the js one so that they are automatically removed

    What you need to use is just this

    <!–//–><![CDATA[//><!–
    (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-xxxxxx-xx’, ‘auto’);
    ga(‘send’, ‘pageview’);
    //–><!]]>



  • Thanks, but that didn’t work either. I checked the Google Analytics code again and actually it should be like this:

    (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-XXXXXX-XX’, ‘auto’);
    ga(‘send’, ‘pageview’);

    So I put that in without any script tags and it still won’t work.



  • You have to wait before google picks it up, try again tomorrow with the last you posted



  • But it’s not even in the source code when I view the page.

    I just added the code manually to the footer.tpl and now it is working.



  • THat’s very odd, we will have it checked. I take it as it’s saving and retaining the value in the back office, correct? I wonder if someone accidentally broke the functionality in the front. Are you using the latest build or?



  • Yes, it is saving and retaining the value. First of all it was displaying errors but as soon as I removed the script tags as you suggested, the errors disappeared. But the tracking code would never appear on the front.

    I’m using 1.0.0




 

Looks like your connection to thirty bees forum was lost, please wait while we try to reconnect.