WooCommerce and Google Analytics eCommerce setup

Update July 24, 2013
Yoast SEO plugin breaking some Analytics installs: see the Yoast Troubleshooting section.
Update August 16, 2013
If you’re using the Neighborhood WordPress theme, make sure you address the recent issue described here.
Update December 15, 2013
The Simple Facebook Connect plugin, version 1.5 (and maybe others) can break Analytics tracking for WooCommerce. If you’re using that plugin, please disable it and run a test transaction, along with following the rest of this tutorial.

Tracking your WooCommerce sales in Google Analytics can be hugely beneficial to understanding your business. By enabling eCommerce tracking, Google Analytics will provide a wealth of information about your visitors, how they found your products, how long it took them to buy, how much you’re making from each traffic source, how much each visit is worth, etc, etc. However, setting up your environment and getting everything working correctly can be a bit tricky.

This article will help you setup eCommerce tracking for WooCommerce and Google Analytics and provide some very important troubleshooting tips in case your already running into problems. If you’re already setup and things just aren’t working, be sure to read the section on Setting Goals.

Setting up eCommerce in Google Analytics

We’re going to focus on setting up eCommerce; however, we’ll go through the steps of setting up Google Analytics because there are some important pieces of information in the process.

Log into your Google Analytics account and click Google Analytics Home Button and then Google Analytics Admin Button. Then, New Account Button.

Tracking Method

When you create your account, you’ll want to choose Classic Analytics. As of now, Universal Analytics is still in beta and WooCommerce doesn’t use it.

Google Analytics Web Property Settings

Fill out the web property form according to your own domain. We’re going to use Gotta Salsa’s staging domain (a website ran by XD3V) for this article.

!Important Select an Industry Category. This is required to create Goals. Why does this matter??? See the section on Setting Goals below.

Also, be sure to select https if your entire site runs under SSL. Selecting SSL is not recommended if only your shopping cart runs under SSL.

Naming your account

Fill out the Account Name as appropriate, then click Get Tracking ID Button.

GA Subdomain Settings

The next screen will bring you to the Tracking Info for your new web property. If you’re using sub-domains, be sure to turn them on and click Save Button.

GA Profiles Tab

Next we’ll enable the eCommerce settings. Go to Profiles tab and select All Website Data (or whatever you named it on the previous page).

Profile Settings Tab

Navigate to the Profile Settings.

eCommerce Site Option

Change all settings as appropriate, but be sure to turn on eCommerce tracking and click Apply Button.

!Important Setting Goals

At this point, you’d think you were done setting up Google Analytics. But you’re not! As of this writing, there seems to be a bug (or a feature?) in Analytics that’s only briefly addressed on this Google support doc. The main takeaway is this:

You must setup at least one Goal in order to see your eCommerce transactions inside Google Analytics.

You don’t even need to enable the Goal! In fact, for my staging site, I don’t want any Goals. But you have to at least create one. Because this seems to be a bug/feature, I can’t speak to its longevity.

Goals Tab

Go ahead and navigate to your Goals tab and click Create Goal Button.

For this article, we’re going to create a Goal and immediately disable it. So in the Goal Setup section, choose Custom Option and click Next Step.

Goal Settings

Name your Goal whatever you want. You should probably give it a name that you could use later because you have a limited number of goals you can create. But for this article, BS Goal sounds about right. Select Destination, then click Next step.

Goal Details

We’re going to stick with the WooCommerce default thank-you page for this Goal. Does it matter? Probably not because we’re just going to disable this goal as soon as it’s created. However, because this is a bug, I can’t say if it really matters or not. We’re going to play it safe.

Click Create Goal.

All Goals

Now, disable the Goal. Awesome :-/

For help beyond this article, you can also refer to Google’s help page.

This next section describes the straightforward WooCommerce setup. So before you leave Google Analytics, be sure to copy the the Property ID. It looks something like UA-XXXXX-X.

WooCommerce Setup

Jump into your WordPress Admin and navigate to WooCommerce -> Settings -> Integration -> Google Analytics

WooCommerce Settings

Enter the Google Analytics ID that you copied from your Google Analytics web property. Again, this ID will look something like UA-XXXXX-X.

Set the domain name as you set it in Google Analytics. As noted, this is optional and can depend on your shop’s domain or sub-domain. For this article, we’re sticking with the same domain we entered in Google Analytics when we created the web property.

