Title: Autoptimize is causing Google Analytics AB Test Code to fail
Last modified: August 1, 2018

---

# Autoptimize is causing Google Analytics AB Test Code to fail

 *  [thefriendlancer](https://wordpress.org/support/users/thefriendlancer/)
 * (@thefriendlancer)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/autoptimize-is-causing-google-analytics-ab-test-code-to-fail/)
 * Hi Plugin Developer,
 * We have been experiencing issues with the Autoptimize plugin not working with
   GA’s AB experiment code.
    Whenever the Autoptimize plugin is activated, GA is
   returning the below errors: – No experiment code found. – No Google Analytics
   tracking code found.
 * When Autoptimize is deactivated, no errors.
 * We have already tried adding <!–noptimize–>…<!–/noptimize–> tags for the AB experiment
   codes as well as for the GA code, but the issue persists.
 * Please help! Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/autoptimize-is-causing-google-analytics-ab-test-code-to-fail/#post-10548454)
 * And have you tried excluding GA AB’s code from JS optimization (see [FAQ](https://wordpress.org/plugins/autoptimize/#faq)
   for info on how to exclude files and/ or inline JS)?
 *  Thread Starter [thefriendlancer](https://wordpress.org/support/users/thefriendlancer/)
 * (@thefriendlancer)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/autoptimize-is-causing-google-analytics-ab-test-code-to-fail/#post-10548486)
 * Thanks for the reply.
 * Yes, I did try excluding “utmx_section” as the unique identifier for the GA’s
   AB experiment code, but the issue persists.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/autoptimize-is-causing-google-analytics-ab-test-code-to-fail/#post-10548685)
 * ok some questions;
    1. when looking at the HTML, do you indeed see the excluded(
   or noptimized) code? 2. is there any more JS involved somehow? or even CSS? 3.
   do you see any JS errors on the browser console?
 *  Thread Starter [thefriendlancer](https://wordpress.org/support/users/thefriendlancer/)
 * (@thefriendlancer)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/autoptimize-is-causing-google-analytics-ab-test-code-to-fail/#post-10551882)
 * Thanks for the responses, below are my answers.
 * 1. For both excluded or noptimized codes, I checked the View Source and I can
   confirm the codes were indeed stripped out regardless.
 * 2. Not sure what you mean by more JS or CSS, but it is a WordPress site where
   there are several JS or CSS.
 * 3. I can confirm there are no JS errors.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/autoptimize-is-causing-google-analytics-ab-test-code-to-fail/#post-10551944)
 * regarding (2); I have no idea how Google’s A/B testing works, but if for any 
   reason there is additional JS at play or even CSS, then that might need to be
   excluded as well?
 *  Thread Starter [thefriendlancer](https://wordpress.org/support/users/thefriendlancer/)
 * (@thefriendlancer)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/autoptimize-is-causing-google-analytics-ab-test-code-to-fail/#post-10555951)
 * I believe the problem is that even we already enclosed the AB Test JS code with
   the “noptimized” tags, Autoptimize still strips them out, and therefore in effect,
   GA no longer sees them when we validate it.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/autoptimize-is-causing-google-analytics-ab-test-code-to-fail/#post-10555993)
 * can you share the URL where this is happening so I can have a quick look?

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Autoptimize is causing Google Analytics AB Test Code to fail’ is closed
to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [7 years, 10 months ago](https://wordpress.org/support/topic/autoptimize-is-causing-google-analytics-ab-test-code-to-fail/#post-10555993)
 * Status: not resolved