Title: Google Analytics Experiments compatibility
Last modified: August 22, 2016

---

# Google Analytics Experiments compatibility

 *  Resolved [gemme](https://wordpress.org/support/users/gemme/)
 * (@gemme)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/google-analytics-experiments-compatibility/)
 * Hello Frank!
 * First of all, thank you for this great plugin 🙂
 * Unfortunately, it gets in a way of performing Google Analytics Experiments.
    
   To use it on selected page, it is required to add this at the beginning of header.
   php:
 *     ```
       <?php
       if (is_page($page_id)){ ?>
       <!-- Google Analytics Content Experiment code -->
       <script>...</script>
       <!-- End of Google Analytics Content Experiment code -->
       <?php } ?>
       ```
   
 * When yuor plugin is enabled, the script tags are removed and Google Analytics
   Experiment cannot detect it. Could it be solved?
 * (posted also on blog.futtta.be, sorry if it’s a problem)
 * [https://wordpress.org/plugins/autoptimize/](https://wordpress.org/plugins/autoptimize/)

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

 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/google-analytics-experiments-compatibility/#post-5508137)
 * Well, there are two solutions, really (both are [mentioned in the FAQ](https://wordpress.org/plugins/autoptimize/faq/),
   by the way 😉 );
    1. put all between noptimize-tags;
 *     ```
       <!--noptimize-->
       <!-- Google Analytics Content Experiment code -->
       <script>...</script>
       <!-- End of Google Analytics Content Experiment code -->
       <!--/noptimize-->
       ```
   
 * 2. search for a unique string in the js-code between the script-tags and add 
   that to the comma-seperated list of JS to exclude from optimizing.
 * have fun!
    frank
 *  Thread Starter [gemme](https://wordpress.org/support/users/gemme/)
 * (@gemme)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/google-analytics-experiments-compatibility/#post-5508225)
 * Oops, didn’t look at the FAQ <embarrassed>
 * Thanks!

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

The topic ‘Google Analytics Experiments compatibility’ 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/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 2 replies
 * 2 participants
 * Last reply from: [gemme](https://wordpress.org/support/users/gemme/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/google-analytics-experiments-compatibility/#post-5508225)
 * Status: resolved