We’re removing “Add tracking code to your site’s footer…” because we’re already running Yoast’s Google Analytics for WordPress. If you’re not already running an Analytics WordPress plugin, leave the box checked.

Check the last two boxes as indicated and Save Changes.

Troubleshooting

This essentially completes the eCommerce setup for Google Analytics and WooCommerce. However, there are some important troubleshooting tips to consider:

  • Google Analytics Debugger, a Chrome browser extension, can be a huge help in determining if WooCommerce is sending the proper eCommerce data to Google Analytics. Once installed, open the Javascript console (Control-Shift-J on Windows and Linux; Command-Option-J on Mac) and run a test transactions. When you arrive at your WooCommerce “Thank You” page, look for _addTrans and _addItem in the debugger’s information. That will be the indication that transactions are being sent to Google.
  • Depending on your WooCommerce cart setup, you might need to enable subdomains in Google Analytics as we did earlier in this article. Meaning, if your website is http://example.com but your cart is http://mystore.example.com, you’ll need to enable subdomains under Tracking Info.
  • When creating your Google Analytics web property, you’ll probably have to use Classic Analytics instead of the new Universal Analytics until WooCommerce adds support for the new script.
  • !Important. Make sure that you designate an Industry in the Google Analytics setup.
  • Make sure that WooCommerce -> Settings -> Integration has ‘Add eCommerce tracking code to the thankyou page’ is checked.
  • If your WooCommerce products are single purchase only (meaning, your user is taken directly to the checkout after adding to cart – e.g. subscriptions), you might not see the ‘Add to cart’ event recorded in Analytics. I suspect there is a bug in WooCommerce – yet to be verified. However, the purchase transaction will still show in Analytics.
  • If you’re conducting test purchases while logged-in as the WP admin, those purchases won’t show up in Google Analytics.
  • If you’re running test purchases while using a browser extension such as Google Analytics Opt-out Add-on, the transactions won’t show up in Google Analytics.
  • I have yet to see Google Analytics real-time conversion work. However, the conversion will still show in the eCommerce report. So don’t get discouraged just because you’re not seeing real-time eCommerce transactions.
  • !Important. Read Setting Goals in this article. As of now, you have to have at least one Google Analytics Goal (even if it’s disabled) before your Analytics reports show your eCommerce transactions.
  • !Important. It can take ~24 hours for results to show in Google Analytics reports. Especially if your Analytics account is new. Sometimes data will show in under and hour, but you never know.
  • While anxiously awaiting your eCommerce transactions to show up in Google Analytics, make sure you’ve set the date to include TODAY :)
  • Data will not refresh in all Analytics eCommerce reports at once. The reports seem to get refreshed at different times, no matter now many times you click tiny little “Refresh Report” link.
  • In fact, even the data items within a single report will refresh at different times. For example, in the Product Performance report, Quantity might refresh twenty minutes before Product Revenue. Frustrating, I know.
  • *NEW* It appears that WooCommerce also fixed an issue as of 2.0.12. Prior to that, an improperly formatted Order ID was being sent to Google Analytics. So in addition to the above tips, make sure you’re running at least WooCommerce 2.0.12.
  • If you’re still experiencing issues after following this article, feel free to contact us here.

Troubleshooting Yoast’s WordPress SEO

*NEW* As of this writing, Yoast’s WordPress SEO Plugin (version 1.4.11 and later) is breaking some Google Analytics eCommerce implementations. At this time, we’re still troubleshooting the issue. But we have a fix.

The issue rears its head when a theme (or another plugin) has disabled page excerpts or no excerpt exists. Why does this matter? The SEO plugin is active on your WooCommerce “Thank You” page. When the plugin tries to do its job, it attempts to grab the page’s except and place it into the Facebook meta tag “og:description”. If the excerpt can’t be found, a portion of the page’s content is inserted into the meta tag – including WooCommerce’s Google code.

Fix the problem.

WordPress Screen Options

In the WordPress admin, edit your WooCommerce “Thank You” page (Order Received by default) and see if your Screen Options includes “Excerpt”. If so, make sure it’s checked and skip the next step. If not, you’ll need to add some code to your functions.php file.

If your Screen Options do not include “Excerpt”, add the following code to your theme’s functions.php file. This code will enable excerpts for pages:

