Title: Uncaught ReferenceError and
Last modified: February 23, 2022

---

# Uncaught ReferenceError and

 *  Resolved [wly81](https://wordpress.org/support/users/wly81/)
 * (@wly81)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-and/)
 * Hi there,
 * I got two questions regarding your plugin. It helped me a lot speed up my site
   though.
 * 1. On any product page I get the following error in the console:
 *     ```
       Uncaught ReferenceError: Swiper is not defined
           loadGallery https://gesundbaumarktshop.de/wp-content/cache/autoptimize/js/autoptimize_single_3ed1e75336ce3a88d284f3baa008c5ca.js?ver=1.2.8:1
           loadGalleryScripts https://gesundbaumarktshop.de/wp-content/cache/autoptimize/js/autoptimize_single_3ed1e75336ce3a88d284f3baa008c5ca.js?ver=1.2.8:21
           triggerGalleryScriptLoader https://gesundbaumarktshop.de/wp-content/cache/autoptimize/js/autoptimize_single_3ed1e75336ce3a88d284f3baa008c5ca.js?ver=1.2.8:20
           EventListener.handleEvent* https://gesundbaumarktshop.de/wp-content/cache/autoptimize/js/autoptimize_single_3ed1e75336ce3a88d284f3baa008c5ca.js?ver=1.2.8:20
           <anonymous> https://gesundbaumarktshop.de/wp-content/cache/autoptimize/js/autoptimize_single_3ed1e75336ce3a88d284f3baa008c5ca.js?ver=1.2.8:20
       ```
   
 * Any idea how to fix this? I absolutely have no clue what it means :/
 * 2. I got a CriticalCSS subscription and when I tried to paste the API into Autoptimizer
   and clicked on save I always got the error “link invalid” or “timed out” or something
   like that. I then installed the “Autoptimize CriticalCSS.com Power-Up”-Plugin
   as well and then it worked. Is that how its supposed to be? Or is there any way
   to make it work without the second plugin?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Funcaught-referenceerror-and%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-and/#post-15395677)
 * re (1); that seems to be from Commerceguru’s, try excluding `wp-content/plugins/
   commercegurus-commercekit` OR enable “don’t aggregate but defer” + “also defer
   inline JS” and then remove all default exclusions?
 * re (2); the power-up should not be needed any more really, can you make a screenshot
   of the issue when the power-up is not active + check the PHP errorlog for relevant
   errors?
 *  Thread Starter [wly81](https://wordpress.org/support/users/wly81/)
 * (@wly81)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-and/#post-15395923)
 * Thank you for your quick reply!
 * 1: Excluding changed the “autoptimize” in the error to something like commercecurus
   gallery and the other option didnt really do anything. But now I know where the
   error comes from, its the faster beta gallery of my theme so I will ask their
   support 😉 thanks a lot
 * 2: [https://imgur.com/fwtmzin](https://imgur.com/fwtmzin) Thats what happens 
   when I enter my API key and click on “save changes” without the power-up.
    Where
   to I see the php error log?
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-and/#post-15395938)
 * re (1) in that case there indeed seems to be a bug in the gallery code
 * re (2) can you log out of WordPress, clear cache and cookies, log back an and
   test if this still happens? re. php errorlog: depends on how the server/ php 
   was set up, maybe ask your host/ sysadmin?
 *  Thread Starter [wly81](https://wordpress.org/support/users/wly81/)
 * (@wly81)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-and/#post-15396093)
 * (2) Thanks a lot, that did the trick!
    I logged into wordpress using another 
   browser and noticed that it looked like my API key was already active and working
   in autoptimize so I cleared the cache of the browser I was using before (Firefox)
   and relogged into WP and it also worked there. Problem solved now I guess, thank
   you very much!
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-and/#post-15396112)
 * you’re welcome, feel free to [leave a review of the plugin and support here](https://wordpress.org/support/plugin/autoptimize/reviews/#new-post)!
   🙂
 * greetings from Belgium,
    frank

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Uncaught ReferenceError and’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

## Tags

 * [criticalcss](https://wordpress.org/support/topic-tag/criticalcss/)

 * 5 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-and/#post-15396112)
 * Status: resolved