hydecorp / hydejack

A boutique Jekyll theme for hackers, nerds, and academics
https://hydejack.com
Other
1.41k stars 799 forks source link

Current Google Analytics support will cease to work next year. #310

Open yukster opened 1 year ago

yukster commented 1 year ago

GA3, aka Universal Analytics is deprecated and will be shut down on July 1, 2023: https://support.google.com/analytics/answer/11583528

Any plans to update analytics.html to support the GA4 tag?

jyje commented 1 year ago

Is there any news about it?

analyticalmonk commented 1 year ago

No news yet, I guess. If anyone's managed a workaround, please share!

yukster commented 1 year ago

I wound up just solving this by overriding the default analytics stuff in the theme. I did so by commenting out the google_analytics config in _config.yml and then making my own head file called includes/my-head.html (which Hydejack includes by default). The contents of that file is (be sure to replace <your GA ID> with your GA4 ID):

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

  gtag('config', '<your GA ID>');
</script>