diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2023-06-02 13:32:33 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2023-06-02 13:32:33 +0300 |
commit | 3e8b279cc7196ac57a8e398245e70a9c13754721 (patch) | |
tree | 0b1dbe069b352f9e7bcc4ea163fdf9445336c813 | |
parent | 4b277abd53d4f6e8cf92d3b6655f8e23c1142c18 (diff) | |
parent | 2c2b05e60719b9300a31f142ff5ccd0bab0a4edd (diff) |
Merge branch 'cherry-pick-69942af7-15.4' into '15.4'15.4
Load the analytics only in the main site (15.4 backport)
See merge request https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/3907
Merged-by: Achilleas Pipinellis <axil@gitlab.com>
Reviewed-by: Achilleas Pipinellis <axil@gitlab.com>
Co-authored-by: Sarah German <sgerman@gitlab.com>
-rw-r--r-- | .gitlab/ci/build-and-deploy.gitlab-ci.yml | 124 | ||||
-rw-r--r-- | layouts/404.html | 5 | ||||
-rw-r--r-- | layouts/analytics.html | 2 | ||||
-rw-r--r-- | layouts/default.html | 5 | ||||
-rw-r--r-- | layouts/gtm.html | 2 | ||||
-rw-r--r-- | layouts/head.html | 16 | ||||
-rw-r--r-- | layouts/home.html | 4 | ||||
-rw-r--r-- | layouts/instantsearch.html | 4 |
8 files changed, 78 insertions, 84 deletions
diff --git a/.gitlab/ci/build-and-deploy.gitlab-ci.yml b/.gitlab/ci/build-and-deploy.gitlab-ci.yml index 8cc8aa13..d85cc43e 100644 --- a/.gitlab/ci/build-and-deploy.gitlab-ci.yml +++ b/.gitlab/ci/build-and-deploy.gitlab-ci.yml @@ -63,72 +63,72 @@ compile_dev: # # Deploy the Review App on a dev server # -review: - stage: deploy - extends: - - .retry - variables: - GIT_STRATEGY: none - needs: - - compile_dev - before_script: [] - cache: {} - script: - # Rsync to the Pages dir - - rsync -av --delete public /srv/nginx/pages/$CI_COMMIT_REF_SLUG$REVIEW_SLUG - # Remove public directory so that the next review app can run in a - # clean environment (limitation of the shell executor). - - rm -rf public - environment: - name: review/$CI_COMMIT_REF_SLUG$REVIEW_SLUG - url: http://$CI_COMMIT_REF_SLUG$REVIEW_SLUG.$APPS_DOMAIN - on_stop: review_stop - rules: - - if: '$CI_PROJECT_PATH == "gitlab-renovate-forks/gitlab-docs"' - when: manual - - if: '$CI_PROJECT_PATH !~ /^gitlab-org/' - when: never - - if: '$CI_MERGE_REQUEST_ID' - - if: '$CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "trigger"' - - if: '$CI_COMMIT_BRANCH =~ /docs-preview/' # TODO: Remove once no projects create such branch - tags: - - nginx - - review-apps +#review: +# stage: deploy +# extends: +# - .retry +# variables: +# GIT_STRATEGY: none +# needs: +# - compile_dev +# before_script: [] +# cache: {} +# script: +# # Rsync to the Pages dir +# - rsync -av --delete public /srv/nginx/pages/$CI_COMMIT_REF_SLUG$REVIEW_SLUG +# # Remove public directory so that the next review app can run in a +# # clean environment (limitation of the shell executor). +# - rm -rf public +# environment: +# name: review/$CI_COMMIT_REF_SLUG$REVIEW_SLUG +# url: http://$CI_COMMIT_REF_SLUG$REVIEW_SLUG.35.193.151.162.nip.io +# on_stop: review_stop +# rules: +# - if: '$CI_PROJECT_PATH == "gitlab-renovate-forks/gitlab-docs"' +# when: manual +# - if: '$CI_PROJECT_PATH !~ /^gitlab-org/' +# when: never +# - if: '$CI_MERGE_REQUEST_ID' +# - if: '$CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "trigger"' +# - if: '$CI_COMMIT_BRANCH =~ /docs-preview/' # TODO: Remove once no projects create such branch +# tags: +# - nginx +# - review-apps # # Stop the Review App # -review_stop: - stage: deploy - extends: - - .retry - variables: - GIT_STRATEGY: none - needs: [] - artifacts: {} - before_script: [] - cache: {} - script: - - rm -rf public /srv/nginx/pages/$CI_COMMIT_REF_SLUG$REVIEW_SLUG - environment: - name: review/$CI_COMMIT_REF_SLUG$REVIEW_SLUG - action: stop - rules: - - if: '$CI_PROJECT_PATH == "gitlab-renovate-forks/gitlab-docs"' - allow_failure: true - when: manual - - if: '$CI_PROJECT_PATH !~ /^gitlab-org/' - when: never - - if: '$CI_MERGE_REQUEST_ID || $CI_PIPELINE_SOURCE == "pipeline"|| $CI_PIPELINE_SOURCE == "trigger"' - allow_failure: true - when: manual - # TODO: Remove once no projects create such branch - - if: '$CI_COMMIT_BRANCH =~ /docs-preview/' - allow_failure: true - when: manual - tags: - - nginx - - review-apps +#review_stop: +# stage: deploy +# extends: +# - .retry +# variables: +# GIT_STRATEGY: none +# needs: [] +# artifacts: {} +# before_script: [] +# cache: {} +# script: +# - rm -rf public /srv/nginx/pages/$CI_COMMIT_REF_SLUG$REVIEW_SLUG +# environment: +# name: review/$CI_COMMIT_REF_SLUG$REVIEW_SLUG +# action: stop +# rules: +# - if: '$CI_PROJECT_PATH == "gitlab-renovate-forks/gitlab-docs"' +# allow_failure: true +# when: manual +# - if: '$CI_PROJECT_PATH !~ /^gitlab-org/' +# when: never +# - if: '$CI_MERGE_REQUEST_ID || $CI_PIPELINE_SOURCE == "pipeline"|| $CI_PIPELINE_SOURCE == "trigger"' +# allow_failure: true +# when: manual +# # TODO: Remove once no projects create such branch +# - if: '$CI_COMMIT_BRANCH =~ /docs-preview/' +# allow_failure: true +# when: manual +# tags: +# - nginx +# - review-apps # # Clean up review apps and free disk space diff --git a/layouts/404.html b/layouts/404.html index eaf565d8..f820d5f8 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -19,9 +19,8 @@ <script src="<%= @items['/frontend/shared/global_imports.*'].path %>"></script> <script src="<%= @items['/frontend/search/docsearch.*'].path %>"></script> <script src="<%= @items['/frontend/404/404.*'].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 b932c75b..974aa147 100644 --- a/layouts/default.html +++ b/layouts/default.html @@ -105,10 +105,9 @@ document.head.appendChild(script); } </script> - <% 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/filters.*'].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 78656c12..9cb637a3 100644 --- a/layouts/head.html +++ b/layouts/head.html @@ -40,19 +40,17 @@ <link rel="stylesheet" href="<%= @items['/assets/stylesheets/font-awesome.min.*'].path %>"> <% if production? %> - <%# Adds GTM only in production %> - <!-- add cookie consent --> - <script type="text/javascript" src="https://cdn.cookielaw.org/consent/7f944245-c5cd-4eed-a90e-dd955adfdd08/OtAutoBlock.js"> - </script> - - <script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" type="text/javascript" charset="UTF-8" data-domain-script="7f944245-c5cd-4eed-a90e-dd955adfdd08"> - </script> - + <!-- 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> <script type="text/javascript"> 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 3b79e055..dd2dcc2b 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/instantsearch.html b/layouts/instantsearch.html index 514e7273..762fbfc8 100644 --- a/layouts/instantsearch.html +++ b/layouts/instantsearch.html @@ -22,10 +22,8 @@ <script src="<%= @items['/frontend/header/index.*'].path %>"></script> <script src="<%= @items['/frontend/search/instantsearch.*'].path %>"></script> - <% if production? %> <%# Add analytics only in production %> - <%= render '/analytics.*' %> - <% end %> + <%= render '/analytics.*' %> <%= render '/schema-microdata.*' %> </body> </html> |