Skip to content

Commit

Permalink
add GTM, cookiepolicy, privacypolicy
Browse files Browse the repository at this point in the history
Signed-off-by: ayush-billore <[email protected]>

replace chef logo with progress logo

Signed-off-by: ayush-billore <[email protected]>

update private policy and cookie policy

Signed-off-by: ayush-billore <[email protected]>

add feature flag changes

Signed-off-by: ayush-billore <[email protected]>

add favicon

Signed-off-by: ayush-billore <[email protected]>

remove favicon

Signed-off-by: ayush-billore <[email protected]>

remove logo and favicon changes

Signed-off-by: ayush-billore <[email protected]>
  • Loading branch information
ayush-billore committed Dec 1, 2023
1 parent afb7f71 commit 91dd619
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/oc-id/app/helpers/feature_flag_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module FeatureFlagHelper
def gtm_enabled?
ENV["ENABLE_GTM"] == "true"
end

def onetrust_enabled?
ENV["ENABLE_ONETRUST"] == "true"
end
end
45 changes: 45 additions & 0 deletions src/oc-id/app/views/application/_analytics.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<% if gtm_enabled? %>
<!-- Google Tag Manager conditional -->
<%= javascript_tag type: "text/javascript" 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? %>
<!-- Onetrust Script -->
<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 Script -->
<%= 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 Google Tag Manager -->
<% end %>
6 changes: 6 additions & 0 deletions src/oc-id/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag '//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js' %>
<%= csrf_meta_tags %>
<%= render 'application/analytics' %>
</head>
<body>
<% 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="contain-to-grid">
<nav class="top-bar" data-topbar role="navigation">
<ul class="title-area">
Expand Down
2 changes: 1 addition & 1 deletion src/oc-id/lib/assets/images/chef-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 91dd619

Please sign in to comment.