ga.html 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. {% if GOOGLE_ANALYTICS %}
  2. <!-- Google Analytics -->
  3. <script type="text/javascript">
  4. var _gaq = _gaq || [];
  5. _gaq.push(['_setAccount', '{{ GOOGLE_ANALYTICS }}']);
  6. _gaq.push(['_trackPageview']);
  7. (function () {
  8. var ga = document.createElement('script');
  9. ga.type = 'text/javascript';
  10. ga.async = true;
  11. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  12. var s = document.getElementsByTagName('script')[0];
  13. s.parentNode.insertBefore(ga, s);
  14. })();
  15. </script>
  16. <!-- End Google Analytics Code -->
  17. {% endif %}
  18. {% if GOOGLE_ANALYTICS_UNIVERSAL %}
  19. <!-- Google Analytics Universal -->
  20. <script type="text/javascript">
  21. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  22. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  23. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  24. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  25. ga('create', '{{ GOOGLE_ANALYTICS_UNIVERSAL }}', '{{ GOOGLE_ANALYTICS_UNIVERSAL_PROPERTY }}');
  26. ga('send', 'pageview');
  27. </script>
  28. <!-- End Google Analytics Universal Code -->
  29. {% endif %}