ncbo / bioportal_web_ui

A Rails application for biological ontologies
http://bioportal.bioontology.org/
Other
21 stars 2 forks source link

Update _ga_tracking partial with new Google Analytics tag #270

Closed jvendetti closed 1 year ago

jvendetti commented 1 year ago

The _ga_tracking partial currently refers to the analytics.js Google Analytics tag that will expire in roughly 28 days. We need to replace it with the newer gtag.js tag:

In order to experience this new Analytics, you will need to upgrade to Google's latest tagging solution. By updating your current Google Analytics tag (analytics.js) to the Google tag (gtag.js), not only will you have access to the new Analytics, you will also benefit from...

Relates to https://github.com/ncbo/bioportal-project/issues/248

As part of this work, we should start storing the analytics ID in encrypted credentials instead of the bioportal_config_#{Rails.env}.rb files.

alexskr commented 1 year ago

GA v4 recommends to use gtag.js instead of analytics.js https://support.google.com/analytics/answer/10271001 We should update our ga tracking partial to use gtag.js:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-XXXXXXXX');
</script>

where G-XXXXXXX is our analytics ID

alexskr commented 1 year ago

I added newly generated GA v4 ID to our private config repo