victoriadrake / hugo-theme-introduction

Minimal, single page, smooth-scrolling theme for Hugo static site generator.
https://hugo-introduction.netlify.com/
Apache License 2.0
671 stars 264 forks source link

Google Analytics not receiving data after update #359

Closed irhuru closed 1 year ago

irhuru commented 1 year ago

Describe the bug I have updated my website following the information in this thread (#341), but when I log in in Google Analytics, I get this message: "Data collection isn't active for your website. If you installed tags more than 48 hours ago, make sure they are set up correctly."

I'm not super familiar with Google Analytics, so I'm not sure if I did something wrong or if I'm missing anything. I'm including below the steps I have followed.

To Reproduce Steps to reproduce the behavior:

  1. I created a GA property with the format G-XXXX
  2. I added the property to my config.toml file to replace my previous UA-XXXX code
  3. I modified layouts/partials/head/metadata.html to include the following at the top: {{ template "_internal/google_analytics.html" . }}
  4. I deleted this line ({{ template "_internal/google_analytics_async.html" . }}) from layouts/partials/footer/scripts.html
  5. I added this line ({{ partial "head/metadata.html" . }}) to layouts/404.html

Expected behavior After running the hugo command in the terminal, new code was generated in some of the files in public which mention the new property, so I assumed that everything was working fine. However, my Google Analytics account is still not receiving data.

Screenshots You can find all my code in this repository: https://github.com/irhuru/irhuru.github.io

irhuru commented 1 year ago

I was able to fix this. There are some versions of Hugo which don't support Google Analytics 4 and mine was one of them.