Skip to content

Commit

Permalink
added check to handle missing branding.yml items
Browse files Browse the repository at this point in the history
  • Loading branch information
briri committed Apr 9, 2020
1 parent c948f87 commit ccd4b82
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions app/views/branded/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
<!-- Version: <%= version %> -->

<!-- Global site tag (gtag.js) - Google Analytics -->
<% gkey = Rails.configuration.branding[:keys][:google_analytics_key] %>
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= gkey %>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '<%= gkey %>');
</script>
<% if Rails.configuration.branding[:keys].present? %>
<% gkey = Rails.configuration.branding[:keys][:google_analytics_key] %>
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= gkey %>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '<%= gkey %>');
</script>
<% end %>

<title><%= content_for?(:title) ? yield(:title) : _('%{application_name}') % { :application_name => Rails.configuration.branding[:application][:name] } %>
</title>
Expand Down

0 comments on commit ccd4b82

Please sign in to comment.