Skip to content

Commit

Permalink
Merge pull request #12 from jobcespedes/patch1
Browse files Browse the repository at this point in the history
Piwi code  injected in head section since amd method was not working.
  • Loading branch information
bmbrands authored Apr 3, 2019
2 parents f1097cb + ce83433 commit 247b883
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion classes/api/piwik.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static function insert_tracking() {
}

if (self::should_track()) {
$OUTPUT->render_from_template('local_analytics/piwik', $template);
$CFG->additionalhtmlhead .= $OUTPUT->render_from_template('local_analytics/piwik', $template);
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions templates/piwik.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
Example context (json):
{ "siteid": UA-90210-15, "addition": 2, }
}}

<!-- Start Piwik Code -->
{{#imagetrack}}
<noscript>
Expand All @@ -41,9 +40,7 @@
</p>
</noscript>
{{/imagetrack}}
<!-- End Piwik Code -->

{{#js}}
<script type="text/javascript">
var _paq = _paq || [];
{{{doctitle}}}
{{#userid}}
Expand All @@ -59,4 +56,5 @@ _paq.push(['enableHeartBeatTimer', 30]);
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);
})();
{{/js}}
</script>
<!-- End Piwik Code -->

0 comments on commit 247b883

Please sign in to comment.