Title: Some inline javascript not being deferred
Last modified: October 28, 2021

---

# Some inline javascript not being deferred

 *  Resolved [wpuser000](https://wordpress.org/support/users/wpuser000/)
 * (@wpuser000)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/some-inline-javascript-not-being-deferred/)
 * Hi, thanks for the great plugin! (just left a 5-star review)
 * For JS I have optimize, defer and defer inline enabled (but not aggregate). I
   haven’t added any extra script excludes apart from the default.
 * I have some plain inline <script> tags in the site (added in the wp widgets) 
   and noticed that some of them get deferred (with the base64 method) but some 
   don’t, and I haven’t been able to figure out why some are not deferred (read 
   the faq’s etc.). I’ve also tried changing the order of the script tags with the
   same result. The scripts themselves are working fine.
 * What possible reasons are there that could cause some inline scripts to not be
   deferred?

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

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/some-inline-javascript-not-being-deferred/#post-15014834)
 * That would happen if for example the script is marked as “not to be deferred/
   asynced”, e.g. with the `data-cfasync` or if a `nonce` was found or if `document.
   write` was spotted in the JS wpuser000.
 * If you can share your site’s URL I’ll be happy to have a quick look at what is
   the root cause in your case?
 * frank
 *  Thread Starter [wpuser000](https://wordpress.org/support/users/wpuser000/)
 * (@wpuser000)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/some-inline-javascript-not-being-deferred/#post-15014940)
 * Thank you,
 * It doesn’t seem any of those apply to my code – is there a private way to share
   the website?
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/some-inline-javascript-not-being-deferred/#post-15014945)
 * you can mail me; futtta-at-gmail-dot-com 🙂
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/some-inline-javascript-not-being-deferred/#post-15015241)
 * Follow-up for others experiencing this; the root cause turned out to be the presence
   of `adsbygoogle` in the inline JS. To avoid impacting Google Ads displaying, 
   the presence of that string causes AO not to defer the JS.

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

The topic ‘Some inline javascript not being deferred’ 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/)

 * 4 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/some-inline-javascript-not-being-deferred/#post-15015241)
 * Status: resolved