Stripe API JS - Deferred/Async Loading or More Control to Disable

Currently, on enabling the Members, stripe API JS file is being added to the Head section, even if the subscription is free.

This script is loaded synchronously and it affects the Page Speed as main thread is blocked.

Can you please provide more control over this?

Or make members.js and stripe API load in async?

Decisions taken for GhostCMS are also gonna affect the Self Hosted Blogs, even though it is optimized for Ghost Paid Plans

I think we already had an issue to track this - @rishabhgarg do you know where that got to?

Note: This has nothing at all to do with self hosting vs Ghost(Pro) - it’s not in any way related.

@pankaj It was recently reported in another thread, and the fix for this will be part of next Ghost release, with stripe JS loaded as async to unblock the main thread. The members.js script is being deferred loaded on the page for a while now so thats not a blocker already.

Side-note: The stripe JS is only added to the head section if a Stripe account is connected in Ghost-Admin. If members is enabled for free subscriptions but no Stripe account is connected, the Stripe script is not added on page at all. :slight_smile:

1 Like

@rishabhgarg I want to have members features but I am not charging fees for it, I only want newsletters to be sent out.

And even though I have enabled Free signup; stripe JS is loading.

Only way to turn it off is to disable the Members feature.

Can there be any other way?

@pankaj You don’t need to turn off Members to remove Stripe from loading, and can continue using it to send newsletters with free setup. If you had enabled members but never connected Stripe to your account via Admin, then Ghost does not load Stripe JS by default on latest Ghost version, nothing else needs to be done.

The only way Stripe JS could have been still added to your page was if you had either previously entered Stripe keys to your account (even if not used) or if you had switched on enableDeveloperExperiments flag via Ghost config, which is not done by default for production. Please make sure that’s not the case and you should not have any issues working with free members setup. :slight_smile:

Update: The async load behavior for Stripe JS in page head was released in Ghost 3.29.2 :slight_smile:

1 Like

Thanks a lot @rishabhgarg fro the update.