fixes #1 - add piwik tracking code
This commit is contained in:
parent
6a3167d461
commit
a1e4f625fc
3 changed files with 36 additions and 8 deletions
|
@ -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);
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -25,5 +25,27 @@
|
|||
</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>
|
Reference in a new issue