WooCommerce - excelling eCommerce
[closed] Google analytics ecommerce tracking on working with Woo Commerce (32 posts)

  1. keithkranc
    Posted 2 years ago #

    I have Woo commerce and I am using Google analytics tracking. My regular Google analytics tracking is working but the ecommerce tracking is not working. I have ecommerce enabled inside Google analytics and I have my GA UA-ID number set up in the Integration section of Woocommerce - Here's a screenshot: http://screencast.com/t/TBfvfMSuP

    Ecommerce is not tracking any data inside GA - http://screencast.com/t/QTkqiJ5ly6 but all of my other analytics reporting is working fine..

    Any help would be much appreciated.



  2. lee_p
    Posted 2 years ago #

    Hi keith, have you been able to find a solution to this at all?



  3. Mike Jolley
    Plugin Author

    Posted 2 years ago #

    Probably fixed in 2.0 - esc_js was missing from our tracking code.

  4. lee_p
    Posted 2 years ago #

    ah ok... many thanks :)

  5. crdunst
    Posted 2 years ago #

    @mikejolley Hi Mike - I have a client that can't upgrade to WooCommerce v2 just yet - would I be able to add 'esc_js' in manually to a v1.6.5.1 installation?

    Could I just drop this file into the older installation:

    Or has it changed significantly with WC v2?


  6. Mike Jolley
    Plugin Author

    Posted 2 years ago #

    You can add the esc_js lines but I wouldn't just copy the file across.

  7. crdunst
    Posted 2 years ago #

    OK great, thanks for the quick response too.

  8. odotjdot
    Posted 2 years ago #


    it doesnt look like this plugin is tracking all of my transactions and sales. im using the latest copy of woocommerce.

    im not seeing any conversations or ecommerce tracking for all of my orders. i see two orders out of 20+ orders.

    am i doing something wrong?


  9. odotjdot
    Posted 2 years ago #

    false alarm, i guess it took a couple of days to come through.


  10. stillingen
    Posted 1 year ago #


    I also having issues with GA event tracking after upgrading to WC 2.0 I have added "Add eCommerce tracking code to the thankyou page" and "Add event tracking code for add to basket actions", but only basket actions is working. Events containing order information does not fire. I have tried with and without 3rd party GA plugin, and using default WP template, with the same result (my current template does not have thankyou page override). Could my issue also be related to esc_js, if so where would that be located? Any advise is highly appreciated.

    ### Environment ###
    Home URL:                http://www.74273.websys.sysedata.no
    Site URL:                http://www.74273.websys.sysedata.no
    WC Version:              2.0.12
    WC Database Version:     2.0.12
    WP Version:              WP 3.5.2
    Web Server Info:         Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8k DAV/2 mod_jk/1.2.26
    PHP Version:             5.3.13
    MySQL Version:           5.5.29-0ubuntu0.12.04.2
    WP Memory Limit:         40 MB - We recommend setting memory to at least 64MB. See: Increasing memory allocated to PHP
    WP Debug Mode:           No
    WP Max Upload Size:      2 MB
    PHP Post Max Size:       8 MB
    PHP Time Limit:          30
    WC Logging:              Log directory is writable.
    fsockopen/cURL:          Your server has fsockopen and cURL enabled.
    SOAP Client:             Your server has the SOAP Client class enabled.
    WP Remote Post:          wp_remote_post() was successful - PayPal IPN is working.
    ### Plugins ###
    Installed Plugins:       CodeStyling Localization by Heiko Rabe version 1.99.30, Dynamic Widgets by Qurl version 1.5.4, Easy FancyBox by RavanH version 1.5.0, Exclude Pages from Navigation by Simon Wheatley version 1.92, Hello Dolly by Matt Mullenweg version 1.6, Page Lists Plus by Tim Holt version 1.1.8, Redirection by John Godley version 2.2.13, Regenerate Thumbnails by Viper007Bond version 2.2.4, Simple Facebook Connect by Otto version 1.5, Social Connect by Brent Shepherd version 0.9, Use Google Libraries by Jason Penney version 1.5.2, Video Thumbnails by Sutherland Boswell version 2.0.3, W3 Total Cache by Frederick Townes version, WooCommerce Nested Category Layout by Justin Stern version 1.2.5, WooCommerce by WooThemes version 2.0.12, WordPress SEO by Joost de Valk version 1.4.13, WP-Activity by Dric version 2.0, WP Smush.it by WPMU DEV version 1.6.5, Video SEO for WordPress SEO by Yoast by Joost de Valk version
    ### Settings ###
    Force SSL:               No
    ### WC Pages ###
    Shop Base:               #59 - /nettbutikk/
    Basket:                  #78 - /handlevogn/
    Checkout:                #80 - /ordrebekreftelse/
    Pay:                     #82 - /ordrebekreftelse/betaling/
    Thanks:                  #84 - /ordrebekreftelse/woocommerce_thankyou/
    My Account:              #86 - /minkonto/
    Edit Address:            #88 - /minkonto/endreaddresse/
    View Order:              #90 - /minkonto/ordreoversikt/
    Change Password:         #96 - /minkonto/endrepassord/
    Lost Password:           #8147 - /minkonto/glemt-passord/
    ### WC Taxonomies ###
    Order Statuses:          cancelled (cancelled), completed (completed), failed (failed), on-hold (on-hold), pending (pending), processing (processing), refunded (refunded)
    Product Types:           external (external), grouped (grouped), simple (simple), variable (variable)
    ### Templates ###
    Template Overrides:      /woocommerce/archive-product.php
  11. pilkster
    Posted 1 year ago #

    Sorry I can't offer you any advice stillingen!

    I recently upgraded
    WooCommerce to 2.0.10
    Maya Shop (Theme) to 2.1.0
    and probably a bunch of other plugins at the same time.

    One of these updates has broken my tracking again. I guess I'll update again and hope it fixes itself. This is so frustrating!

  12. wp_users
    Posted 1 year ago #

    Have the same problem. All tracking works accept sales!

    WP 3.5.2
    WooC 2.0.12
    Maya shop (not sure don't know how to check)

    It is indeed very frustrating.

  13. hgrat
    Posted 1 year ago #

    I have the same problem and it is indeed frustrating that it's not working. Visitors works fine, I think anyway, but not ecommerce tracking.

  14. Franco
    Posted 1 year ago #

    Hi am having the same issue.

    WP and WC latest version
    Using template forte from pixedelic.

    Any help is appreciated.

  15. pilkster
    Posted 1 year ago #

    I see in the changelog that there have been a few updates in recent versions relating to google analytics. I'm going to try 2.0.9 again as I *think* that was my last known working version. Old versions can be downloaded here.

  16. pilkster
    Posted 1 year ago #

    2.0.9 didn't work, but 2.0.5 does.

  17. joeyrudi
    Posted 1 year ago #

    There are some decent troubleshooting tips here (see bottom of post).

    Note the need to setup Goals before eCommerce transactions will display in Analytics.

  18. pilkster
    Posted 1 year ago #

    Hi Joey

    I have goals set up on my site however it is still not tracking sales using 2.0.10. Reverting to 2.0.5 worked out for me but obviously isn't ideal.

  19. joeyrudi
    Posted 1 year ago #


    I'm going to take a look at 2.0.10. But I can attest that 2.0.12 is in fact working.

  20. joeyrudi
    Posted 1 year ago #


    Yep - it looks like Woo fixed a bug in class-wc-google-analytics.php sometime between 2.0.10 and 2.0.12 on line #217. In 2.0.10, they were sending an improper order ID to Google Analytics. I suggest you upgrade to 2.0.12.

  21. pilkster
    Posted 1 year ago #

    Joey - I'm glad ecommerce tracking is working for you on 2.0.12 :) I upgraded but it's not working for me :(

    What version are the rest of you all using? Have you resolved your issues?

  22. joeyrudi
    Posted 1 year ago #


    Have you looked at the Google Analytics Debugger browser extension? If so, what's being printed to your console?

  23. garyhoody
    Posted 1 year ago #

    I have also upgraded to 2.0.12 and it still is not working unless I turn off the "WordPress SEO" plugin. Then it seems to work. Can it be a conflict with "WordPress SEO"?

  24. joeyrudi
    Posted 1 year ago #


    If you would, jump over to XD3V, scroll to the bottom, and send me your site's URL through the contact form. I'll be happy to take a quick look and help you troubleshoot.

  25. garyhoody
    Posted 1 year ago #

    Just wanted to let everyone know that Joey went out of his way spending hours to help find a solution to my issue. It turns out that WordPress SEO Plugin (version 1.4.11 and later) was breaking some Google Analytics eCommerce because excerpts were disabled in my theme. He explains it in detail in this article on his web site. Thanks Joey!

  26. dannorris
    Posted 1 year ago #

    Hi guys we recently had these 2 issues for a client (event tracking on add to cart and ecommerce tracking not working on completed purchases). Here is the fix we put in place.

    The issue we found was Woocommerce was adding a <p> or </p> tag in the added woocommerce code. We modified the ecommerce_tracking_code( $order_id ) function found inside class-wc-google-analytics.php so the script that will be embedded in the page will not include the <p> tags. We were able to use the Google Analytics Debugger chrome extension you can download for free at http://goo.gl/umz7a to observe the purchases being tracked after purchase.

    We also noticed an issue with the 'Add to cart' buttons not tracking events in Analytics. The only way we were able to resolve this was to put a 1.5 second delay on the push script. The delay was added in woocommerce push script so it will allow Analytics to push the events to Google. We ended up turning this off as the client didn't really need it and didn't want the delay.

    Modified files:


  27. joeyrudi
    Posted 1 year ago #


    I've observed the second issue (Add to cart) you mention and found that event tracking was not succeeding when Add-to-cart button takes you directly to the checkout form instead of the cart page. Does that agree with the scenario you encountered?

    As for the first issue, I'm certainly not a fan of modifying any core Woo files and I'm left wondering: 1) what code did you change that resolved the issue, because the ecommerce_tracking_code() itself doesn't include any <p> tags; 2) was it WordPress' wpautop function that was actually inserting the tags and if so, is there a better way to correct the issue than changing the core files?

    Just my thoughts. Look forward to your response.

  28. pilkster
    Posted 1 year ago #

    Hey - I'm the client that Dan and the WPcurve team developed the fix for.

    I'd like to thank Dan publicly and give the WPcurve service my endorsement. I'd been chasing my tail for an age on this issue before asking for help. Just this one fix is worth more than my $69 monthly subscription.

  29. Franco
    Posted 1 year ago #

    Hi guys,

    Did anyone found the issue yet? Is it in the class-wc-google-analytics.php file?

    My problem is that not all transactions are tracked, a handful of them are not, and I cant figure out why...

  30. joeyrudi
    Posted 1 year ago #

    @Franco, there are various issues and largely depend on your theme. Can you post some details here or contact me over on xd3v.com?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic