How to Exclude CookieYes Script from SG Optimizer Plugin
Last updated on June 2, 2025
On this page
Overview
Steps to exclude CookieYes script from the SiteGround Optimizer plugin
Step 1:
Access the Theme File Editor

Step 2:
Locate Theme Functions File

Step 3:
Add the Exclusion Code
add_filter( 'sgo_javascript_combine_exclude_ids', 'js_sgo_javascript_combine_exclude_ids' );
function js_sgo_javascript_combine_exclude_ids( $exclude_list ) {
$exclude_list[] = 'cookie-law-info-gcm-var-js';
$exclude_list[] = 'cookie-law-info-gcm-js';
$exclude_list[] = 'cookie-law-info-wca';
$exclude_list[] = 'cookieyes-banner';
$exclude_list[] = 'cookieyes';
return $exclude_list;
}
Step 4:
Save Your Changes and Clear the Cache
Conclusion
By excluding the CookieYes script from SG Optimizer’s optimization process, you can resolve compatibility issues while maintaining the benefits of both plugins. This solution ensures that your website’s cookie consent management functions correctly without compromising on performance optimization.