Hi there,
I've just published a new Toolset website and for the first time I'm getting very low results for Speed performances (around 40 for mobile). I'm using SG Optimizer for caching ect but I'm trying to see if there's anything else that I can do.
I've tried activating the Defer Render-blocking JavaScript option in SG Optimizer but then both the map and the view of brand logos at the bottom is messed up. I can exclude some JS from being deferred, so I tried the ones selected at the top of the attached screenshot. It sorted it out for the View but the map still disappears. Would you be so kind as to indicate which JS corresponds to the map so I can exclude it?
Thank you very much
Hi there,
From the screenshot that you gave, under the Others category, none of the options are part of Toolset.
But maybe you need to avoid deferring the core jQuery file.
From what I know these are the files that Toolset Map loads:
/wp-content/plugins/toolset-maps/resources/js/jquery.geocomplete.min.js
/wp-content/plugins/toolset-maps/resources/js/views_filter_distance_frontend.js
/wp-content/plugins/toolset-maps/resources/js/wpv_addon_maps.js
Even the files above are not loaded every time, it depends on which option of the Maps plugin is used on that particular page.
That is what I can help with in terms of the JS files loaded by the Maps plugin.
Thanks.
Thank you, Christopher...I see.
So, the problem might be with Google Maps JS itself. How can I add "async" and "defer" to the Maps JS in Toolset then?
Thank you
Hi there,
I am afraid that is not possible, the reason is that you will need to change the core code of Toolset and whatever you do it will be deleted the next time you update the Toolset Maps plugin.
One thing that I can suggest is that you force Toolset not to load the Google Maps Javascript code altogether by adding the code below to functions.php file of your theme:
function my_dequeue_script() {
wp_deregister_script( 'google-maps' );
wp_dequeue_script( 'google-maps' );
}
add_action( 'wp_print_scripts', 'my_dequeue_script', 200 );
Then you can decide how to add the Javascript code yourself and whenever you want.
But this goes into the custom coding realm which is outside of our support scope.
You are welcome to hire a developer for such a customization:
https://toolset.com/contractors/
Thanks.
I see. Thank you for your answer