Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add in GA4 to SA #2507

Merged
merged 5 commits into from
Jun 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/views/_ga.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<%# OVERRIDE: Adding in the GA4 to OD2 %>
<!-- Google tag (gtag.js) -->
<%
if Hyrax.config.google_analytics_id?
tracking_id = Hyrax.config.google_analytics_id
%>
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= tracking_id %>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

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