Skip to content

Commit 5fbf70a

Browse files
antfitchparlough
andauthored
Move analytics values into variables. (#6654)
I've moved the analytics values into variables in site.yml. This now matches what we do on the Flutter side of things. --- - [x] I’ve reviewed the contributor guide and applied the relevant portions to this PR. - [x] This PR doesn't contain automatically generated corrections or text (Grammarly, LLMs, and similar). - [x] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style) — for example, it doesn't use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person). - [x] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer. <details> <summary>Contribution guidelines:</summary><br> - See our [contributor guide](https://github.com/dart-lang/site-www/blob/main/CONTRIBUTING.md) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Code changes should generally follow the [Dart style guide](https://dart.dev/effective-dart) and use `dart format`. - Updates to [code excerpts](https://github.com/dart-lang/site-shared/blob/main/packages/excerpter) indicated by `<?code-excerpt` need to be updated in their source `.dart` file as well. </details> --------- Co-authored-by: Parker Lougheed <[email protected]>
1 parent 54007dc commit 5fbf70a

File tree

7 files changed

+10
-8
lines changed

7 files changed

+10
-8
lines changed

src/_data/site.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ yt:
3535

3636
showBanner: false
3737

38+
google_analytics_id: UA-26406144-4
39+
google_tag_manager_id: GTM-5VSZM5J
40+
3841
# Increment this global og:image URL version number (used as a query parameter)
3942
# when you update any og:image file. (Also increment the corresponding number
4043
# in the `firebase.json` redirect rule.)

src/_includes/analytics.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
66
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
77

8-
ga('create', 'UA-26406144-4', 'auto');
8+
ga('create', '{{ site.google_analytics_id }}', 'auto');
99
ga('send', 'pageview');
1010

1111
</script>
12-

src/_includes/gtags.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<!-- Google Tag Manager (noscript) -->
2-
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5VSZM5J"
2+
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ site.google_tag_manager_id }}"
33
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
44
<!-- End Google Tag Manager (noscript) -->

src/_includes/head.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
1414
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
1515
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
16-
})(window,document,'script','dataLayer','GTM-5VSZM5J');</script>
16+
})(window,document,'script','dataLayer','{{ site.google_tag_manager_id }}');</script>
1717
<!-- End Google Tag Manager -->
1818
{% assign desc = description | default: site.description | strip_html | strip_newlines | truncate: 160 -%}
1919
{% unless desc and desc != '' -%}
@@ -91,5 +91,5 @@
9191

9292
<script type="module" src="https://cdn.jsdelivr.net/npm/@justinribeiro/[email protected]/lite-youtube.js" integrity="sha256-Jy0j0fUMJ2T3WxSEs2WjHLrS+3DlO7S9DItQtP55FII=" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
9393

94-
{% render 'analytics.html' -%}
94+
{% include 'analytics.html' -%}
9595
</head>

src/_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<body class="{{layout}}{% if toc %}{% if toc == false %} hide_toc{% endif %}{% endif %}{% if obsolete %}{% if obsolete == true %} obsolete{% endif %}{% endif %}{% if body_class %} {{ body_class }}{% endif %}">
1111
<a id="skip-to-main" class="filled-button" href="#site-content-title" tabindex="1">Skip to main content</a>
1212
{% render 'cookie-notice.html' %}
13-
{% render 'gtags.html' %}
13+
{% include 'gtags.html' %}
1414
{% include 'page-header.html', obsolete:obsolete %}
1515
<div id="site-below-header">
1616
<div id="site-main-row">

src/_layouts/error.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% include 'head.html' %}
44
<body class="{{layout}} hide_toc">
55
{% render 'cookie-notice.html' %}
6-
{% render 'gtags.html' %}
6+
{% include 'gtags.html' %}
77
{% include 'page-header.html' %}
88
{% include 'navigation-side.html' %}
99
<main id="page-content" class="focused">

src/_layouts/homepage.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% include 'head.html' %}
44
<body class="homepage">
55
{% render 'cookie-notice.html' %}
6-
{% render 'gtags.html' %}
6+
{% include 'gtags.html' %}
77
{% include 'page-header.html' %}
88
<div id="site-below-header">
99
<div id="site-main-row">

0 commit comments

Comments
 (0)