Google Optimize Troubleshooting

This guide provides an overview to common errors and misconfigurations we’ve seen customers might have with their Google Optimize settings with MonsterInsights.

If you’re just looking to set up Google Optimize the easy way, please see our guide: How to Set Up Google Optimize in WordPress (the Easy Way).

Looking for more documentation? We have more docs specifically setting up Google Optimize for WordPress.

The most common misconfigurations with Google Optimize:

  1. The Google Optimize snippet for the container with ID OPT-******* is not correctly installed on this page.
  2. Uncaught ReferenceError: ga is not defined.
  3. A gray or white screen for several seconds before the page loads.

If You’re Seeing Errors Similar to:

The Google Optimize snippet for the container with ID OPT-******* is not correctly installed on this page. To preview variants for this experiment, make sure the Google Optimize snippet is installed on any pages you want to test.

This page does not have an Optimize snippet for this container. To preview this page and start an experiment, please check that your page has the snippet properly set up.

Make sure you’re logged out of WordPress when viewing the variant because MonsterInsights doesn’t track logged-in admins and editors by default. More information on this error here.

You may also experience this error if you have not inserted the correct Optimize ID within the MonsterInsights settings.

Uncaught ReferenceError: ga is not defined:

You’ll need to ensure that you use __gtagTracker() instead of ga() or gtag() within any scripts used.

A gray or white screen for several seconds before the page loads:

Basically, every time any public page loads it presents with a full grey screen for a few seconds before allowing the page to load.

The likely scenario is your Google Optimize container isn’t published. So MonsterInsights waits for Google Optimize container to be fulfilled. But the container isn’t published at optimize.google.com which will cause it to have a blank screen for the full 4 seconds. Please see our guide on how to fix this issue: Google Optimize Troubleshooting: Flash of White or Gray Screen for Several Seconds Before Page Load

That’s it! Those are the most typical misconfigurations with Google Optimize and how to fix them.