I think GF 2.5 started adding a script to the very first line in the header that starts “if(!gform){document.addEventListener(“gform_main_scripts_loaded”,function(){gform.scriptsLoaded…”.
This script is placed on every page, regardless of whether there is a form on the page or not.
In a time of core web vitals, I would like to display this script only where it is really needed.
How can I achieve this? Or is it really needed on every page?
Thanks!
I have the same problem. Additionally this script is added before charset attribute in the theme and it’s causing an error on W3C validation. “Error : A charset attribute on a meta element found after the first 1024 bytes.”
The Product team are aware of this issue and are working on a fix, but none has been made available yet. I recommend contacting support https://www.gravityforms.com/support/ if you need any additional information. Thank you.
Once updated you’ll also need to clear/flush any caching and/or script optimization plugins and/or services the site is using as well as your browser cache.