a new start
This commit is contained in:
42
_includes/my-body.html
Normal file
42
_includes/my-body.html
Normal file
@@ -0,0 +1,42 @@
|
||||
{% comment %}
|
||||
<!--
|
||||
Example code for using Matamo as alternative analytics solution.
|
||||
-->
|
||||
{% if site.matomo_analytics %}
|
||||
<script>
|
||||
var _paq = _paq || [];
|
||||
|
||||
{% if site.matomo_analytics.no_cookies %}
|
||||
_paq.push(['disableCookies']);
|
||||
{% endif %}
|
||||
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
_paq.push(['setTrackerUrl', u+'piwik.php']);
|
||||
_paq.push(['setSiteId', '{{site.matomo_analytics.site_id}}']);
|
||||
|
||||
var pushStateEl = document.getElementById('_pushState');
|
||||
var timeStartLoadPage, referer, timeItTookToLoadPage;
|
||||
|
||||
pushStateEl.addEventListener('hy-push-state-start', function() {
|
||||
timeStartLoadPage = new Date().getTime();
|
||||
referer = window.location.toString();
|
||||
});
|
||||
|
||||
pushStateEl.addEventListener('hy-push-state-ready', function() {
|
||||
timeItTookToLoadPage = new Date().getTime() - timeStartLoadPage;
|
||||
});
|
||||
|
||||
pushStateEl.addEventListener('hy-push-state-after', function() {
|
||||
_paq.push(['setReferrerUrl', referer]);
|
||||
_paq.push(['setCustomUrl', window.location.toString()]);
|
||||
_paq.push(['setDocumentTitle', document.title]);
|
||||
_paq.push(['deleteCustomVariables', 'page']);
|
||||
_paq.push(['setGenerationTimeMs', timeItTookToLoadPage]);
|
||||
_paq.push(['trackPageView']);
|
||||
});
|
||||
|
||||
window.loadJSDeferred('{{site.matomo_analytics.root}}piwik.js');
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endcomment %}
|
||||
Reference in New Issue
Block a user