ReactionMechanismGenerator / RMG-website

A Django-powered website for Reaction Mechanism Generator (RMG)
Other
20 stars 29 forks source link

Update tracker from Google UA to GA4 #269

Closed xiaoruiDong closed 2 months ago

xiaoruiDong commented 8 months ago

The RMG website used Google Universal Analytics to track and understand user behavior. The universal analytics stopped working on 2023/07/01. I just tried to migrate services to Google Analytics 4. This PR adds the necessary tag to enable GA4.

@jonwzheng I suggest we test this on the dev first, and then eventually merge it onto the website.

xiaoruiDong commented 8 months ago

We should update this as well: https://github.com/ReactionMechanismGenerator/ReactionMechanismGenerator.github.io/blob/31d3c5842ecf240f8857f1319f59faaa78bac53e/index.html#L136C1-L145C10.

with

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

  gtag('config', 'G-TBF6RF8547');
</script>
jonwzheng commented 2 months ago

Sorry for the late review. Let's test this out since UA will be deprecated within a week.