• Resolved primewebsa

    (@primewebsa)


    When SG Optimizer plugin is activated in my wordpress site, Lucky Orange doesn’t work.

    When I deactivate SG Optimizer plugin, Lucky Orange works.

    Errors in Inspect/Console:

    Uncaught ReferenceError: consentCookieParser is not defined
    at insight.beta.min.js:1

    GET https://settings.luckyorange.com/undefined 404 / siteground-optimizer-combined-js-6428a43ffa156a3dafe1aaeabe7c6713.js:146

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Delyan Delov

    (@delyandelov)

    Hello @primewebsa,

    Currently, there is no content on the provided URL:

    curl -I  https://settings.luckyorange.com/
    HTTP/2 204
    date: Thu, 17 Feb 2022 20:09:43 GMT
    via: 1.1 google

    Have you tried disabling some of the SG Optimizer options or the problem persists even if all options are disabled?

    If the issue is caused by some of the optimizations, we have implemented exclude functionality for almost all of them, so you can try excluding the problematic script.

    If none of the above is working, you can contact Lucky Orange’ support so they can provide more information on why our plugin is preventing their services from working.

    Thread Starter primewebsa

    (@primewebsa)

    I tried disabling some SG Optimizer options.

    When I disabled Combine JavaScript Files, Lucky Orange started working.

    But we these new errors:

    GET https://api-preview.luckyorange.com/visitors/568702c7-1645129708806-041ac046cf5f8853 404

    Uncaught (in promise) Error: Request failed with status code 404
    at e.exports (chunk-vendors.bf0111d3.js:7)
    at e.exports (chunk-vendors.bf0111d3.js:13)
    at XMLHttpRequest._ (chunk-vendors.bf0111d3.js:28)

    Plugin Support Delyan Delov

    (@delyandelov)

    Thank you for the update!

    In this case, you can either keep the Combine JavaScript Files option disabled or exclude the problematic script.

    Regarding the error from the browser’s console, it appears that the JS script cannot be found on the server. You can try disabling the other JavaScript optimization options and eventually exclude the script from some of them.

    • This reply was modified 2 years, 9 months ago by Delyan Delov.
    Thread Starter primewebsa

    (@primewebsa)

    Thank you. I’d like to exclude the script from:

    Exclude from JavaScript Minification
    Exclude from JavaScript Combination
    Exclude from Deferral of Render-blocking JS

    How would I do that?

    When I open the ‘exclude’ options below each item, I don’t see an option in the dropdown menus. Is there a way to add it manually?

    Thank you!

    Plugin Support Delyan Delov

    (@delyandelov)

    You can do that by using the filters we have designed for that purpose:

    Exclude from JavaScript Minification

    add_filter( 'sgo_js_minify_exclude', 'js_minify_exclude' );
    function js_minify_exclude( $exclude_list ) {
        $exclude_list[] = 'script-handle';
        $exclude_list[] = 'script-handle-2';
    
        return $exclude_list;
    }

    Exclude from JavaScript Combination

    add_filter( 'sgo_javascript_combine_exclude', 'js_combine_exclude' );
    function js_combine_exclude( $exclude_list ) {
        $exclude_list[] = 'script-handle';
        $exclude_list[] = 'script-handle-2';
    
        return $exclude_list;
    }

    Exclude from Deferral of Render-blocking JS

    add_filter( 'sgo_js_async_exclude', 'js_async_exclude' );
    function js_async_exclude( $exclude_list ) {
        $exclude_list[] = 'script-handle';
        $exclude_list[] = 'script-handle-2';
    
        return $exclude_list;
    }

    More information on how to use these filters can be found in this thread:
    https://www.ads-software.com/support/topic/how-to-use-sg-optimizers-filters-procedure/

    Thread Starter primewebsa

    (@primewebsa)

    Thank you for that info.

    I’ve gone through that process, installed plugin and scripts.
    So I can edit the scripts, I searched for ‘data-handle’ and ‘handle’ in search console as directed, but no results were found.

    The script in question is

    <script async defer src=”https://tools.luckyorange.com/core/lo.js?site-id=xxxxxxxx”></script&gt;

    Any additional help on how to edit the scripts would be appreciated!

    @primewebsa,

    Please allow me to assist.

    Perform the following to identify the “data-handle” (i.e., “script-handle”) referenced in the filters provided by @delyandelov:

    (1) Install the plugin, Code Snippets.
    (2) Create a new code snippet with the information provided below.
    (3) Set the code snippet to “Run snippet everywhere”, save and activate it.
    (4) Visit you website, right click, and select “View page source”.
    (5) When the page source displays, press CTRL+F (search box will appear).
    (6) Enter “data-handle” in the search box. If done right, you should see something like this: https://ibb.co/NVK6sgF
    (7) Click the down arrow inside the search box to identify all “data-handle”(s) inside your web page. For example, the “data-handle” (i.e., “script-handle”) for jQuery is “jquery-core”.
    (7) Once you identify the “data-handle”(s) that are potentially causing your issue, enter them into the above filter(s) where it says “script-handle”, “script-handle2”, etc.
    (8) Run the above filter(s) with your “data-handle”(s) until your issue is solved.

    Note: You can also use the plugin, Code Snippets, to run the above filters.

    Hope this helps.

    Best wishes!

    ————————–

    Code Snippet to Activate Website Data-Handle (otherwise known as “Script-Handle”):

    <?php
    add_filter( 'script_loader_tag', 'cameronjonesweb_add_script_handle', 10, 3 );
    function cameronjonesweb_add_script_handle( $tag, $handle, $src ) {
    	return str_replace( '<script', sprintf(
    		'<script data-handle="%1$s"',
    		esc_attr( $handle )
    	), $tag );
    }
    Thread Starter primewebsa

    (@primewebsa)

    I think we’re all set. Thank you for the info. Please close.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘SG Optimizer blocks Lucky Orange’ is closed to new replies.