diff options
author | Sarah German <sgerman@gitlab.com> | 2023-05-31 17:50:44 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2023-05-31 21:27:47 +0300 |
commit | b250e103fd002a0c9c9b17eb2166ce3511d3bc85 (patch) | |
tree | 81db657006c885340013c0d8a6e05294600880ed | |
parent | d856333c5e20de44ad0bdb6c841b8963305b9879 (diff) |
Merge branch 'axil-only-prod' into 'main'
Load the analytics only in the main site
See merge request https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/3897
Merged-by: Sarah German <sgerman@gitlab.com>
Approved-by: Sarah German <sgerman@gitlab.com>
Co-authored-by: Achilleas Pipinellis <axil@gitlab.com>
(cherry picked from commit 69942af7c21e2af42ef3aba95475a393c23dc54e)
6ce917e2 Load the analytics only in the main site
-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 5a99862d..331154ea 100644 --- a/layouts/default.html +++ b/layouts/default.html @@ -85,10 +85,8 @@ <script src="<%= @items['/assets/javascripts/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 2a99649a..28009cb6 100644 --- a/layouts/head.html +++ b/layouts/head.html @@ -53,7 +53,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> @@ -61,7 +60,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 9b081c7c..b7fcf3a9 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 bf9aea2b..56cd3343 100644 --- a/layouts/search.html +++ b/layouts/search.html @@ -35,10 +35,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> |