GiveWP should enqueue scripts only on needed pages instead of adding it to the entire site
under review
Matheus Martins
As an admin, I want that GiveWP plugin enqueue scripts and styles only on the pages that load a form, a donor wall, or anything related to GiveWP,
instead
of loading it all over the website.Jason Adams
Greetings!
I just wanted to weigh in here. As we've looked into this, we're finding it would be a bit risky in our older systems to try and conditionally load scripts. That said, our newer systems (and new upcoming form system) do take these optimizations into consideration. We remain committed to making GiveWP performant and do so with an eye towards stability. Thank you for your patience as we continue to roll out improvements.
Catherine Mauch
Very late to be joining this thread but this is something that needs to be considered asap, my organisation may need to choose another donate platform because of GiveWP's impact on our new website's site speed.
GiveWP is a very heavy plugin which means it comes with lots of resources which take a long time to load. Although it needs those things to function, it only needs them where there is a donation form, not across the whole site. Unfortunately the way its been built means that it loads a lot of things it doesn't need to, which slows down the whole site.
GiveWP are aware that this is causing issues, and while it's on their list to fix, this doesn't seem to be a high priority despite it affecting all GiveWP customers.
Jason Adams
Greetings!
I just wanted to weigh in here. As we've looked into this, we're finding it would be a bit risky in our older systems to try and conditionally load scripts. That said, our newer systems (and new upcoming form system) do take these optimizations into consideration. We remain committed to making GiveWP performant and do so with an eye towards stability. Thank you for your patience as we continue to roll out improvements.
S
Steven Zedeck
Sorry to be joing this discussion so late. I was surprised to see lots of GiveWP code on every page of my site even though I only have 2 pages with donation forms. Many of my pages load very slow and I see "Waiting for m.stripe" for 3-5 seconds at the bottom on pages where there is no donation content.
Is there anything detailed that written as to how to customize the custom php snippit GiveWP provided? I really don't want to take down my newly created site. How and where do you specify what pages you don't want the scripts on and what pages you do want them on?
Thanks i advance.
B
Brandon W.
Curious if this is making any headway?
12 http requests and 156kb of data per page load is nothing to sneeze at! 🙂
Thank you!
Jason Adams
Brandon W.: I have this scheduled to be looked at by an engineer at during our next cool-down period in September. As mentioned, we can't guarantee a specific result, but I'm sure we can make some improvements!
B
Brandon W.
Jason Adams: Hey Jason, I understand. I thank you for keeping an eye on this though and putting it on the agenda to be looked into. Have a great day sir.
B
Brandon W.
Jason Adams: Any updates on this? We still cannot migrate to the new donations form due to the added GiveWP assets that load site wide. Thanks.
Jason Adams
Brandon W.: While we don't have a generic update for this, yet, we do have a snippet that we share with customers to dequeue GiveWP assets conditionally. This should give you the capability to prevent loading so you can move forward and not have to wait on us.
B
Brandon W.
Jason Adams: Appreciate it Jason. After some customization I have this working.
L
Lars Kemmann
An additional opportunity for (significant) improvement is the load time for the initial page (or second page, when the first is hidden) of a donation form.
The donation amount page doesn't even need to show the payment gateways, so all the logic related to the payment gateways should be loaded asynchronously after the user opens the donation form (it can load while the user is considering/making donation amount selections) rather than synchronously.
Even once the payment details page is shown, it doesn't need to actually show the fields for a payment gateway until the user actively selects a payment gateway.
It seems to me that this could all be delay-loaded and thus make a much better impression on the user.
OregonDean
This is a great opportunity for the GiveWP team to continue to show product ledership. Brabdon W says 12 calls and 156k of load for every page on my site. That adds up quickly. Perhaps a good start would be to merge all of the premium plugins into just two since that's how you sell them, and reduce some redundancy.
J
Jesse Matlock
OregonDean: Found a TEMP solution, for our scenario (your settings, server config, etc may be different).
For our multi-part form this script works to dequeue all give scripts and styles, except for the URLs structured for GiveWP's iframed forms.
IF you're using a different form setup (not multipart, etc) you may need to tweak this code to work with your situation - but it should be easy enough.
** Depending upon the GiveWP add-ons you are using, you may/may not need to dequeue all the scripts and styles we are dequeueing!!
To find out what scripts and styles are being registered/queued on your site you can use functions like these:
function discover_scripts(){
// Registered styles
var_dump(wp_styles()->registered);
// Queued styles
var_dump(wp_styles()->queue);
// Registered scripts
var_dump(wp_scripts()->registered);
// Queued scripts
var_dump(wp_scripts()->queue);
}
add_action( 'wp_enqueue_scripts', 'discover_scripts', 100 );
function inspect_script_style() {
global $wp_scripts, $wp_styles;
echo "\n" .'<!--'. "\n\n";
echo 'SCRIPT IDs:'. "\n";
foreach($wp_scripts->queue as $handle) echo $handle . "\n";
echo "\n" .'STYLE IDs:'. "\n";
foreach($wp_styles->queue as $handle) echo $handle . "\n";
echo "\n" .'-->'. "\n\n";
}
add_action('wp_print_scripts', 'inspect_script_style');
Use at your own risk.
Jason Adams
Jason Adams
under review
Thanks for the passionate input on this. We also take performance seriously and are regularly working to make GiveWP work smoothly and quickly. That said, in such a large codebase there are missed optimizations. I've gone ahead and marked this to get done between cycles, which means I can't guarantee a timeframe but it is on our list of things to do. In the meantime, understand that while this specific optimization may take time, we are working all over the plugin making frequent optimizations. 😃
B
Brandon W.
Jason Adams: Jason, I really appreciate this note and to know this is something you folks are now pursuing. Fantastic news and a fantastic way to approach improving GiveWP. Thanks to you and the team.
B
Brandon W.
GiveWP scripts and styles make up for 12 http requests and 156kb of data per page load, whether there is a donation form or not. We enqueue these, so they do not cause an extra burden for our site or our visitors. However, the new donation form does not allow for our current enqueue methods to work. Further, how many of your customers sites are being slowed down by GiveWP and they do not know it?
Donations are a serious thing, and to ensure happy givers, our sites need to be as optimized as possible. In fact, a “1 second delay in page load decreases customer satisfaction by 16 percent”. That means, if you enqueue your scripts and styles you are increasing customer satisfaction which in turn will increase donations.
Properly enqueuing your scripts and styles is good coding, web development, and good practice for your customers who rely on and trust your product. Please consider and implement this. Thank you.