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

Use GA 4 #2757

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ title = "Chef Web Docs"
theme = "docs-new"
enableGitInfo = true
pluralizeListTitles = false
googleAnalytics = "G-2L57JLVKNZ"

# We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below).
disableAliases = true
Expand Down
3 changes: 1 addition & 2 deletions themes/docs-new/assets/js/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ function thanksFeedback(button){
const sendFeedback = (value) => {
if (typeof ga !== 'function') return;
const args = {
command: 'send',
hitType: 'event',
category: 'Feedback Buttons',
action: 'click',
Expand All @@ -40,4 +39,4 @@ noButton.addEventListener('click', () => {
thanksFeedback(noButton);
disableButtons();
sendFeedback(0);
});
});
2 changes: 1 addition & 1 deletion themes/docs-new/layouts/_default/data-api.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{{ $.Page.Params.style_sheet }}">
{{ if eq (getenv "HUGO_ENV") "production" }}
{{ template "_internal/google_analytics.html" . }}
{{ partial "gtag.html" . }}
{{ end }}
</head>
<body>
Expand Down
11 changes: 11 additions & 0 deletions themes/docs-new/layouts/partials/gtag.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ with .Site.GoogleAnalytics }}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2L57JLVKNZ"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-2L57JLVKNZ');
</script>
{{ end }}
6 changes: 3 additions & 3 deletions themes/docs-new/layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<head>
{{ if eq (getenv "HUGO_ENV") "production" }}
{{ partial "gtag.html" . }}
{{ end }}
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand All @@ -8,7 +11,4 @@
{{ $options := (dict "includePaths" (slice "node_modules")) }}
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }}
<link rel="stylesheet" href="{{ $style.Permalink }}" />
{{ if eq (getenv "HUGO_ENV") "production" }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}
</head>