diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2023-06-02 13:24:56 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2023-06-02 13:24:56 +0300 |
commit | f42d0905f41d5b5362fdd968255d15199699df1c (patch) | |
tree | 91baf96ebd3aa9514480b224145b29f4cb899d06 | |
parent | 716635c93d4e06eb8093c30ba0cbd68f1204d62c (diff) |
Load the analytics only in the main site (14.10 backport)
-rw-r--r-- | .gitlab-ci.yml | 124 | ||||
-rw-r--r-- | layouts/404.html | 8 | ||||
-rw-r--r-- | layouts/analytics.html | 2 | ||||
-rw-r--r-- | layouts/default.html | 6 | ||||
-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 | 5 |
8 files changed, 80 insertions, 87 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2433c848..5fe234c5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -417,72 +417,72 @@ test_unlinked_images: # # 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.$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 # # 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 525641a4..65a37734 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -13,16 +13,14 @@ <div class="col-12"> <%= yield %> <%= render '/footer.*' %> + </div> </div> - </div> - </section> + </section> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js" integrity="sha384-LtrjvnR4Twt/qOuYxE721u19sVFLVSA4hf/rRt6PrZTmiPltdZcI7q7PXQBYTKyf" crossorigin="anonymous"></script> <script src="<%= @items['/frontend/404/404.*'].path %>"></script> <%= render '/docsearch.*' %> - <% 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 49da148d..60c58c4e 100644 --- a/layouts/default.html +++ b/layouts/default.html @@ -101,10 +101,9 @@ <script type="application/javascript" src="<%= @items['/assets/javascripts/badges.*'].path %>"></script> <%= render '/docsearch.*' %> <script src="<%= @items['/assets/javascripts/mermaid.*'].path %>"></script> - <% if production? %> + <%# Add analytics only in production %> - <%= render '/analytics.*' %> - <% end %> + <%= render '/analytics.*' %> <script src="<%= @items['/frontend/header/index.*'].path %>"></script> <script src="<%= @items['/assets/javascripts/docs.*'].path %>"></script> <script src="<%= @items['/assets/javascripts/global-nav.*'].path %>"></script> @@ -112,4 +111,3 @@ <script src="<%= @items['/frontend/default/default.*'].path %>"></script> </body> </html> - diff --git a/layouts/gtm.html b/layouts/gtm.html index 87ebf4cb..bf124396 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-WZCXKT5" diff --git a/layouts/head.html b/layouts/head.html index 55c42b31..020b7580 100644 --- a/layouts/head.html +++ b/layouts/head.html @@ -43,19 +43,17 @@ <!-- end of docsearch --> <% 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 39f85629..e188d1e8 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -9,10 +9,8 @@ <%= render '/header.*' %> <%= yield %> <%= render '/docsearch.*' %> - <% 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/home/index.*'].path %>"></script> diff --git a/layouts/instantsearch.html b/layouts/instantsearch.html index 717cdb0a..216b8598 100644 --- a/layouts/instantsearch.html +++ b/layouts/instantsearch.html @@ -23,10 +23,9 @@ <script type="application/javascript" src="<%= @items['/assets/javascripts/badges.*'].path %>"></script> <script src="<%= @items['/frontend/header/index.*'].path %>"></script> <script src="<%= @items['/frontend/search/index.*'].path %>"></script> - <% if production? %> + <%# Add analytics only in production %> - <%= render '/analytics.*' %> - <% end %> + <%= render '/analytics.*' %> <%= render '/schema-microdata.*' %> </body> </html> |