diff options
author | Sarah German <sgerman@gitlab.com> | 2023-06-01 16:45:27 +0300 |
---|---|---|
committer | Sarah German <sgerman@gitlab.com> | 2023-06-01 16:45:27 +0300 |
commit | 0f498c6a942561b4625512a132f35a0f550bf72e (patch) | |
tree | 9763f577a0c26d36a5694547706bcc15b41fbc87 | |
parent | 5c8218d0466d4de465207cce5978408b79d3e624 (diff) | |
parent | 1e13a21da7183b1ae8dc92d2beeaad99935b4948 (diff) |
Merge branch 'cherry-pick-69942af7-3' into '15.8'15.8
Load the analytics only in the main site (15.8 backport)
See merge request https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/3903
Merged-by: Sarah German <sgerman@gitlab.com>
Approved-by: Sarah German <sgerman@gitlab.com>
-rw-r--r-- | layouts/404.html | 4 | ||||
-rw-r--r-- | layouts/analytics.html | 2 | ||||
-rw-r--r-- | layouts/default.html | 4 | ||||
-rw-r--r-- | layouts/gtm.html | 2 | ||||
-rw-r--r-- | layouts/head.html | 4 | ||||
-rw-r--r-- | layouts/home.html | 4 | ||||
-rw-r--r-- | layouts/search.html | 4 |
7 files changed, 10 insertions, 14 deletions
diff --git a/layouts/404.html b/layouts/404.html index f638d150..73677a4b 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -17,9 +17,7 @@ </section> <script src="<%= @items['/frontend/shared/global_imports.*'].path %>"></script> - <% if production? %> <%# Add analytics only in production %> - <%= render '/analytics.*' %> - <% end %> + <%= render '/analytics.*' %> </body> </html> diff --git a/layouts/analytics.html b/layouts/analytics.html index 3f8a9985..f18097f5 100644 --- a/layouts/analytics.html +++ b/layouts/analytics.html @@ -1,3 +1,4 @@ +<% if production_and_default_branch? %> <!-- Facebook --> <script src="<%= @items['/assets/javascripts/facebook_analytics.*'].path %>"></script> <noscript><img height="1" width="1" style="display:none" @@ -19,3 +20,4 @@ src="https://www.facebook.com/tr?id=1689559637958103&ev=PageView&noscript=1" <noscript> <img height="1" width="1" style="display:none;" alt="" src="https://dc.ads.linkedin.com/collect/?pid=30694&fmt=gif" /> </noscript> +<% end %> diff --git a/layouts/default.html b/layouts/default.html index b5684b6d..32b9859f 100644 --- a/layouts/default.html +++ b/layouts/default.html @@ -107,10 +107,8 @@ <script src="<%= @items['/frontend/default/mermaid.*'].path %>"></script> <% end %> - <% if production? %> <%# Add analytics only in production %> - <%= render '/analytics.*' %> - <% end %> + <%= render '/analytics.*' %> <% if @item.identifier.to_s == '/ee/update/deprecations.md' %> <script src="<%= @items['/frontend/deprecations/deprecations.*'].path %>"></script> <% end %> diff --git a/layouts/gtm.html b/layouts/gtm.html index 3361f413..bbeb2c59 100644 --- a/layouts/gtm.html +++ b/layouts/gtm.html @@ -1,4 +1,4 @@ -<% if production? and ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] %> +<% if production_and_default_branch? %> <%# Adds GTM only in production // leave this immediately after the opening the body tag%> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NJXWQL" diff --git a/layouts/head.html b/layouts/head.html index dea9c913..804dd0bc 100644 --- a/layouts/head.html +++ b/layouts/head.html @@ -44,7 +44,6 @@ <link rel="stylesheet" href="<%= @items['/assets/stylesheets/font-awesome.min.*'].path %>"> <% if production? %> - <%# Adds GTM only in production %> <!-- OneTrust Cookies Consent Notice start --> <script src="https://cdn.cookielaw.org/consent/7f944245-c5cd-4eed-a90e-dd955adfdd08/OtAutoBlock.js"></script> <script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" charset="UTF-8" data-domain-script="7f944245-c5cd-4eed-a90e-dd955adfdd08"></script> @@ -52,7 +51,10 @@ function OptanonWrapper() { } </script> <!-- OneTrust Cookies Consent Notice end --> +<% end %> +<% if production_and_default_branch? %> + <%# Adds GTM only in production %> <!-- Google Tag Manager --> <script src="<%= @items['/assets/javascripts/google_tagmanager.*'].path %>"></script> <!-- End Google Tag Manager --> diff --git a/layouts/home.html b/layouts/home.html index c573033d..848e4f10 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -8,10 +8,8 @@ <%= render '/gtm.*' %> <%= render '/header.*' %> <%= yield %> - <% if production? and ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] %> <%# Add analytics only in production %> - <%= render '/analytics.*' %> - <% end %> + <%= render '/analytics.*' %> <%= render '/schema-microdata.*' %> <script src="<%= @items['/frontend/header/index.*'].path %>"></script> <script src="<%= @items['/frontend/shared/global_imports.*'].path %>"></script> diff --git a/layouts/search.html b/layouts/search.html index 9d33e0b8..e5be9567 100644 --- a/layouts/search.html +++ b/layouts/search.html @@ -31,10 +31,8 @@ <script src="<%= @items['/frontend/shared/global_imports.*'].path %>"></script> <script src="<%= @items['/frontend/header/index.*'].path %>"></script> - <% if production? %> <%# Add analytics only in production %> - <%= render '/analytics.*' %> - <% end %> + <%= render '/analytics.*' %> <%= render '/schema-microdata.*' %> </body> </html> |