Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add analytics and metrika

  • Loading branch information...
commit f8bed4f30a8b213ff6b1a7c9424941044258e225 1 parent bf25923
Kirill Klenov authored
12 base/core/templates/core/base.html
@@ -17,16 +17,17 @@
17 17 {% block body_content %}
18 18
19 19 {# Navbar #}
20   - {% block navigation %}
21   - {% include 'core/blocks/nav.html' %}
22   - {% endblock %}
  20 + {% block navigation %}{% include 'core/blocks/nav.html' %}{% endblock %}
23 21
24   - {% include "core/blocks/messages.html" %}
  22 + {# Messages #}
  23 + {% block messages %}{% include "core/blocks/messages.html" %}{% endblock %}
25 24
  25 + {# Content #}
26 26 <div class="container">
27 27 {% block page_content %}{% endblock %}
28 28 </div>
29 29
  30 + {# Footer #}
30 31 {% block footer %}
31 32 <style type="text/css" media="screen">
32 33 .footer {
@@ -42,4 +43,7 @@
42 43 </footer>
43 44 {% endblock %}
44 45
  46 + {% if config.get('FOUNDATION_METRIKA') %} {% include "core/blocks/metrika.html" %} {% endif %}
  47 + {% if config.get('FOUNDATION_ANALYTICS') %} {% include "core/blocks/analytics.html" %} {% endif %}
  48 +
45 49 {% endblock %}
11 base/core/templates/core/blocks/analytics.html
... ... @@ -0,0 +1,11 @@
  1 +<script type="text/javascript">
  2 + var _gaq = _gaq || [];
  3 + _gaq.push(['_setAccount', "{{ config['FOUNDATION_ANALYTICS'] }}"]);
  4 + _gaq.push(['_trackPageview']);
  5 +
  6 + (function() {
  7 + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  8 + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  9 + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  10 + })();
  11 + </script>
23 base/core/templates/core/blocks/metrika.html
... ... @@ -0,0 +1,23 @@
  1 +<!-- Yandex.Metrika counter -->
  2 +<script type="text/javascript">
  3 +(function (d, w, c) {
  4 + (w[c] = w[c] || []).push(function() {
  5 + try {
  6 + w.yaCounter{{ config.get('FOUNDATION_METRIKA') }} = new Ya.Metrika({id:{{ config.get('FOUNDATION_METRIKA') }}, enableAll: true});
  7 + } catch(e) { }
  8 + });
  9 +
  10 + var n = d.getElementsByTagName("script")[0],
  11 + s = d.createElement("script"),
  12 + f = function () { n.parentNode.insertBefore(s, n); };
  13 + s.type = "text/javascript";
  14 + s.async = true;
  15 + s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";
  16 +
  17 + if (w.opera == "[object Opera]") {
  18 + d.addEventListener("DOMContentLoaded", f);
  19 + } else { f(); }
  20 +})(document, window, "yandex_metrika_callbacks");
  21 +</script>
  22 +<noscript><div><img src="//mc.yandex.ru/watch/{{ config.get('FOUNDATION_METRIKA') }}" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
  23 +<!-- /Yandex.Metrika counter -->

0 comments on commit f8bed4f

Please sign in to comment.
Something went wrong with that request. Please try again.