Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty googleanalytics.id support #16

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
{% block main %}
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{googleanalytics_id}}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
{% if googleanalytics_id and googleanalytics_id != 'ODC_GOOGLE_ANALYTICS_ID' %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{googleanalytics_id}}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}

{% block setup %}
gtag('set', 'linker');
{% block setup %}
gtag('set', 'linker');

gtag('js', new Date());
gtag('js', new Date());

gtag('config', '{{googleanalytics_id}}', {
anonymize_ip: true,
linker: {
domains: {{ googleanalytics_linked_domains|tojson }}
}
});
{% endblock setup %}
gtag('config', '{{googleanalytics_id}}', {
anonymize_ip: true,
linker: {
domains: {{ googleanalytics_linked_domains|tojson }}
}
});
{% endblock setup %}

{% block extra %}
{% endblock extra %}
{% block extra %}
{% endblock extra %}

</script>
</script>
{% endif %}

{% with measurement_id = h.googleanalytics_opendata_measurement_id() %}
{% if measurement_id %}
Expand Down
Loading