Skip to content

Commit

Permalink
Adding Google Analytics to base layout
Browse files Browse the repository at this point in the history
  • Loading branch information
randalldfloyd committed Apr 19, 2024
1 parent 77c75b3 commit 6026086
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/views/layouts/blacklight/base.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,23 @@
<%= favicon_link_tag %>
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
<% if ENV['SITE_HOST']&.include?('.edu') %>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-J2B2XVXX8M"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-J2B2XVXX8M');
</script>
<% end %>
<%= csrf_meta_tags %>
<%= content_for(:head) %>
</head>

<body class="<%= render_body_class %>">
<nav id="skip-link" role="navigation" aria-label="<%= t('blacklight.skip_links.label') %>">
<%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
Expand Down

0 comments on commit 6026086

Please sign in to comment.