<% if (theme.web_analytics.enable) { %>

  <% if(theme.web_analytics.baidu) { %>
    <!-- Baidu Analytics -->
    <script defer>
      var _hmt = _hmt || [];
      (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?<%= theme.web_analytics.baidu %>";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
  <% } %>

  <% if (theme.web_analytics.google){ %>
    <!-- Google Analytics -->
    <script defer>
      (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', '<%= theme.web_analytics.google %>', 'auto');
      ga('send', 'pageview');
    </script>
  <% } %>

  <% if(theme.web_analytics.tencent && theme.web_analytics.tencent.sid && theme.web_analytics.tencent.cid) { %>
    <!-- Tencent Analytics -->
    <script defer>
      var _mtac = {};
      (function () {
        var mta = document.createElement("script");
        mta.src = "//pingjs.qq.com/h5/stats.js?v2.0.4";
        mta.setAttribute("name", "MTAH5");
        mta.setAttribute("sid", "<%= theme.web_analytics.tencent.sid %>");
        <% if(theme.web_analytics.tencent.cid) { %>
        mta.setAttribute("cid", "<%= theme.web_analytics.tencent.cid %>");
        <% } %>
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(mta, s);
      })();
    </script>
  <% } %>

  <% if(theme.web_analytics.tajs) { %>
    <!-- tajs Analytics -->
    <script defer type="text/javascript" src="//tajs.qq.com/stats?sId=<%= theme.web_analytics.tajs %>" charset="UTF-8"></script>
  <% } %>

  <% if(theme.web_analytics.woyaola) { %>
    <!-- 51.la Analytics -->
    <script defer type="text/javascript" src="//js.users.51.la/<%= theme.web_analytics.woyaola %>.js"></script>
  <% } %>

  <% if(theme.web_analytics.cnzz) { %>
    <!-- cnzz Analytics -->
    <script defer src="//s4.cnzz.com/z_stat.php?id=<%- theme.web_analytics.cnzz %>&show=pic"
            type="text/javascript"></script>
  <% } %>
<% } %>
