mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-12 21:03:32 -06:00
analytics: support multiple tracking IDs, document UA -> GA4 switch (#1029)
* Issue #1023 - note that GA4 properties are supported * Issue #1023 - parameterize Google Analytics property script * Issue #1023 - support a list of multiple Google Analytics tracking IDs in config * Issue #1023 - update Google Analytics configuration doc * Fix configuration of multiple Google Analytics properties and simplify type checking * simplify unnecessary code repetition * tweak Google Analytics config documentation wording
This commit is contained in:
committed by
GitHub
parent
b799ea8eaf
commit
9bccf07faa
@@ -5,15 +5,17 @@
|
||||
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-default.css' | relative_url }}">
|
||||
|
||||
{% if site.ga_tracking != nil %}
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.ga_tracking }}"></script>
|
||||
{% assign ga_tracking_ids = site.ga_tracking | split: "," %}
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ ga_tracking_ids.first }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '{{ site.ga_tracking }}'{% unless site.ga_tracking_anonymize_ip == nil %}, { 'anonymize_ip': true }{% endunless %});
|
||||
{% for ga_property in ga_tracking_ids %}
|
||||
gtag('config', '{{ ga_property }}'{% unless site.ga_tracking_anonymize_ip == nil %}, { 'anonymize_ip': true }{% endunless %});
|
||||
{% endfor %}
|
||||
</script>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if site.search_enabled != false %}
|
||||
|
Reference in New Issue
Block a user