Title: Deferring external scripts
Last modified: May 19, 2021

---

# Deferring external scripts

 *  Resolved [pulc001](https://wordpress.org/support/users/pulc001/)
 * (@pulc001)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/deferring-external-scripts/)
 * Hello everyone,
 * I have just installed wp-optimize. I would like to eliminate a render blocking
   resource for my analytics script. The external js script being called is:
 * [https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-x](https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-x)
 * I have tried the below configurations but does not seem to be working when re
   running page insight tests:
 * [https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-x](https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-x)
   /
   gtag/js?id=UA-xxxxxxxxx-x
 * My question what notation should I use in the “defer selected JavaScript files”
   option to enable this external script to defer load?
 * thank you.
    -  This topic was modified 5 years, 3 months ago by [pulc001](https://wordpress.org/support/users/pulc001/).
    -  This topic was modified 5 years, 3 months ago by [pulc001](https://wordpress.org/support/users/pulc001/).

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

 *  [Harshad](https://wordpress.org/support/users/bornforphp/)
 * (@bornforphp)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/deferring-external-scripts/#post-14460651)
 * [@pulc001](https://wordpress.org/support/users/pulc001/) You’ll have to add the
   full url the inside WP-Optimize > Minify > Javascript > Defer Javascript > Defer
   selected JavaScript files
 *  Thread Starter [pulc001](https://wordpress.org/support/users/pulc001/)
 * (@pulc001)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/deferring-external-scripts/#post-14460887)
 * Hello Harshad,
 * thank you for your reply.
 * It is already configured that way in the plugin.
 * Still this is being picked up as blocking resource by page insights.
 * URL is [IT Service Provider](https://elev8.mt/)
 * JS merging and minification settings are all ticked off from the settings as 
   well.
 *  I am also using monster insights plugin from analytics. could this be the issue?
    -  This reply was modified 5 years, 3 months ago by [pulc001](https://wordpress.org/support/users/pulc001/).
 *  [Harshad](https://wordpress.org/support/users/bornforphp/)
 * (@bornforphp)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/deferring-external-scripts/#post-14465334)
 * [@pulc001](https://wordpress.org/support/users/pulc001/) Can you please make 
   sure you are using the latest version of WP-Optmize plugin?
 *  Thread Starter [pulc001](https://wordpress.org/support/users/pulc001/)
 * (@pulc001)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/deferring-external-scripts/#post-14465506)
 * [@harshad](https://wordpress.org/support/users/harshad/), yes I am running 3.1.9
 *  [Harshad](https://wordpress.org/support/users/bornforphp/)
 * (@bornforphp)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/deferring-external-scripts/#post-14469663)
 * [@pulc001](https://wordpress.org/support/users/pulc001/) Can you please try to
   remove the query string from the Google Tag manager url and check if it works?
   i.e. remove ?id=UA-xxxxxxxxx-x part
 *  Thread Starter [pulc001](https://wordpress.org/support/users/pulc001/)
 * (@pulc001)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/deferring-external-scripts/#post-14471942)
 * [@harshad](https://wordpress.org/support/users/harshad/) I have tried that and
   many other combinations including wildcards (*) as per the list below:
 * /js/frontend-gtag.min.js
    /wp-content/plugins/google-analytics-for-wordpress/
   assets/js /wp-content/plugins/google-analytics-for-wordpress/* [https://elev8.mt/wp-content/plugins/google-analytics-for-wordpress/assets/js/frontend-gtag.min.js](https://elev8.mt/wp-content/plugins/google-analytics-for-wordpress/assets/js/frontend-gtag.min.js)
   [https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-x](https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-x)
   [https://www.google-analytics.com/analytics.js](https://www.google-analytics.com/analytics.js)/
   gtag/js?id=UA-xxxxxxxxx-x
 * somehow page insights is still reporting a render block for my analytics script.
   What makes the issue more strange is that even if I choose the defer all javascripts
   option page insight still repots a render block.
    -  This reply was modified 5 years, 3 months ago by [pulc001](https://wordpress.org/support/users/pulc001/).
 *  [Harshad](https://wordpress.org/support/users/bornforphp/)
 * (@bornforphp)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/deferring-external-scripts/#post-14473984)
 * [@pulc001](https://wordpress.org/support/users/pulc001/) I’ll check this with
   our development team and update you soon on this.
 * Thank you for your time and patience.
    -  This reply was modified 5 years, 2 months ago by [Harshad](https://wordpress.org/support/users/bornforphp/).
 *  Thread Starter [pulc001](https://wordpress.org/support/users/pulc001/)
 * (@pulc001)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/deferring-external-scripts/#post-14479332)
 * no worries [@harshad](https://wordpress.org/support/users/harshad/), on the contrary
   thank you. if you need any more information on the matter for the developers 
   do let me know.
 *  Plugin Support [vupdraft](https://wordpress.org/support/users/vupdraft/)
 * (@vupdraft)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/deferring-external-scripts/#post-14513700)
 * [@pulc001](https://wordpress.org/support/users/pulc001/)
    WP-Optimize cannot 
   defer completely external scripts at this time

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

The topic ‘Deferring external scripts’ is closed to new replies.

 * ![](https://ps.w.org/wp-optimize/assets/icon-256x256.png?rev=1552899)
 * [WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance](https://wordpress.org/plugins/wp-optimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-optimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-optimize/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-optimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-optimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-optimize/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [vupdraft](https://wordpress.org/support/users/vupdraft/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/deferring-external-scripts/#post-14513700)
 * Status: resolved