1
0
Fork 0

fixes #1 - add piwik tracking code

This commit is contained in:
Lukas Winkler 2017-09-21 20:08:57 +02:00
parent 6a3167d461
commit a1e4f625fc
3 changed files with 36 additions and 8 deletions

View file

@ -38,3 +38,9 @@ define('DEBUG_ENABLED', false);
* see https://github.com/piwik/github-issues-mirror/issues/5
*/
define('FORBIDDEN_EXTENSIONS', ['swf', 'js', 'htm']);
/**
* If you want to enable piwik tracking enter the URL to your piwik instance and the ID of the website here
*/
define('PIWIK_URL', false);
define('PIWIK_ID', false);

View file

@ -36,11 +36,11 @@ $container['view'] = function ($container) {
helpers\Twig::setDateFormat($twig);
helpers\Twig::registerFilter($twig);
$view->getEnvironment()->addGlobal('projectName', PROJECT_NAME);
$view->getEnvironment()->addGlobal('githubOrganization', GITHUB_ORGANIZATION);
$view->getEnvironment()->addGlobal('githubRepository', GITHUB_REPOSITORY);
$view->getEnvironment()->addGlobal('piwikURL', PIWIK_URL);
$view->getEnvironment()->addGlobal('piwikID', PIWIK_ID);
return $view;
};

View file

@ -17,13 +17,35 @@
{% block content %}{% endblock %}
<div class="container" style="margin-bottom: 20px;">
<div class="container" style="margin-bottom: 20px;">
<div class="row">
<div class="col-md-6">
Powered by <a target="_blank" href="https://github.com/piwik/github-issues-mirror">GitHub Issue Mirror</a>
</div>
</div>
</div>
</div>
{% if piwikURL and piwikID %}
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = "{{ piwikURL }}";
_paq.push(['setTrackerUrl', u + 'piwik.php']);
_paq.push(['setSiteId', '{{ piwikID }}']);
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>
<!-- End Piwik Code -->
{% endif %}
</body>
</html>