Using mrgalaxy:stripe vs. npm stripe

Fair enough to put in the <head> if it helps reduce fraud.

My comment about it ‘being on every page’ despite Meteor apps being single-page, were that for SEO purposes it’s good to keep your landing pages as light as possible. If your Meteor app also serves your sales landing pages (with SSR), then all new visitors to your site don’t really need any payment libraries (except for fraud prevention as you say) - it will slow down loading time and time to interactive, which may hurt your SEO a little bit. That’s all.

4 Likes

When in doubt, use the NPM version of anything.

5 Likes

What we do in our apps is to load unnecesary js when everything else loads or on meteor.startup like this

Meteor.startup(() => {
    loadScript();
})

function loadScript() {
    const scriptTag = document.createElement('script');
    scriptTag.setAttribute('id', 'script-tag');
    scriptTag.setAttribute('src', 'YOUR_JS_FILE_URL');
    document.head.appendChild(scriptTag);
}

Or you could try using the npm package and use it with dynamic imports, or something similar.

I can confirm what @wildhart said . Adding Stripe’s script to the was delaying considerably our loading speed and negatively affecting our SEO. Using @wildhart function in the payment routes works great .

1 Like

yes, but if you only want the script when you need to checkout, then the script will be in the head of every landing page, delaying google’s ranking on every landing page.

We use the NPM package, with Stripe Checkout and simply store the token returned as a URL query parameter on a temporary URL. :slight_smile: For us…this was super easy to set up…huge time saver!

That’s fair. But I also wouldn’t add landing pages to my overall Meteor app. Our app runs on Meteor and our landing pages are static (for performance).

1 Like