Skip to content

Commit

Permalink
add cookie policy, privacy policy, logo and favicon changes
Browse files Browse the repository at this point in the history
Signed-off-by: ayush-billore <[email protected]>
  • Loading branch information
ayush-billore committed Nov 15, 2023
1 parent 2b8af23 commit ea11818
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 97 deletions.
12 changes: 2 additions & 10 deletions src/supermarket/app/helpers/feature_flag_helper.rb
Original file line number Diff line number Diff line change
@@ -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
85 changes: 7 additions & 78 deletions src/supermarket/app/views/application/_analytics.html.erb
Original file line number Diff line number Diff line change
@@ -1,91 +1,20 @@
<% if gtm_enabled? %>
<!-- Google Tag Manager conditional -->
<%= 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? %>
<script async src="https://cdn.cookielaw.org/consent/e231efa5-3ed9-4b92-96bc-f4c0872ca486/otSDKStub.js" type="text/javascript" charset="UTF-8" data-domain-script="e231efa5-3ed9-4b92-96bc-f4c0872ca486" onerror="oneTrustHelper.gtmFallback()"></script>
<% end %>

<% if gtm_enabled? && ENV['GTM_ID'] %>
<!-- Google Tag Manager -->
<%= 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? %>
<!-- GTag conditional -->
<% 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.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="4.0.0";
analytics.load("<%= ENV["SEGMENT_WRITE_KEY"] %>");
analytics.page();
}}();
<% end %>
<% end %>

<% if gtag_enabled? && ENV['GOOGLE_ANALYTICS_ID'] %>
<% if ENV['GOOGLE_ANALYTICS_ID'] %>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= ENV['GOOGLE_ANALYTICS_ID'] %>"></script>
<%= 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.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="4.0.0";
analytics.load("<%= ENV["SEGMENT_WRITE_KEY"] %>");
analytics.page();
}}();
gtag('config', '<%= ENV['GOOGLE_ANALYTICS_ID'] %>');
<% end %>
<% end %>
13 changes: 4 additions & 9 deletions src/supermarket/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
</head>
<body class="<%= controller.controller_name %>">
<% if gtm_enabled? && ENV['GTM_ID'] %>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<%= ENV['GTM_ID'] %>" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<% end %>

<div class="off-canvas-wrap">
<div class="inner-wrap">
<!-- Chef Property Menu -->
Expand Down Expand Up @@ -74,7 +70,6 @@
<br><br><%= link_to 'Code of Conduct', chef_docs_url('community_guidelines') %>
<%= link_to 'Terms and Conditions of Use', progress_www_url('legal/terms-of-use') %>
<%= link_to 'Privacy Policy', progress_www_url('legal/privacy-policy') %>
<%= link_to 'Cookie Policy', progress_www_url('legal/cookie-policy') %>
<%= link_to 'Trademark Policy', progress_www_url('legal/trademarks') %>
<%= link_to 'Status', chef_status_url %>
</footer>
Expand All @@ -85,4 +80,4 @@

<%= javascript_include_tag 'application' %>
</body>
</html>
</html>

0 comments on commit ea11818

Please sign in to comment.