Title: Google Analytics stops working when Optimize JavaScript Code
Last modified: July 2, 2019

---

# Google Analytics stops working when Optimize JavaScript Code

 *  Resolved [fredsjo](https://wordpress.org/support/users/fredsjo/)
 * (@fredsjo)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/google-analytics-stops-working-when-optimize-javascript-code/)
 * Hi
    I have tried many apps for getting down my load time, and Autoptimize is 
   the first that does the job for me without any bugs. I thought…. :I
 * When I tested Google Analytics I see that I can’t see any of my customers. Its
   not recording anything. So I have tried to add this to the JS Excludes: `js/ganalytics.
   js, analytic.js`
 * What can I do?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fgoogle-analytics-stops-working-when-optimize-javascript-code%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/google-analytics-stops-working-when-optimize-javascript-code/#post-11695257)
 * I had a look at the HTML source code and the analytics JS is properly excluded.
   I do however see a “jQuery is not defined” error on the browser console and I
   guess that is blocking execution of other inline JavaScript, so try (re-)adding`
   js/jquery/jquery.js` to the comma-separated JS optimization exclusion list maybe?
 * hope this helps,
    frank
 *  Thread Starter [fredsjo](https://wordpress.org/support/users/fredsjo/)
 * (@fredsjo)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/google-analytics-stops-working-when-optimize-javascript-code/#post-11695384)
 * Thank you so much for the quick response.
 * I added js/jquery/jquery.js again, and yeah. That fixed it. But the the mobile
   speed drops 9p at Pagespeed. That was the reason I removed js/jquery/jquery.js
   from excluded.
 * Is there any workaround?
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/google-analytics-stops-working-when-optimize-javascript-code/#post-11695388)
 * > Is there any workaround?
 * yeah; removing/ replacing all plugins that require jQuery to be available early
   🙂

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

The topic ‘Google Analytics stops working when Optimize JavaScript Code’ 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/)

 * 3 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/google-analytics-stops-working-when-optimize-javascript-code/#post-11695388)
 * Status: resolved