• 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

    (@optimizingmatters)

    And have you tried excluding GA AB’s code from JS optimization (see FAQ for info on how to exclude files and/ or inline JS)?

    Thread Starter thefriendlancer

    (@thefriendlancer)

    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

    (@optimizingmatters)

    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

    (@thefriendlancer)

    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

    (@optimizingmatters)

    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

    (@thefriendlancer)

    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

    (@optimizingmatters)

    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.