feat: add blocks to gtag snippet

This commit is contained in:
Sergey Motornyuk 2023-06-14 15:29:36 +03:00
parent ef084a2a60
commit 913908fc61
1 changed files with 24 additions and 14 deletions

View File

@ -1,16 +1,26 @@
<!-- Google tag (gtag.js) --> {% block main %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{googleanalytics_id}}"></script> <!-- Google tag (gtag.js) -->
<script> <script async src="https://www.googletagmanager.com/gtag/js?id={{googleanalytics_id}}"></script>
window.dataLayer = window.dataLayer || []; <script>
function gtag(){dataLayer.push(arguments);} window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('set', 'linker', ); {% block setup %}
gtag('js', new Date()); gtag('set', 'linker');
gtag('config', '{{googleanalytics_id}}', { gtag('js', new Date());
anonymize_ip: true,
linker: { gtag('config', '{{googleanalytics_id}}', {
domains: {{ googleanalytics_linked_domains|tojson }} anonymize_ip: true,
} linker: {
}); domains: {{ googleanalytics_linked_domains|tojson }}
</script> }
});
{% endblock setup %}
{% block extra %}
{% endblock extra %}
</script>
{% endblock %}