-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Hyrax to bring in bug fixes for GA4
This commit will update the Hyrax revision to bring in the bug fixes for Google Analytics 4 and also update the logic in Hyku's ga4 partial to account for multitenancy more accurately.
- Loading branch information
Showing
2 changed files
with
12 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
<%# Override Hyrax 6.0.0 to use multiple analytics configs, one app wide one and one tenant override %> | ||
<%# Override Hyrax v5.0.3 to use multiple analytics configs, one app wide one and one tenant override %> | ||
<!-- Google tag (gtag.js) --> | ||
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= Hyrax::Analytics.config.analytics_id %>"></script> | ||
<script> | ||
window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); | ||
|
||
gtag('config', '<%= Hyrax::Analytics.config.analytics_id %>'); | ||
<% if ENV.fetch('GOOGLE_ANALYTICS_ID', Hyrax::Analytics.config.analytics_id) != Hyrax::Analytics.config.analytics_id %> | ||
gtag('config', '<%= ENV.fetch('GOOGLE_ANALYTICS_ID') %>'); | ||
<% if Hyrax::Analytics.config.analytics_id.present? %> | ||
gtag('config', '<%= Hyrax::Analytics.config.analytics_id %>'); | ||
<% end %> | ||
window.analytics = gtag; | ||
|
||
<% if current_account.settings[:google_analytics_id].present? && | ||
current_account.settings[:google_analytics_id] != Hyrax::Analytics.config.analytics_id %> | ||
gtag('config', '<%= current_account.settings[:google_analytics_id] %>'); | ||
<% end %> | ||
|
||
window.analytics = gtag; | ||
</script> | ||
<meta name="analytics-provider" content="ga4"> |