Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Merge pull request #3244 from gratipay/piwik-trial
Browse files Browse the repository at this point in the history
add Piwik tracking code
  • Loading branch information
Changaco committed Mar 12, 2015
2 parents c73056a + e70cd9e commit fa5a017
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions defaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ CHECK_DB_EVERY=600
DEQUEUE_EMAILS_EVERY=60
GOOGLE_ANALYTICS_ID=
OPTIMIZELY_ID=
INCLUDE_PIWIK=no
SENTRY_DSN=
LOG_METRICS=0

Expand Down
2 changes: 2 additions & 0 deletions gratipay/wireup.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ def asset(path):

website.google_analytics_id = env.google_analytics_id
website.optimizely_id = env.optimizely_id
website.include_piwik = env.include_piwik

website.log_metrics = env.log_metrics

Expand Down Expand Up @@ -364,6 +365,7 @@ def env():
OPTIMIZELY_ID = unicode,
SENTRY_DSN = unicode,
LOG_METRICS = is_yesish,
INCLUDE_PIWIK = is_yesish,
MANDRILL_KEY = unicode,
RAISE_SIGNIN_NOTIFICATIONS = is_yesish,

Expand Down
18 changes: 18 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@
ga('send', 'pageview');
</script>
{% endif %}

{% if website.include_piwik and request.headers.get('DNT') != '1' %}
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//gratipay.piwik.pro/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
{% endif %}
</head>
{% set homepage = request.path.raw == '/' %}
<body id="{{ 'homepage' if homepage and user.ANON }}">
Expand Down Expand Up @@ -117,5 +132,8 @@ <h1><a href="/"><img src="{{ website.asset('gratipay.svg') }}"

{% block scripts %}{% endblock %}

{% if website.include_piwik and request.headers.get('DNT') != '1' %}
<noscript><img src="//gratipay.piwik.pro/piwik.php?idsite=1" style="border:0;" alt="" /></noscript>
{% endif %}
</body>
</html>

0 comments on commit fa5a017

Please sign in to comment.