Title: Code leak on tooltips
Last modified: October 24, 2018

---

# Code leak on tooltips

 *  Resolved [polisafety](https://wordpress.org/support/users/polisafety/)
 * (@polisafety)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/code-leak-on-tooltips/)
 * After enabling the plugin, the javascript codes get also injected into the ‘add
   to cart’ tooltips as shown in the screenshot below.
    [http://prntscr.com/l9u5o1](http://prntscr.com/l9u5o1)
 * Is there any work around to this?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcode-leak-on-tooltips%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [Michael K](https://wordpress.org/support/users/mikkamp/)
 * (@mikkamp)
 * Automattic Happiness Engineer
 * [7 years, 6 months ago](https://wordpress.org/support/topic/code-leak-on-tooltips/#post-10880309)
 * Hi,
 * The Google Analytics Integration plugin adds the JavaScript to the add to cart
   button through default WooCommerce hooks.
 * It’s only included once there on your site. However it seems the theme is copying
   over all the text to get the tooltip title. In this case that would be specific
   code which is part of the theme, so it would be best to contact the theme authors,
   to see how that can be resolved.
 *  Thread Starter [polisafety](https://wordpress.org/support/users/polisafety/)
 * (@polisafety)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/code-leak-on-tooltips/#post-10883798)
 * Thank you very much for your assistance.
 * I already spoke with the theme developer a couple of weeks ago and I told him
   the exact same issue that you described me.
    He advised the code to be injected
   in the footer instead of the button itself.
 * So I am kind of in the middle here. Is there anything else that I can do from
   my part?
 *  [Michael K](https://wordpress.org/support/users/mikkamp/)
 * (@mikkamp)
 * Automattic Happiness Engineer
 * [7 years, 6 months ago](https://wordpress.org/support/topic/code-leak-on-tooltips/#post-10884035)
 * The plugin doesn’t allow any way to customize that. So the only way would be 
   to customize the code itself. This isn’t usually recommended though, as you will
   lose any of your changes when you update the plugin.
 * But if you are a bit handy with PHP I’d suggest to have a look at the function`
   listing_click` in the file `woocommerce-google-analytics-integration/includes/
   class-wc-google-analytics-js.php`
 * If you change the `echo` call to `wp_enqueue_js` it will load the JavaScript 
   in the footer instead. Note that you will need to also strip off the beginning
   and ending `<script>` tags for that to work.
 *  Thread Starter [polisafety](https://wordpress.org/support/users/polisafety/)
 * (@polisafety)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/code-leak-on-tooltips/#post-10884183)
 * I really appreciate your assistance!
    Your suggestion helped me solve the issue,
   at least for now.
 * Thank you very much once more.
    Best regards!

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

The topic ‘Code leak on tooltips’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-google-analytics-integration/assets/icon-256x256.
   png?rev=3234358)
 * [Google Analytics for WooCommerce](https://wordpress.org/plugins/woocommerce-google-analytics-integration/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-google-analytics-integration/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-google-analytics-integration/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-google-analytics-integration/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-google-analytics-integration/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-google-analytics-integration/reviews/)

## Tags

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

 * 4 replies
 * 2 participants
 * Last reply from: [polisafety](https://wordpress.org/support/users/polisafety/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/code-leak-on-tooltips/#post-10884183)
 * Status: resolved