Website down by adding some code!!!

Discussion in 'General Chat' started by peter3217, Apr 2, 2019.

  1. peter3217

    peter3217 New Member

    Hello guys!
    I'm just wonderinh why is my website down if I add some code to layout.tpl? I tried to add google analytics code and yandex metrika code. Both times the website went down till i deleted the code. For google I use the plugin now, but what to do with the code for yandex metrika?
    Code (Text):
    <!-- Yandex.Metrika counter -->
    <script type="text/javascript">
    (function (d, w, c) {
    (w[c] = w[c] || []).push(function() {
    try {
    w.yaCounter21387256 = new Ya.Metrika({id:21387256,
    webvisor:true,
    clickmap:true,
    trackLinks:true,
    accurateTrackBounce:true});
    } catch(e) { }
    });

    var n = d.getElementsByTagName("script")[0],
    s = d.createElement("script"),
    f = function () { n.parentNode.insertBefore(s, n); };
    s.type = "text/javascript";
    s.async = true;
    s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";

    if (w.opera == "[object Opera]") {
    d.addEventListener("DOMContentLoaded", f, false);
    } else { f(); }
    })(document, window, "yandex_metrika_callbacks");
    </script>
    <noscript><div><img src="//mc.yandex.ru/watch/21387256" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
    <!-- /Yandex.Metrika counter -->
  2. Vasily_B.

    Vasily_B. Project Manager

    Hi,

    Try to wrap your code in {literal}your code here{/literal}. It's Smarty code so { } brackets might add some problems.
    You should also add this code using config section, it has some areas to put your code in header / footer part of your pages.

    Cheers

Share This Page