Title: host Google java-scripts locally for faster loading
Last modified: April 16, 2020

---

# host Google java-scripts locally for faster loading

 *  Resolved [peraburek](https://wordpress.org/support/users/peraburek/)
 * (@peraburek)
 * [6 years ago](https://wordpress.org/support/topic/host-google-java-scripts-locally-for-faster-loading/)
 * hello,
 * I would like to host google java scripts locally for faster website loading (
   less DNS lookups)
 * something like
    CAOS | Host Google Analytics Locally [https://wordpress.org/plugins/host-analyticsjs-local/](https://wordpress.org/plugins/host-analyticsjs-local/)
 * **Can you please add support for locally hosted scripts?**
 * gtag.js
    [https://www.googletagmanager.com/gtag/js?id=UA-“123&#8230](https://www.googletagmanager.com/gtag/js?id=UA-“123&#8230);.”
 * analytics.js
    [https://www.google-analytics.com/analytics.js](https://www.google-analytics.com/analytics.js)
 * at the moment Plugin “CAOS | Host Google Analytics Locally” doesn’t support ec.
   js file but I guess that could be solved
 * ec.js
    [https://www.google-analytics.com/plugins/ua/ec.js](https://www.google-analytics.com/plugins/ua/ec.js)
 * Thank you very much,
    Best Regards, Peter
    -  This topic was modified 6 years ago by [peraburek](https://wordpress.org/support/users/peraburek/).

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

 *  Plugin Author [Conversios](https://wordpress.org/support/users/tatvic/)
 * (@tatvic)
 * [6 years ago](https://wordpress.org/support/topic/host-google-java-scripts-locally-for-faster-loading/#post-12697018)
 * Hi [@peraburek](https://wordpress.org/support/users/peraburek/),
 * Thank you for sharing the suggestions to include an option to load locally hosted
   scripts.
 * We will consider this feature to be included in the road map of the next major
   release.
 * Just FYI, our plugin uses GA tracking method gtag.js so currently you could load
   the analytics script using 3rd party plugin or manually but it should be gtag.
   js
 * Hope this helps.
 * Regards,
    Tatvic Analytics.
 *  Thread Starter [peraburek](https://wordpress.org/support/users/peraburek/)
 * (@peraburek)
 * [6 years ago](https://wordpress.org/support/topic/host-google-java-scripts-locally-for-faster-loading/#post-12708398)
 * Hello [@tatvic](https://wordpress.org/support/users/tatvic/)
 * thank you for your reply! I appreciate it 🙂
 * If I would use CAOS | Host Google Analytics Locally plugin
    I think “Enhanced
   Ecommerce Tracking Code” wouldn’t work, because even gtag.js can run locally,
   there is no ec.js running [https://www.google-analytics.com/plugins/ua/ec.js](https://www.google-analytics.com/plugins/ua/ec.js)
 * therefore I am thinking if we could add support for localy hosted ec.js that 
   would help reduce external DNS lookups
 * Thank you,
    Regards, Peter
 *  [Daan van den Bergh](https://wordpress.org/support/users/daanvandenbergh/)
 * (@daanvandenbergh)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/host-google-java-scripts-locally-for-faster-loading/#post-13037995)
 * Hi [@peraburek](https://wordpress.org/support/users/peraburek/),
 * Just chiming in here 🙂
 * CAOS does support locally hosting ec.js in the premium upgrade: Super Stealth
   Upgrade 🙂 which can be purchased [here](https://woosh.dev/wordpress-plugins/caos-super-stealth-upgrade/).
 * [@tatvic](https://wordpress.org/support/users/tatvic/),
 * We’ve been in touch about a year ago about a compatibility mode between CAOS 
   and your plugin, but I’ve never heard back from you. I sent the needed code changes
   to you: it’s basically applying a filter around the analytics.js and/or gtag.
   js URL. It’d still be a really cool feature to offer to your users. 🙂
 * Edit: I looked into your code again, all that’d be needed to make CAOS compatible
   with this plugin is the following change in the function: \Enhanced_Ecommerce_Google_Analytics_Public::
   ee_settings(): [https://imgur.com/a/fI2aETF](https://imgur.com/a/fI2aETF)
    Since
   apply_filters() is used on a string, it doesn’t have any other implications with
   your current implementation.
    -  This reply was modified 5 years, 10 months ago by [Daan van den Bergh](https://wordpress.org/support/users/daanvandenbergh/).
    -  This reply was modified 5 years, 10 months ago by [Daan van den Bergh](https://wordpress.org/support/users/daanvandenbergh/).
    -  This reply was modified 5 years, 10 months ago by [Daan van den Bergh](https://wordpress.org/support/users/daanvandenbergh/).
    -  This reply was modified 5 years, 10 months ago by [Daan van den Bergh](https://wordpress.org/support/users/daanvandenbergh/).
 *  Plugin Author [Conversios](https://wordpress.org/support/users/tatvic/)
 * (@tatvic)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/host-google-java-scripts-locally-for-faster-loading/#post-13050759)
 * Hi [@daanvandenbergh](https://wordpress.org/support/users/daanvandenbergh/),
 * Thank you very much for your efforts and inputs here 🙂
 * We are considering the suggested changes for the compatibility with the CAOS 
   plugin in the next release.
 * Regards,
    Tatvic Analytics.

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

The topic ‘host Google java-scripts locally for faster loading’ is closed to new
replies.

 * ![](https://ps.w.org/enhanced-e-commerce-for-woocommerce-store/assets/icon-256x256.
   gif?rev=2708061)
 * [Conversios: Google Analytics (GA4), Google Ads, Conversion and Analytics Tracking for Multi-Channels](https://wordpress.org/plugins/enhanced-e-commerce-for-woocommerce-store/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/enhanced-e-commerce-for-woocommerce-store/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/enhanced-e-commerce-for-woocommerce-store/)
 * [Active Topics](https://wordpress.org/support/plugin/enhanced-e-commerce-for-woocommerce-store/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/enhanced-e-commerce-for-woocommerce-store/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/enhanced-e-commerce-for-woocommerce-store/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Conversios](https://wordpress.org/support/users/tatvic/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/host-google-java-scripts-locally-for-faster-loading/#post-13050759)
 * Status: resolved