28 lines
1.1 KiB
HTML
28 lines
1.1 KiB
HTML
{%- if site.ga and site.ga.account %}
|
|
<!-- Google Analytics -->
|
|
{% comment %} should be the first script in the HEAD section {%- endcomment -%}
|
|
<script>
|
|
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
|
ga('create', '{{ site.ga.account }}', 'auto');{% if site.ga.anonymizeip %}
|
|
ga('set', 'anonymizeIp', true);{% endif %}
|
|
ga('send', 'pageview');
|
|
</script>
|
|
<script async src='https://www.google-analytics.com/analytics.js'></script>
|
|
<script>
|
|
var trackOutboundLink = function(targetName, targetUrl) {
|
|
if (ga.loaded) {
|
|
ga('send', 'event', 'outbound', 'click', targetName, {
|
|
'transport': 'beacon',
|
|
'hitCallback': function(){ document.location = targetUrl; }
|
|
});
|
|
} else {
|
|
document.location = targetUrl;
|
|
}
|
|
}
|
|
</script>
|
|
{%- endif %}
|
|
|
|
{%- if site.plausible and site.plausible.domain %}
|
|
<script async defer data-domain="{{ site.plausible.domain }}" src="https://plausible.io/js/plausible.outbound-links.js"></script>
|
|
{%- endif -%}
|