Skip to content

Commit

Permalink
Oops. We had no google analytics in the new theme
Browse files Browse the repository at this point in the history
  • Loading branch information
mlandauer committed Jul 25, 2024
1 parent a82caa8 commit d982562
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
11 changes: 11 additions & 0 deletions app/views/_tailwind/application/_analytics.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= ENV.fetch("GOOGLE_ANALYTICS_MEASUREMENT_ID", nil) %>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '<%= ENV.fetch("GOOGLE_ANALYTICS_MEASUREMENT_ID", nil) %>', {
cookie_flags: 'max-age=7200;secure;samesite=none'
});
</script>
2 changes: 2 additions & 0 deletions app/views/_tailwind/application/_html_head.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
</title>
<%= yield :extra_meta_tags %>

<%= render "analytics" %>

<%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
Expand Down
21 changes: 0 additions & 21 deletions app/views/application/_analytics.html.erb

This file was deleted.

0 comments on commit d982562

Please sign in to comment.