Skip to content

Commit f98437f

Browse files
authored
Merge pull request #36010 from chalin/chalin-im-use-ga4-id-2022-08-16
Google analytics: use GA4 site tag
2 parents 9401ab7 + 3db01bf commit f98437f

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ anchor = "smart"
117117

118118
[services]
119119
[services.googleAnalytics]
120-
# Comment out the next line to disable GA tracking. Also disables the feature described in [params.ui.feedback].
120+
# Fake ID in support of [params.ui.feedback]. The real GA ID is set in the Netlify config.
121121
id = "UA-00000000-0"
122122

123123
[params]

layouts/partials/head.html

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@
66
{{- else -}}
77
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
88
{{- end -}}
9-
{{- if in (slice "production" "nonprod") hugo.Environment -}}
10-
<!-- Global site tag (gtag.js) - Google Analytics -->
11-
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-36037335-10"></script>
12-
<script>
13-
window.dataLayer = window.dataLayer || [];
14-
function gtag(){dataLayer.push(arguments);}
15-
gtag('js', new Date());
16-
17-
gtag('config', 'UA-36037335-10');
18-
</script>
19-
{{- end -}}
209

2110
<!-- alternative translations -->
2211
{{ range .Translations -}}
@@ -36,7 +25,7 @@
3625
{{- template "_internal/schema.html" . -}}
3726
{{- template "_internal/twitter_cards.html" . -}}
3827
{{- if hugo.IsProduction -}}
39-
{{ template "_internal/google_analytics_async.html" . }}
28+
{{ template "_internal/google_analytics.html" . }}
4029
{{ end }}
4130
{{ partialCached "head-css.html" . "asdf" }}
4231
<script

0 commit comments

Comments
 (0)