mirror of
https://github.com/docker/docs.git
synced 2026-03-27 22:38:54 +07:00
Move Google Analytics to include, and prepare for making it optional
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -15,6 +15,11 @@ lsi: false
|
||||
keep_files: ["v17.06", "v18.03", "v18.09"]
|
||||
exclude: ["_scripts", "tests", "apidocs/layouts", "Gemfile", "hooks", "index.html", "404.html"]
|
||||
|
||||
# Google Analytics, etc.
|
||||
# TODO these should only be set when building for production, or passed as an environment variable when building
|
||||
google_analytics: GTM-WL2QLG5
|
||||
|
||||
|
||||
# Component versions -- address like site.docker_ce_version
|
||||
# You can't have - characters in these for non-YAML reasons
|
||||
|
||||
|
||||
7
_includes/analytics/google_analytics.html
Normal file
7
_includes/analytics/google_analytics.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{% if include.GOOGLE_ID and include.GOOGLE_ID != '' %}<!-- Google Tag Manager -->
|
||||
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','{{ include.GOOGLE_ID }}');</script>
|
||||
{% else %}<!-- No Google Analytics ID configured, Google Tag Manager is disabled -->{% endif %}
|
||||
@@ -16,13 +16,7 @@
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<!-- Google Tag Manager -->
|
||||
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-WL2QLG5');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
{% if site.google_analytics != '' %}{% include analytics/google_analytics.html GOOGLE_ID=site.google_analytics %}{% endif %}
|
||||
{% if site.GH_ENV == "gh_pages" %}
|
||||
<meta name="robots" content="noindex">{% endif %}
|
||||
<!-- favicon -->
|
||||
|
||||
Reference in New Issue
Block a user