Assets optimization

Hello,
We’d like to furthermore optimize our WPMU setup by not loading assets that aren’t required.

As an exemple, on our homepage, we load:
https://js.stripe.com/v3/ (only used for WP Simple Pay)
Reference: https://gtmetrix.com/reports/www.magikweb.ca/HuZa8D37

We would like to load it only on pages where the shortcodes of that plugin are used.

We have a similar code that works for Contact Form 7, but wondered how everyone optimizes that since a LOT of plugins actually load libraries everywhere even when unneeded.

CF7 optimization code:

/* Speed - Optimize Contact Form 7 by loading its scripts only when needed */
function wpcf7o_dequeue_scripts() {
    $load_scripts = false;
    if( is_singular() ) {
    	$post = get_post();

    	if( has_shortcode( $post->post_content, 'contact-form-7' ) ) {
        	$load_scripts = true;
    	}
    }
    if( ! $load_scripts ) {
        wp_dequeue_script( 'contact-form-7' );
        wp_dequeue_style( 'contact-form-7' );
    } else {
	add_action( 'wp_head', 'wpcf7o_track_mailsent' );
    }
}
if ( function_exists( 'wpcf7_enqueue_scripts' ) )
	add_action( 'wp_enqueue_scripts', 'wpcf7o_dequeue_scripts', 99 );