Title: Exclude inline JavaScript containing HTML from HTML optimization
Last modified: January 20, 2017

---

# Exclude inline JavaScript containing HTML from HTML optimization

 *  Resolved [codifex](https://wordpress.org/support/users/codifex/)
 * (@codifex)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/exclude-inline-javascript-containing-html-from-html-optimization/)
 * I am using Autoptimize to optimize HTML, CSS, and JavaScript on a site.
 * On one page a Google AdWords conversion tracking code is contained in the HTML
   output:
 *     ```
       <!-- Google Code for Anfrage Conversion Page
       In your html page, add the snippet and call
       goog_report_conversion when someone clicks on the
       chosen link or button. -->
       <script type="text/javascript">
         /* <![CDATA[ */
         goog_snippet_vars = function() {
           var w = window;
           ...
           w.google_conversion_value = 1.00;
           w.google_conversion_currency = "EUR";
           w.google_remarketing_only = false;
         }
         // DO NOT CHANGE THE CODE BELOW.
         goog_report_conversion = function(url) {
           goog_snippet_vars();
           window.google_conversion_format = "3";
           var opt = new Object();
           opt.onload_callback = function() {
           if (typeof(url) != 'undefined') {
             window.location = url;
           }
         }
         var conv_handler = window['google_trackConversion'];
         if (typeof(conv_handler) == 'function') {
           conv_handler(opt);
         }
       }
       /* ]]> */
       </script>
       <script type="text/javascript"
         src="//www.googleadservices.com/pagead/conversion_async.js">
       </script>
       ```
   
 * Unfortunately HTML optimization seems to destroy `/* <![CDATA[ */` and `/* ]]
   > */`. These code segments are minified to `/* */`, making Google complain.
 * Is there any way to keep HTML optimization enabled and preserve these JavaScript
   comments?
 * By the way, thank you very much for this great plugin.

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

 *  Thread Starter [codifex](https://wordpress.org/support/users/codifex/)
 * (@codifex)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/exclude-inline-javascript-containing-html-from-html-optimization/#post-8679100)
 * It seems that enclosing the script in `<!--noptimize--> ... <!--/noptimize-->`
   fixes the problem.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/exclude-inline-javascript-containing-html-from-html-optimization/#post-8679164)
 * > It seems that enclosing the script in `<!--noptimize--> ... <!--/noptimize--
   > >` fixes the problem.
 * it does 🙂
 * have a nice weekend!
    frank

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

The topic ‘Exclude inline JavaScript containing HTML from HTML optimization’ 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

 * [adwords](https://wordpress.org/support/topic-tag/adwords/)
 * [Comments](https://wordpress.org/support/topic-tag/comments/)
 * [html](https://wordpress.org/support/topic-tag/html/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [Preserve](https://wordpress.org/support/topic-tag/preserve/)

 * 2 replies
 * 2 participants
 * Last reply from: [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/exclude-inline-javascript-containing-html-from-html-optimization/#post-8679164)
 * Status: resolved