add_action('init', 'my_custom_init');
     function my_custom_init() {
     add_post_type_support( 'page', 'excerpt' );
}

Once that’s done, edit your “Thank You” page and again make sure that Excerpt is checked in your Screen Options.

While editing the “Thank You” page, scroll down to the Excerpt section and enter something like “Thank you for your order!”. Save the page.

That’s it! Re-test your Analytics transactions. But keep the other troubleshooting tips in mind when you test!

Troubleshooting Neighborhood Theme

*NEW* We discovered an issue with the Neighborhood WordPress theme after assisting one of our readers with their setup. If you’re using the Neighborhood theme, save yourself some time by addressing the possible issue described below (along with following the rest of this turorial).

In your Neighborhood theme directory (the parent, not the child theme), open the file
/wp-content/themes/neighborhood/woocommerce/checkout/thankyou.php
On or around line #74, you should see the following code:

<?php do_action( 'woocommerce_thankyou_' . $order->payment_method, $order->id ); ?>
<?php //do_action( 'woocommerce_thankyou', $order->id ); ?>

If you see that the second line contains “//”, you have a problem. If the line doesn’t contain “//”, you’re in the clear (on this issue, at least).

The fix is simple, but is slightly different depending if you’re using a child theme or not.

If you’re not using a child theme, simply remove the “//”, save the file, upload to your server. You’re almost done, but not quite.

If you are using a child theme, you’ll need to save a copy of the file to your child’s directory which should be something like
/wp-content/themes/neighborhood-child/woocommerce/checkout/thankyou.php
After saving the file, remove the “//”. Re-save and upload the file.

Whether you’re using a child theme or not, you’ll want to make one more change…

After fixing the thankyou.php file, you’ll be left with a fairly ugly order summary on your Thank You page. The order summary isn’t necessarily bad, but it doesn’t go well with the Neighborhood theme and it wasn’t intended by the theme author. So, to fix the issue, you’ll need to add one line of code to your functions.php file.

If you are not using a child theme, open
/wp-content/themes/neighborhood/functions.php
If you are using a child theme, open that theme’s functions.php file. In both cases, add the following line of code, then save and upload:

remove_action( 'woocommerce_thankyou', 'woocommerce_order_details_table', 10 );

This line will remove the order summary from the Thank You page.

Done!

Make sure you follow the rest of this tutorial and the other TROUBLESHOOTING TIPS. Good luck!

