Browse Source

ajout de analytics pour le suivi piwik au theme

master
Victor 7 years ago
parent
commit
8a63679ece
3 changed files with 52 additions and 1 deletions
  1. +4
    -0
      theme/static/css/custom.css
  2. +46
    -0
      theme/templates/analytics.html
  3. +2
    -1
      theme/templates/base.html

+ 4
- 0
theme/static/css/custom.css View File

@ -9,3 +9,7 @@
.article-content {
max-width: none !important;
}
pre {
word-break: break-all;
}

+ 46
- 0
theme/templates/analytics.html View File

@ -0,0 +1,46 @@
{% 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://ssl.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>
{% endif %}

+ 2
- 1
theme/templates/base.html View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% if article and article.author %}
@ -102,6 +102,7 @@
</script>
{% endblock script %}
{% include '_includes/stat_counter.html' %}
{% include 'analytics.html' %}
</body>
<!-- Theme: Elegant built for Pelican
License : http://oncrashreboot.com/pelican-elegant -->

Loading…
Cancel
Save