Google Analytics Not Detected

If you have enabled the Delay JavaScript Execution option in WP Rocket, and you use an automated tool like, Google Tag Assistant, or an automated SEO analysis tool, they may report that they cannot find Google Analytics on your website, even though it's there. 

Tools like this typically search the code of your site for a specific word, filename or pattern related to Analytics.

With the above WP Rocket features, the code is changed slightly and the optimized version won't match what the tool is looking for. The code is still there, just not in the specific format they are looking for. So these tools will often product a false result.

So Tag Assistant and other tools won't recognize this and will show a warning, even though tracking is working correctly:

Check that tracking is working

To verify if the tracking is working (this is the method recommended by Google)

  1. Visit your site while logged out of WordPress.
  2. Open your Google Analytics account
  3. On the left side find the Real Time report. Give it a few seconds and your visit should show up. 

This lets you know the tracking is working and you can ignore the false result. 

Troubleshooting a problem

If visits are not showing up, your next step is to find out which option is related. 

  1. Deactivate the Google Tracking Add-On,(only applies to WP Rocket versions prior to 3.9) and Delay JavaScript Execution, one at a time. 
  2. Then check your Analytics after each, as described above. This will let you identify which option is causing the problem.

Google Tracking Add-On

If the problem is with the Google Tracking Add-On, check if the Analytics code you are using is compatible, by consulting our documentation.

If the code is not compatible, you will have to disable the add-on.

Delay JavaScript Execution

If the problem is with Delay JavaScript Execution, you may exclude Analytics from being delayed by excluding the related keywords found here.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.