lscache_wp icon indicating copy to clipboard operation
lscache_wp copied to clipboard

Exclude Stripe JS and more

Open FPCSJames opened this issue 4 years ago • 5 comments

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.

FPCSJames avatar Sep 30 '20 21:09 FPCSJames

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.

FPCSJames avatar Sep 30 '20 22:09 FPCSJames

Can you list example codes where used google-analytics.com? Thanks.

hi-hai avatar Oct 07 '20 20:10 hi-hai

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.

FPCSJames avatar Oct 07 '20 22:10 FPCSJames

Based on the testing, recaptcha can be localized at this moment.

hi-hai avatar Oct 16 '20 12:10 hi-hai

@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!!!

Contributolo avatar Feb 13 '21 12:02 Contributolo