From d1a9a3269c6e3cd0b730bf0fc6f70b143c0f89cf Mon Sep 17 00:00:00 2001 From: ayush-billore Date: Wed, 15 Nov 2023 11:59:29 +0530 Subject: [PATCH] add cookie policy, privacy policy, logo and favicon changes Signed-off-by: ayush-billore --- .../app/helpers/feature_flag_helper.rb | 12 +-- .../app/views/application/_analytics.html.erb | 85 ++----------------- .../app/views/layouts/application.html.erb | 10 +-- 3 files changed, 12 insertions(+), 95 deletions(-) diff --git a/src/supermarket/app/helpers/feature_flag_helper.rb b/src/supermarket/app/helpers/feature_flag_helper.rb index 313f20371a..3fe0b81aba 100644 --- a/src/supermarket/app/helpers/feature_flag_helper.rb +++ b/src/supermarket/app/helpers/feature_flag_helper.rb @@ -1,13 +1,5 @@ module FeatureFlagHelper - def gtag_enabled? - ENV["ENABLE_GTAG"] == "true" - end - - def gtm_enabled? - ENV["ENABLE_GTM"] == "true" - end - - def onetrust_enabled? - ENV["ENABLE_ONETRUST"] == "true" + def air_gapped? + ENV["AIR_GAPPED"] == "true" end end diff --git a/src/supermarket/app/views/application/_analytics.html.erb b/src/supermarket/app/views/application/_analytics.html.erb index 5583c77bd3..5fae2dc63f 100644 --- a/src/supermarket/app/views/application/_analytics.html.erb +++ b/src/supermarket/app/views/application/_analytics.html.erb @@ -1,91 +1,20 @@ -<% if gtm_enabled? %> - - <%= javascript_tag nonce: content_security_policy_nonce do %> - var oneTrustHelper = (function () { - function evalGTMScript() { - var gtmScript = document.getElementById("GTMScript"); - gtmScript.type = "text/javascript"; - gtmScript.classList.remove("optanon-category-1"); - eval(gtmScript.innerHTML); - }; - - return { - gtmFallback: function () { - console.warn('OneTrust not loaded.'); - if (document.readyState !== 'loading') { - evalGTMScript(); - } else { - document.addEventListener('readystatechange', function () { - if (document.readyState === 'interactive') { - evalGTMScript(); - } - }); - }; - } - }; - })(); - <% end %> -<% end %> - -<% if onetrust_enabled? %> - -<% end %> - -<% if gtm_enabled? && ENV['GTM_ID'] %> - - <%= javascript_tag type: "text/plain", id: "GTMScript", class: "optanon-category-1" do %> - (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','<%= ENV['GTM_ID'] %>'); - <% end %> -<% end %> - -<% if gtag_enabled? %> - +<% if ENV['SEGMENT_WRITE_KEY'] %> <%= javascript_tag nonce: content_security_policy_nonce do %> - var oneTrustHelper = (function () { - function evalGTagScript() { - var gtScript = document.getElementById("GTagScript"); - gtScript.type = "text/javascript"; - gtScript.classList.remove("optanon-category-2"); - eval(gtScript.innerHTML); - }; - return { - gtagFallback: function () { - console.warn('OneTrust not loaded.'); - if (document.readyState !== 'loading') { - evalGTagScript(); - } else { - document.addEventListener('readystatechange', function () { - if (document.readyState === 'interactive') { - evalGTagScript(); - } - }); - }; - } - }; - })(); + !function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t"); + analytics.page(); + }}(); <% end %> <% end %> -<% if gtag_enabled? && ENV['GOOGLE_ANALYTICS_ID'] %> +<% if ENV['GOOGLE_ANALYTICS_ID'] %> <%= javascript_tag nonce: content_security_policy_nonce do %> window.dataLayer = window.dataLayer || []; function gtag(){window.dataLayer.push(arguments);} gtag('js', new Date()); - gtag('config', '<%= ENV['GOOGLE_ANALYTICS_ID'] %>'); - <% end %> -<% end %> -<% if ENV['SEGMENT_WRITE_KEY'] %> - <%= javascript_tag nonce: content_security_policy_nonce do %> - !function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t"); - analytics.page(); - }}(); + gtag('config', '<%= ENV['GOOGLE_ANALYTICS_ID'] %>'); <% end %> <% end %> \ No newline at end of file diff --git a/src/supermarket/app/views/layouts/application.html.erb b/src/supermarket/app/views/layouts/application.html.erb index 024f7f1886..e66280ce96 100644 --- a/src/supermarket/app/views/layouts/application.html.erb +++ b/src/supermarket/app/views/layouts/application.html.erb @@ -18,15 +18,11 @@ <%= stylesheet_link_tag "//fonts.googleapis.com/css?family=Montserrat:400,700" %> <% end %> <%= csrf_meta_tags %> - <%= render 'application/analytics' %> + <% unless air_gapped? %> + <%= render 'application/analytics' %> + <% end %> - <% if gtm_enabled? && ENV['GTM_ID'] %> - - - - <% end %> -