Skip to content

Commit

Permalink
Merge pull request #28 from TuftsUniversity/analytics
Browse files Browse the repository at this point in the history
Add Google Analytics 4
  • Loading branch information
rawOrlando authored May 23, 2023
2 parents 74bbe6c + 50ca3ad commit 792f98e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<%= csrf_meta_tags %>
<link rel="stylesheet" type="text/css" href="https://cloud.typography.com/6706294/7509792/css/fonts.css" />
</head>
<%= render "shared/analytics4" %>
<body>
<!-- Remove?
<p class="notice"><%= notice %></p>
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/spotlight/spotlight.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<![endif]-->

</head>
<%= render "shared/analytics4" %>
<body class="<%= render_body_class %>">
<%= render partial: 'shared/header_navbar' %>
<%= render partial: 'shared/masthead' %>
Expand Down
10 changes: 10 additions & 0 deletions app/views/shared/_analytics4.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<% if Rails.env.production? %>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-RNX4KV6B5Y"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-RNX4KV6B5Y');
</script>
<% end %>

0 comments on commit 792f98e

Please sign in to comment.