mirror of
https://github.com/edcommonwealth/ecp.org.git
synced 2026-03-15 10:15:54 -07:00
Add google analytics
This commit is contained in:
parent
dd826c3e0d
commit
c24c367339
2 changed files with 14 additions and 0 deletions
12
app/views/layouts/_google_analytics.html.erb
Normal file
12
app/views/layouts/_google_analytics.html.erb
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||||
|
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= google_analytics_id %>"></script>
|
||||||
|
<script>
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
|
||||||
|
function gtag() {
|
||||||
|
dataLayer.push(arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtag('js', new Date());
|
||||||
|
gtag('config', <%= google_analytics_id.to_json.html_safe %>);
|
||||||
|
</script>
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
||||||
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
|
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
|
||||||
<%# <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> %>
|
<%# <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> %>
|
||||||
|
|
||||||
|
<%= render partial: 'layouts/google_analytics', locals: { google_analytics_id: @google_analytics_id } %>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue