Insert analytics and disqus script
This commit is contained in:
parent
52386a8689
commit
91293c7d41
45
templates/analytics.html
Normal file
45
templates/analytics.html
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{% if GOOGLE_ANALYTICS %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
var _gaq = _gaq || [];
|
||||||
|
_gaq.push(['_setAccount', '{{GOOGLE_ANALYTICS}}']);
|
||||||
|
_gaq.push(['_trackPageview']);
|
||||||
|
(function() {
|
||||||
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||||
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||||
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
{% if GAUGES %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
var _gauges = _gauges || [];
|
||||||
|
(function() {
|
||||||
|
var t = document.createElement('script');
|
||||||
|
t.type = 'text/javascript';
|
||||||
|
t.async = true;
|
||||||
|
t.id = 'gauges-tracker';
|
||||||
|
t.setAttribute('data-site-id', '{{GAUGES}}');
|
||||||
|
t.src = '//secure.gaug.es/track.js';
|
||||||
|
var s = document.getElementsByTagName('script')[0];
|
||||||
|
s.parentNode.insertBefore(t, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
{% if PIWIK_URL and PIWIK_SITE_ID %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
{% if PIWIK_SSL_URL %}
|
||||||
|
var pkBaseURL = "{{ PIWIK_SSL_URL }}";
|
||||||
|
{% else %}
|
||||||
|
var pkBaseURL = "{{ PIWIK_URL }}";
|
||||||
|
{% endif %}
|
||||||
|
var _paq = _paq || [];
|
||||||
|
_paq.push(["trackPageView"]);
|
||||||
|
_paq.push(["enableLinkTracking"]);
|
||||||
|
(function() {
|
||||||
|
var u=(("https:" == document.location.protocol) ? "https" : "http")+"://"+pkBaseURL+"/";
|
||||||
|
_paq.push(["setTrackerUrl", u+"piwik.php"]);
|
||||||
|
_paq.push(["setSiteId", "{{ PIWIK_SITE_ID }}"]);
|
||||||
|
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
|
||||||
|
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
|
||||||
|
})();
|
||||||
|
</script>
|
|
@ -164,6 +164,8 @@
|
||||||
<!-- Custom Theme JavaScript -->
|
<!-- Custom Theme JavaScript -->
|
||||||
<script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/js/clean-blog.min.js"></script>
|
<script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/js/clean-blog.min.js"></script>
|
||||||
|
|
||||||
|
{% include 'analytics.html' %}
|
||||||
|
{% include 'disqus_script.html' %}
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
11
templates/disqus_script.html
Normal file
11
templates/disqus_script.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{% if DISQUS_SITENAME %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
var disqus_shortname = '{{ DISQUS_SITENAME }}';
|
||||||
|
(function () {
|
||||||
|
var s = document.createElement('script'); s.async = true;
|
||||||
|
s.type = 'text/javascript';
|
||||||
|
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
|
||||||
|
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
||||||
|
}());
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
Loading…
Reference in New Issue
Block a user