lscache_wp
lscache_wp copied to clipboard
Exclude Stripe JS and more
Always exclude js.stripe.com to prevent fatal breakage. Also exclude: reCAPTCHA JS, UserWay accessibility widget, and any inline JS that loads a script from google-analytics.com.
For reCAPTCHA, Google starts their JS with a comment that says "PLEASE DO NOT COPY AND PASTE THIS CODE". They clearly don't intend for local copies.
Can you list example codes where used google-analytics.com? Thanks.
Anything that drops in a standard Universal Analytics embed code like this:
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
Various plugins and user-inserted snippets will appear similar. Excluding google-analytics.com has the same effect as excluding gtag, which you already have defined.
Based on the testing, recaptcha can be localized at this moment.
@hai could you please add to js_excludes.txt:
wp-content/plugins/spotlight-social-photo-feeds
wp-content/plugins/spotlight-social-photo-feeds-premium
I tried it and it is working. Reference: https://docs.spotlightwp.com/article/757-autoptimize-compatibility
Thank you!!!