Hard to say without seeing your site, but generally; in the JS optimization exclusion field you can add wp-content/plugins/pluginname/js/whateverjsfile.js to exclude one specific JS-file or plugins/pluginname to exclude the entire plugin or in case of inline JS you can look for a unique parameter name and exclude that.
Specifically; AO should leave the default GA code be, but in case you have a non-default implementation you might have to exclude using a parameter name in the inline JS or if you’re using a plugin to add GA code, you might have to exclude that plugin.
Re. twig file; that is a PHP templating framework, AO has no knowledge of that (it gets the HTML from WordPress and alters that), you’ll have to exclude based on the contents of that template.
hope this helps,
frank
Thanks for the reply, here is the url of my website
https://istick.com.au/
can I add /scripts.twig in the JS optimization exclusion field
there’s no scripts.twig mentioned in the HTML source anywhere (which makes sense as twig is a PHP template), so you’ll have to exclude the JS that is in the template impex23 .
Okay thanks for the reply, I will check with it and let you know
I have one more issue with the Lazysizes.min.js not getting cached
wp-content/plugins/autoptimize/classes/external/js/lazysizes.min.js
can you please suggest me how to fix this issue as I am semrush errors for this particular file path as uncached or unminified files
the only thing I can think of is that lazysizes.min.js comes with a version parameter and that “in the old days” this was considered to result in some caching proxies not being able to cache the resource (which is not correct). if you go to Settings -> Autoptimize -> Extra you can tick the “Remove query strings from static resources” and the parameter should be gone 🙂
Okay this setting option is done already – Settings -> Autoptimize -> Extra you can tick the “Remove query strings from static resources” but I am not talking about the version instead I am asking that this file is not getting cached and we are getting error in semrush as Uncached or unminified files, how to fix this issue please guide us. Thank you
the only thing I can think of are missing expires headers, but that typically is done on web-server level, see e.g. https://webmasters.stackexchange.com/questions/5265/how-do-i-set-expiration-headers-for-css-js-and-images for info of how to do that for Apache.
Okay I will check with this, thanks for the quick response