Title: Autoptimize and EME javascript
Last modified: December 2, 2019

---

# Autoptimize and EME javascript

 *  Resolved [Argentum](https://wordpress.org/support/users/argentum/)
 * (@argentum)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/autoptimize-and-eme-javascript/)
 * Hi!
    Today we realised that our configuration of EME and Autoptimize javascript
   aggregation stopped the booking of events from accepting bookings. The event 
   booking forms worked and everything seemed fine, but for one thing. The new booking
   was never created. I tested the booking with Chrome dev console open and no errors.
   I then disabled Autoptimize javascript aggregation and the EME bookings started
   working again. We have quite a few javascript exclusions for EME in use already:
   events-made-easy/js/eme_location_map.js, events-made-easy/js/eme.js, events-made-
   easy/js/client-clock.js, latitude_, longitude_, map_text_
 * Is there some new javascript file that should be added to the exclusion list?
    -  This topic was modified 6 years, 5 months ago by [Argentum](https://wordpress.org/support/users/argentum/).

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

 *  [Ambyomoron](https://wordpress.org/support/users/josiah-s-carberry/)
 * (@josiah-s-carberry)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/autoptimize-and-eme-javascript/#post-12196715)
 * For what it’s worth, I use both plugins (latest versions) and do not have this
   issue. Might it be necessary to clear the Autoptimize cache? Or other caches 
   you might be using?
 *  Thread Starter [Argentum](https://wordpress.org/support/users/argentum/)
 * (@argentum)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/autoptimize-and-eme-javascript/#post-12196752)
 * Possibly. But I am asking the author just the same if any javascript file we’re
   not excluding at the moment but should exclude. And it was a very sneaky error.
   The look and behaviour of the form suggested that the booking was made, but no
   confirmation mail was sent and no booking added in the EME backend.
 *  [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/autoptimize-and-eme-javascript/#post-12196774)
 * Any JS errors on the browser console?
 * You could always try with `plugins/events-made-easy` as catch-all exclusion +
   untick the “also aggregate inline JS” option to ensure no inline EME JS gets 
   aggregated?
 *  Plugin Author [Franky](https://wordpress.org/support/users/liedekef/)
 * (@liedekef)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/autoptimize-and-eme-javascript/#post-12196812)
 * Sometimes I try using an optimizer plugin and never encountered problems. I try
   to use the wordpress standards for enqueueing scripts (and some inline javascript
   might be needed too, but I try to avoid it). I always wonder how optimizers handle
   scripts that get translated by wordpress (to replace certain strings) …
    Anyway,
   for now I’d say to exclude everything in events-made-easy/js, but for the frontend
   purely related to bookings this is limited to eme.js (fdatepicker, eme_location_map.
   js, eme_autocomplete_rsvp.js and others are used too, but not for the booking
   itself).
 *  [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/autoptimize-and-eme-javascript/#post-12196834)
 * > I always wonder how optimizers handle scripts that get translated by wordpress(
   > to replace certain strings) …
 * Well, Autoptimize by default leaves inline JS as is 🙂
 *  Thread Starter [Argentum](https://wordpress.org/support/users/argentum/)
 * (@argentum)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/autoptimize-and-eme-javascript/#post-12196933)
 * I see no errors in the console, apart from
    Uncaught TypeError: Cannot read property‘
   language’ of undefined at fdatepicker.sv.js?ver=2.1.54:12 at fdatepicker.sv.js?
   ver=2.1.54:9 at fdatepicker.sv.js?ver=2.1.54:11
 * I added the exclusion rule events-made-easy/js. Seems to be working now.
 * Would be nice to receive a mail to the admin account if a booking fails … 😉
 *  Plugin Author [Franky](https://wordpress.org/support/users/liedekef/)
 * (@liedekef)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/autoptimize-and-eme-javascript/#post-12196966)
 * There is indeed a typo in the language file js/fdatepicker/js/i18n/fdatepicker.
   sv.js
    It currently has the line: $.fn.datepicker.language which should be: $.
   fn.fdatepicker.language
 * That will solve the issue for you. I’ll verify all those this evening to make
   sure all are correct.
 * [@optimizingmatters](https://wordpress.org/support/users/optimizingmatters/) :
   I mean the following: eme.js is a javascript file, but wordpress replaces strings
   in that file using wp_localize_script. So I wonder how an optimizer handles those
   replacements via done wp_localize_script.
    I still find it weird that it wouldn’t
   work, and I’m always willing to learn to make sure the code works with optimizers
   too (and in my tests it works just fine).
 *  [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/autoptimize-and-eme-javascript/#post-12197112)
 * [@liedekef](https://wordpress.org/support/users/liedekef/) wp_localize_script
   leaves eme.js (which is just a static file) be and adds the transalations in 
   inline JS, e.g.
 *     ```
       <script type='text/javascript'>/* <![CDATA[ */
       var emebasic = {"translate_plugin_url":"https:\/\/www.e-dynamics.be\/wordpress\/wp-content\/plugins\/events-made-easy\/","translate_ajax_url":"https:\/\/www.e-dynamics.be\/wordpress\/wp-admin\/admin-ajax.php","translate_selectstate":"State","translate_selectcountry":"Country","translate_frontendnonce":"2bb6d6e9a5","translate_error":"An error has occurred","translate_clear":"Clear","translate_mailingpreferences":"Mailing preferences","translate_yessure":"Yes, I'm sure","translate_iwantmails":"I want to receive mails","translate_firstDayOfWeek":"0","translate_flanguage":"en","translate_fdateformat":"D j M Y","translate_ftimeformat":"H:i"};
       /* ]]> */</script>
       <script type='text/javascript' defer="defer" src='https://www.e-dynamics.be/wordpress/wp-content/plugins/events-made-easy/js/eme.js?ver=2.1.54'></script>
       ```
   
 * and indeed AO leaves that inline part (except if “also aggregate inline JS” is
   activated by the user) be 🙂
 * groeten uit Lokeren,
    frank

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

The topic ‘Autoptimize and EME javascript’ is closed to new replies.

 * ![](https://ps.w.org/events-made-easy/assets/icon-256x256.png?rev=1856035)
 * [Events Made Easy](https://wordpress.org/plugins/events-made-easy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-made-easy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-made-easy/)
 * [Active Topics](https://wordpress.org/support/plugin/events-made-easy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-made-easy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-made-easy/reviews/)

 * 8 replies
 * 4 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/autoptimize-and-eme-javascript/#post-12197112)
 * Status: resolved