• Resolved Rajkiran Bagal

    (@rajkiranb)


    Hello, Speed Optimizer Team,

    I am in the Development Team of SureCart plugin.

    I am writing on behalf of one of our customer’s.

    We are adding an inline script on wp_head hook like below from our plugin:

    wp_add_inline_script(
    			'surecart-affiliate-tracking',
    			'window.SureCartAffiliatesConfig = {
    				"publicToken": "' . \SureCart::account()->public_token . '",
    				"baseURL":"' . esc_url_raw( untrailingslashit( SURECART_API_URL ) ) . '/v1"
    			};',
    			'before'
    		);

    But the script tag does not render on the frontend when Speed Optimizer plugin is active.

    The user has Minification, Combination & Defer settings enabled, but even after disabling those the script does not render.

    Can you please help us by providing us some inputs on what we can check to fix this issue?

    Looking forward to hearing from you.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Pavel Dosev

    (@pdosev)

    Hello @rajkiranb,

    You can try excluding the inline script from the SG-optimizer combination by using our custom filters:

    https://www.siteground.com/tutorials/wordpress/speed-optimizer/custom-filters/#Plugin_Compatibility

    add_filter( 'sgo_javascript_combine_excluded_inline_content', 'js_combine_exclude_inline_script' );
    function js_combine_exclude_inline_script( $exclude_list ) {

    $exclude_list[] = 'window.SureCartAffiliatesConfig = {';

    return $exclude_list;
    }


    If the problem persists, it would be better to submit a ticket to our support team through the User Area with additional details on how to recreate the issue. We can then check it on the website itself.

    Thread Starter Rajkiran Bagal

    (@rajkiranb)

    Hey @pdosev ,

    Thank you for your swift assistance!

    The filter worked & now the inline script is rendering.

    Have a great day!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Inline WP Scripts not loading on frontend page.’ is closed to new replies.