How to Exclude CookieYes Script from SG Optimizer Plugin
Last updated on March 14, 2024
Using CookieYes and SiteGround Optimizer (SG Optimizer) together on your WordPress website might lead to compatibility issues that affect the proper functioning of CookieYes. Specifically, the SG Optimizer’s caching and optimisation function may interact with CookieYes’s script, resulting in unexpected behaviour such as an empty or error-prone cookie banner. To prevent this, exclude the CookieYes script from SG Optimizer’s optimization. By doing so, you ensure the proper functionality of CookieYes while still having the benefits of using SG Optimizer.
Steps to exclude CookieYes script from the SiteGround Optimizer plugin
Step 1: Log in to your WordPress admin dashboard and navigate to Appearance > Theme File Editor.
Step 2: In the list of theme files on the right, find and click on Theme Functions (functions.php).
Step 3: Scroll down to the code editor section and add the following snippet at the end of the file, just before the closing “?>” tag, if present:
add_filter( 'sgo_javascript_combine_excluded_external_paths', 'js_combine_exclude_external_script' ); function js_combine_exclude_external_script( $exclude_list ) { $exclude_list[] = 'cdn-cookieyes.com'; return $exclude_list; }
Step 4: Click the Update File button to save the changes. And then, clear the cache of your website to reflect the update. After completing these steps, the cookie banner should no longer be empty or show errors.