Fix: Google Analytics not tracking traffic even though fully authenticated with Analytify

We had a site that just refused to show any traffic in Google Analytics, even though everything looked set up correctly. We reinstalled the plugin, Analytify, more than once and reauthenticated with Google successfully each time. Google Search Console showed real traffic hitting the site. Analytics showed zero.

So what went wrong?

It turned out to be a side effect of duplicating a website. This site was part of a larger network and shared a similar layout and structure with a sibling site – the only difference was the actual content. So it made sense to duplicate the site and just swap out the content.

Unfortunately the analytics plugin didn't handle this well. Even after reinstalling and reauthenticating multiple times, the front-end source code still showed the old website's tracking ID.

This post originally covered Universal Analytics (UA) tracking codes. Google stopped processing new data in Universal Analytics on 1 July 2023, so the fix below is written for GA4 measurement IDs instead. The underlying cause is exactly the same.

If your problem looks similar to what's described above, the fix below should help.

The fix

Fixing this requires directly editing the database. It's quite simple, really:

  1. Log in to cPanel, Plesk, or whatever control panel you're using, and access the database, typically via phpMyAdmin or similar.
  2. Locate the database your website is connected to, and hit Search.
  3. Search for your OLD GA4 measurement ID (the G-XXXXXXXXXX code) across all tables. If the site was cloned before 2023, the stale value might still be an old Universal Analytics code instead (UA-XXXXXXX), so search for that too. You should see a result in wp_options under an option name like analytify_ga4_measurement_id or similar (naming varies by plugin version, and if you're using a different analytics plugin the field name will be different again). You can cross-check the correct current value under Plugins > Analytify > Settings in wp-admin.
  4. Change the value to your new measurement ID.
  5. Test by clearing your website's cache and reloading it. Check the source code with Ctrl+U and Ctrl+F, it should reflect the new code now.

Hope this helps!

All posts