78 Comments

  1. Simon July 14, 2013 at 11:40 am #

    Hi Joey

    Thanks for these tips. Which version of WordPress & WooCommerce are you working with? I have goals set up on my site, and had ecommerce tracking working just fine until I recently upgraded to 2.0.10. Reverting to 2.0.6 seems to have fixed the issue.

    • Joey Rudisill July 14, 2013 at 1:56 pm #

      Hey Simon. I’m running latest WooCommerce, 2.0.12. I’ll take a look at 2.0.10.

    • Joey Rudisill July 14, 2013 at 4:03 pm #

      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, WooCommerce was sending an improper order ID to Google Analytics. Upgrading to 2.0.12 should help you.

  2. Colin July 15, 2013 at 11:47 pm #

    Hey,

    I had previously set my site analytics to ‘Universal’ how do I change this to ‘classic’ without deleting and recreating my account?

    • Joey Rudisill July 16, 2013 at 12:32 am #

      Colin,

      As of now, there isn’t a straightforward way to move data to/from Classic and Universal Analytics. However, you can certainly run both. The scenario is far from ideal, but even Google recommends it as a best practice, which pretty much implies this is going to be an unsavory upgrade for a lot of people.

      To run both Classic and Universal, go to your Analytics account and create a new Web Property: Analytics home -> Admin -> New Property. From there, you can pretty much follow the procedures outlined in this article to setup Analytics eCommerce tracking. Once complete, you should have two Web Properties listed in your Analytics account. They will be tracked completely independent of one another.

      That might be about the best you can do. If you find another solution, please share it here.

      • Douglas September 29, 2013 at 11:26 pm #

        Hi, Joey.

        Very useful post, thank you!

        I´ve got a question: How do I put both analytics IDs to work? I´m using the Yoast Google Analytics, may I just put UA-XXXXXX-X;UA-XXXXXX-X ? Same in the Woocommerce Integration setup?

        Thank you

        • Joey Rudisill September 30, 2013 at 2:08 am #

          Douglas,

          You should be able to use one Google ID in your Yoast setup and a different Google ID in WooCommerce -> Settings -> Integration -> Google Analytics.

          Does that answer your question?

  3. JB July 23, 2013 at 8:20 am #

    Joey,

    Great article.

    What are the reasons for using Yoast Analytics as well as the integrated analytics?

    Would you recommend using Yoast Analytics as well?

    Thanks,
    JB

    • Joey Rudisill July 24, 2013 at 4:43 pm #

      Hi JB.

      Yoast’s Analytics gives me many additional features for tracking pages. I can exclude certain roles from being tracked; add custom variables; track post types and categories separately; etc. Of course, I could do all of this by adding adding code to my theme. But the Yoast plugin makes it a lot easier.

      And yes, I’d recommend it.

  4. Simon July 25, 2013 at 1:32 pm #

    Thanks for this Joey! I’ve just followed your Yoast fix instructions, will report back after a couple of sales have come through.

  5. Alüminyum Boru July 26, 2013 at 11:59 am #

    good artical for me. thank you.

    • Joey Rudisill July 26, 2013 at 4:04 pm #

      Thanks for your comment, Alüminyum. Glad you found it helpful.

  6. Jesse M. July 26, 2013 at 3:37 pm #

    Hey Joey, Found you off here http://wordpress.org/support/topic/google-analytics-ecommerce-tracking-on-working-with-woo-commerce helping out Garyhoody. I was also having problems with hooking up analytics with woocommerce + mayashop + yoastSEO and you seriously made the walkthrough a breeze. Thank you for writing such a great article!

    • Joey Rudisill July 26, 2013 at 4:04 pm #

      Thanks Jesse. Glad you found it helpful and I appreciate your comments on the blog.

  7. Simon July 27, 2013 at 9:24 am #

    Hi Joey

    Still no joy with eCommerce tracking even after enabling the excerpts. Thanks for all your suggestions so far.

    • Joey Rudisill July 27, 2013 at 3:53 pm #

      Simon,

      Can I contact you privately about your site? I’d be happy to take a look.

  8. Ian July 28, 2013 at 2:44 pm #

    Great article, if I hadn’t found this I would have been pulling my hair out all week.

  9. Ryan August 1, 2013 at 3:57 am #

    Strangely, I see the specific woocommerce vars you mention being sent to GA via the debugger but I still don’t see anything in my GA portal. I tried turning the /order-received/ goal on and off and running transactions. Is there a delay? If not, are there any other troubleshooting tips I should consider. Excellent article though…got me 95% of the way.

    • Joey Rudisill August 2, 2013 at 6:38 pm #

      Hi Ryan.

      I assume you saw the troubleshooting tips in this blog article? And yes, there is a delay. Have the transactions shown up in Analytics yet?

    • Andrew February 4, 2014 at 4:17 pm #

      Hey Ryan, make sure your /order-received/ page isn’t under /checkout/order-received/

  10. Matt August 9, 2013 at 4:20 am #

    This is driving us crazy! :)

    One day, our conversion tracking just ‘stopped working’.

    We had changed themes, so thinking that was it, switched back, but no difference.

    We’ve followed your steps above, three times. Even going as far as creating an entirely new analytics property, just to ensure everything was setup as yours is. This still didn’t show us conversion data.

    Disabling, or Enabling the YOAST SEO plugin has no effect. We ensured the excerpt was created on the thank you page. We’ve also installed the debuggers, but the _addTrans and _addItem items do not show up.

    We tried both with the YOAST Analytics, and without. And with various combinations of the settings in the backend woocommerce options. None seem to be bringing out conversion stats back.

    The only thing we have done, is upgraded some plugins, including woocommerce I believe.

    One thing to note is, even if we disable ALL plugins, but then just turn woocommerce back on, there’s still no addtrans or additem listed in the google analytics debugger.

    So, this leads me to believe it’s a core woocommerce issue? I do see the __addtrans in the source for woocommerce, so that’s fine, and there’s also nothing on the woocommerce forums or bug tracker that I can find.

    I hate that it was working, and then just suddenly stopped, it’s severely impacting our reports. Any ideas you may have would be great :)

    Great post btw.

    Thanks,
    Matt

    • Joey Rudisill August 9, 2013 at 3:41 pm #

      Matt, I’ll email you and we’ll get this figured out.

  11. Bruno Cardoso August 17, 2013 at 10:58 pm #

    Hi Joey,
    Very nice blog post. I did everything you pointed out, however it is still not working =/
    Can you help me further? I posted an issue here https://github.com/woothemes/woocommerce/issues/3647

  12. Jonathan August 21, 2013 at 3:19 am #

    Excellent post! Where exactly in the functions.php file would you add “remove_action( ‘woocommerce_thankyou’, ‘woocommerce_order_details_table’, 10 );” ?

    • Joey Rudisill August 21, 2013 at 3:42 pm #

      Hi Jonathan,

      Within the function.php file, the line of code can appear anywhere after the opening <?php .

  13. Jonathan August 22, 2013 at 4:06 pm #

    Thanks for the response Joey! One more question! I am using a child theme for Neighborhood and it doesn’t have its own functions.php file. Should I copy the main theme’s functions.php file, make the addition and then drop it in the child theme’s folder?

  14. Ankit August 23, 2013 at 4:12 pm #

    Hello Joey,
    I’m having a problem with my WooCommerce setup. It’s unable to perform Google Analytics Ecommerce tracking. Can you help?

    Thanks
    Ankit

  15. Jeffrey August 29, 2013 at 4:00 am #

    Hi, my site is running a blog, and now we want to add a EC site using woocommerce

    I already use Google Analytics for WordPress, can I use the tutorial here?

    and can I separate these two (blog & ec) in analytics?

    • Joey Rudisill August 29, 2013 at 4:12 am #

      Hi Jeffrey.

      This tutorial assumes you already have WooCommerce installed. Once installed, you can follow this tutorial to setup Google Analytics to track your eCommerce transactions.

      If you want to completely separate your blog from eCommerce in Google Analytics, then yes, you can follow this tutorial nearly step-by-step. You’ll end up using one Analytics ID for your blog and a different Analytics ID for your eCommerce setup. If instead you want to track your blog traffic and your eCommerce stuff together, you can simply skip certain steps in this tutorial and enter your existing Analytics ID. However, I would still go through each step and make sure that your existing Analytics account is setup correctly to track eCommerce transactions.

      Hope this helps.

      • jeffrey August 31, 2013 at 6:44 am #

        Hi, tks for your reply

        because I’m using the Google Analytic for wordpress plugin
        so if I use two ga ID, is that one ID for blog will count the woocommerce pageview?

        for my understanding, the plugin I use will insert all tracking code into every page??

        • Jeffrey September 4, 2013 at 4:52 am #

          also, if I use two tracking ID, should I leave the “insert tracking code into footer” checked in woocommerce integration section?

  16. Troy August 29, 2013 at 4:37 pm #

    First, THANK YOU for the article! You seem to be the only one who even acknowledge that this issue exists.

    Second, HELP! Haha, I’ve done everything you’ve suggested without success. The GA debugger does NOT show either _addTrans or _addItem

    I’m on WP version 3.6, WooCommerce 2.0.13 and WordPress SEO 1.4.14.

    Thanks!

  17. Troy September 12, 2013 at 6:59 pm #

    Hey Joey, I tried contacting you through the contact form but haven’t heard back. Are you able to take a look at my site and see if there’s anything glaringly wrong? Thanks for the help!

  18. Alex September 24, 2013 at 5:28 pm #

    Hey Joey,

    Thank you very much for your article !

    I’ve followed each point you mentioned, I’ve found Addtrans and additem in debugger but I have still nothing in my google analytics…

    Do you have any idea why it’s not working ?

    • Joey Rudisill September 24, 2013 at 6:20 pm #

      Hi Alex. I’ll be following up with you directly.

  19. Diego October 11, 2013 at 1:28 pm #

    Hello Joey!
    First of all, I’d like to thank you for this article. It’s great and I’m spreading the word.
    I followed all the steps in this article (a few times) but, still, Analytics refuses to receive the data from Woocommerce despite GA Debug saying that the information is being sent (from what I understand).
    Any idea what might be happening?
    Thank you!

  20. Brent Mail October 12, 2013 at 8:44 pm #

    Hi Joey – great article and very easy to follow – Thanks!

    I’m having the same problems and looks like I have gone through all the steps but still no luck.
    I’ll send you a private message – hopefully you can help me.
    I’m running woocommerce 2.0.13 on Definition 1.3.3

    Cheers,
    Brent

  21. Colin M October 24, 2013 at 2:40 am #

    Hi Joey,

    Thanks for this article. Something that I noticed about my site that was different from yours is that my Order Received page is a child of the Checkout page. So the URL is /checkout/order-received/ for my site when setting up that “BS Goal.” That is the default for WooCommerce now. The goal in your example is “BS” but for people that want to make an actual goal and use the order received page as the destination, you might want to update this to not confuse people.

    Cheers!
    Colin

    • Joey Rudisill October 24, 2013 at 5:45 pm #

      Good point – thanks Colin. I’ll update the tutorial.

    • Chirag December 8, 2013 at 2:13 pm #

      Thanks for pointing out.. :)

  22. Dan October 24, 2013 at 8:22 am #

    Hi Joey, I’m finding that not all transactions are being recorded. I can’t seem to see a pattern why. Is this common… any tips on what I could try? I’m using the Abundance theme By Kriesi.

    Cheers
    Dan

    • Dan October 24, 2013 at 5:08 pm #

      Ahh wait, just ran some more test transactions… my credit cards are processed via Paypal external to the website. If the customer doesn’t choose to return to my site after completing the transaction on Paypal, then it’s not recording the transaction in Analytics.

      Does that sound right? The customer must view the final ‘Order Received’ page for it to be tracked in Analytics? If so, and many transactions wont be tracked, that makes any reports basically useless.

      cheers
      Dan

      • Joey Rudisill October 24, 2013 at 5:49 pm #

        Hi Dan.

        You are correct: WooCommerce sends the transaction to Analytics from the ‘Order Received’ page. If your customers are not redirected back to your site after completing the transaction on PayPal, the transactions will not be sent to Analytics.

        I’ve been developing a set of tools to enhance WooCommerce’ use of Analytics, though, this scenario had not occurred to me. It’s something I’ll look into. Wish I had a better solution for you right now.

  23. Sean October 25, 2013 at 7:55 pm #

    Great article it help us troubleshoot our Google Analytics goals.

    WC Version: 2.0.18
    Function version 1.1.15 by WooThemes

    If you have All in One SEO Pack Pro by Michael Torbert version 2.1.4 do not CONNECT your Google Analytics it will cause error in the thankyou page /order-received/ thus confusing Analytics goals. Installing GOOGLE TAG ASSISTANT can help you troubleshoot and analyze your codes.

  24. Kenold Beauplan October 28, 2013 at 11:51 pm #

    @Dan, you can setup PayPal’s Return URL (in PayPal admin) to send users back to http://www.yourwebsite.com /checkout/order-received/ after completing a transaction. You must enable Auto Return in PayPal admin before you can do that though.

  25. Mikkel November 2, 2013 at 6:11 pm #

    Is there a time schedule for when Woocommerce will support Universal Analytics for ecommerce tracking?

    • Joey Rudisill November 2, 2013 at 8:21 pm #

      I’m looking for the answer to this myself.

      • Mikkel November 3, 2013 at 10:08 pm #

        We’ll then I’m not the only one who can’t find info on this. I’ll try if I can code a plugin that replaces the old ecommerce tracking code of WC with a new version for Universal Analytics. I’ll ley you know it I get it done.

  26. Maggie November 21, 2013 at 12:19 pm #

    Hi Joey, in my case the ecommerce tracking code from WooCommerce get broken with tags like this:

    var _gaq = _gaq || [];
    _gaq.push(
    ['_setAccount', 'UA-xxxxxx-y'],
    ['_setCustomVar', 1, 'logged-in', 'no', 1],
    ['_trackPageview']
    );
    _gaq.push([‘_addTrans’,
    ‘#2037′, // order ID – required
    etc.

    Any idea what’s causing this?

    Thanks!

    • Maggie November 21, 2013 at 12:22 pm #

      Hm, it didn’t appear correctly in my initial comment, here it is again:

      var _gaq = _gaq || [];
      _gaq.push(
      ['_setAccount', 'UA-xxxxxx-y'],
      ['_setCustomVar', 1, 'logged-in', 'no', 1],
      ['_trackPageview']
      );
      _gaq.push([‘_addTrans’,
      ‘#2037′, // order ID – required

      • Joey Rudisill November 22, 2013 at 1:21 am #

        Maggie,

        The code you posted is part of the script that sends the tracking info to Google, so I’m not exactly sure what you mean. I’ll email you to follow-up.

  27. budakhan November 25, 2013 at 8:22 pm #

    Awesome, awesome article. One thing is giving me hesitation however. I’ve dropped the Google Analytics code into Woo Canvas and am getting standard analytics just fine. Do you think it would be a problem if I checked “Add tracking code to your site’s footer”? Or should I leave that unchecked? Canvas is kind of like a third party right? But kind of not.

    Thanks again.

    • Joey Rudisill November 25, 2013 at 8:30 pm #

      budakhan,

      If you’ve added the Analytics code to the Canvas settings, you probably shouldn’t check “Add tracking code to your site’s footer..” (in the WooCommerce settings). This will possibly result in Analytics adding two hits for each page view. However, you *should* check “Add eCommerce tracking code to the thankyou page” if you intend to track WooCommerce eCommerce transactions. Make sense?

      • budakhan November 25, 2013 at 9:46 pm #

        Thanks for the quick reply. Ok, that sounds great. And this might be a really dumb question. But for some reason if changing the settings in WooCommerce> Settings> Integration> Google Analytics doesn’t work, can I just take out the Google Analytics ID, save the settings again, and everything will be back to how it was? Just looking for an exit strategy ;-)

      • budakhan December 2, 2013 at 6:04 pm #

        Joey. This article is awesome I followed your steps and took your advice. Everything works perfectly. Thank you.

  28. Joey Rudisill November 25, 2013 at 10:06 pm #

    If you remove the Analytics ID from the WooCommerce settings (or uncheck the “Add eCommerce tracking code…”), no eCommerce data will be sent to Google. However, any data previously sent to Analytics will still be in Analytics, i.e. nothing gets deleted from Google Analytics.

    If you happen to run into trouble or just can’t seem to get everything working, you can also consider my Google Analytics services.

    Good luck!

  29. Paul November 27, 2013 at 7:41 pm #

    Just a quick question I am still hung up on. Do I need to manually add the whole GA tracking code to my footer.php if I add the tracking code to the woo integration tab? Should I take the code it out of my footer and just check the woo “add to footer” box? Does having it in the footer.php and in the woo tab screw up the tracking in GA? Thanks, sorry if this is redundant but its the one answer I cant seem to find.

    • Paul November 27, 2013 at 8:26 pm #

      And is there somewhere specific I need to put:

      add_action(‘init’, ‘my_custom_init’);
      function my_custom_init() {
      add_post_type_support( ‘page’, ‘excerpt’ );
      }

      In my functions.php? No really sure where to drop it, and am not really confident enough just dropping it in there anywhere. Thanks again!

      • Paul November 27, 2013 at 8:30 pm #

        Disregard that last question, I figured out where to put it!

        • Joey Rudisill November 27, 2013 at 9:15 pm #

          Hi Paul,

          I wouldn’t add the code to footer.php; instead, I would install Yoast’s Google Analytics plugin:
          http://yoast.com/wordpress/google-analytics/
          That plugin will essentially add Analytics tracking to your entire site.

          If you don’t use Yoast’s plugin, then you can simply check the “Add tracking code to your sites footer…” box and the “Add eCommerce tracking code to the thankyou page” box. By doing this (and following the rest of this tutorial closely), Analytics tracking will *likely* work.

          For clarity, I know the Google instructions tell you to add their code to your page. However, Yoast’s plugin and/or checking the WooCommerce box “Add tracking code…” handles this for you. So you shouldn’t add the Google code to footer.php.

          Finally, your question about the add_action code: it goes in functions.php.

          Hope this helps. If you run into trouble and would like to hire me for a few hours to get you setup, just contact me.

          Good luck!

  30. Oeds December 13, 2013 at 1:57 pm #

    Hi,

    Great article! Unfortunately it doesn’t work for me yet.
    I guess it’s going wrong in the yoast seo plugin.

    When reading the troubleshooting i checked the excerpt and put it on and off. The google code didin’t show up both times in <meta property="og:description" like mentioned in the troubleshoot.

    However i got it in og:image like this.

    This doesn’t seem right. right? How do i get it out there?
    I already tried filling in an image, but then it just puts an extra line in with og:image

    This is the thank you url: http://www.villa-vrolijk.nl/bestelling-ontvangen/

    Thanks for your reply!

  31. yusuf December 17, 2013 at 11:12 am #

    I followed all the steps but it doesn’t work :/ , someone help me please

    • Joey Rudisill December 17, 2013 at 5:56 pm #

      Hi yusuf.

      Please contact me here with some info about your website. I’ll see if I can provide you with some guidance.

  32. Jesper January 9, 2014 at 10:17 am #

    Hi great guide, but I’m still having issues with my eCommerce tracking.
    I’m running WooCommerce 2.0.19, I’m having Yoast SEO plugin installed and inserted the extra code to get the Excerpt like you’ve said, no problem. But when I’m completing an order only the regular _trackPageview is being sent to Google, and I can’t find any trace of the eCommerce tracking code even though it is setup just like you’ve explained. I’m at a total loss here.

    The site is hundeslottet.dk and the theme is build upon the WP roots theme, my experience with word press is somewhat limited to adding and modifying pages and making minor changes to theme functions (mostly custom GA implementations), so I couldn’t really figure out how to test the issue regarding the Neighborhood theme.

    Any input is greatly appreciated.

    – Jesper

    • Joey Rudisill January 9, 2014 at 5:42 pm #

      Hi Jesper,

      I took a quick look at your site and I don’t see anything wrong with it. Thus, the problem is likely in one of the theme files or more likely, a plugin is causing the issue. I would suggest uninstalling each plugin (if you can) to determine which one is causing the issue. Or, I am available to help you troubleshoot the problem: https://xd3v.com/shop/woocommerce-google-analytics-implementation/

  33. Sieghart February 5, 2014 at 8:42 am #

    Hi Joey,

    Thanks for this nice step by step guide!
    But unfortunately even after following your guide I can’t get it to work…. :-//

    When I set up goals (I’ve set up 2 goals for ‘order-received’ page in my sites’ 2 languages) and I leave them on in GA, they work fine, and register each sale, but only that, no more info.
    In your guide you say it’s important to create a goal, but turn them OFF. When I do that, there’s no improvement, still no ecommerce tracking.
    my woocommerce site is huahuafu.com/shop
    Any idea on what I’m doing wrong?
    It might be the theme, as it’s rubbish from coding side, but I like the look & feel

    • Joey Rudisill February 5, 2014 at 9:03 am #

      Hi Sieghart,

      If you’ve followed the tutorial, the issue is almost certainly a theme or plugin causing you grief. If possible, I’d suggest turning off as many plugins as possible and running a test. Sometimes a theme can cause problems, but more typically it’s a plugin.

      There’s also a (somewhat) common problem in themes and you can do this quick check:
      - Look for this file: “/wp-content/themes/your-theme-name/woocommerce/checkout/thankyou.php”. (replace “your-theme-name” with the main theme and/or the child theme). That file/directory may or may not exist. If it does exist, open the file with a plain text editor and search for “woocommerce_thankyou”. Just make sure it’s there. If it’s not, your theme has a problem. If it is there, you might still have a theme problem, but I’d start turning off plugins.

      Alternatively, you can hire me to dig in and fix it: https://xd3v.com/shop/woocommerce-google-analytics-implementation/

      Good Luck

  34. andrew February 21, 2014 at 10:31 pm #

    Hello, thanks big time savor. Now, after updating to the most recent version of WooCommerce the “Integrations” tab is gone? And my conversions completely stopped tracking upon this update?

    Do you know how to get ecommerce tracking back up with the newest version of woocommerce, without the integration tab?

    thanks!

  35. Juanma March 22, 2014 at 11:48 am #

    Hi there! Thanks for this great tutorial. I follow all the steps, but everything was already up and running. My only problem is that GA is not tracking events related to ecommerce. All transactions are fine, but I can´t see if people is adding to cart, and so on… so I don´t have information enough about the purchase funnel. Did you notice something about that?

    • Joey Rudisill March 31, 2014 at 8:43 pm #

      Hi Juanma, I’ll follow up with you directly.

Leave a Reply