WooCommerce Goal Tracking With Google Analytics and Paypal

Let me guess….

You’re angry and frustrated, right?

I bet you’ve just spent the last 2 hours searching all over the internet trying to find out how to make WooCommerce work with Google Analytics goal tracking and Paypal, so that you can do something that would (or at least should) be simple. That being of course being able to monitor conversions within Analytics.

Am I right?

LOL. That’s actually funny because you know what? I did that too.

Anyway, firstly, calm down, ….there’s no need to smash your keyboard again – you’re in luck, …why? Because I’m going to show you – step by step, how to set this up, so that it works. No nonsense, no BS.

Let’s get started.

Before getting into this, I’m going to assume the following –

  • You’re using WordPress
  • You’re also using WooCommerce
  • You haven’t made any weird or funky customizations to anything that might prevent this from actually working
  • You don’t have 500 plugins installed that are all conflicting with each other
  • You’re using Paypal to accept payments (and have an active account)
  • You want to capture conversions within
    • WordPress itself (because that’s always nice to have)
    • Paypal, because let’s face it, you need that for other reasons (disputes, refunds etc)
    • Google analytics. Which is the very point of this exercise, right? (most important)

Here’s a basic diagram of what we’re wanting to achieve.

transaction-process.gif

Pretty straight forward. Let’s look at each point.

  1. The customer checks out and is sent to Paypal for payment.
  2. Customer makes payment.
  3. Once payment is made, the customer is redirected back to our site and all the magic stuff happens automatically.

We then end up with fancy graphs and stuff like this within Google Analytics, which shows our conversions.

analytics-conversions1.gif

STEP 1. Setting up WooCommerce

The first thing you’ll want to do is ensure you have Paypal setup as the desired payment gateway within WooCommerce itself. Click on Payment Gateways, then select “Paypal”. Then save changes. By the way, all of these steps are under WooCommerce > Settings within the admin control panel of WordPress.

woocommerce-integration2.gif

Then do the following…

  1. Click on the sub menu that reads “Paypal”
  2. Check the box that reads “Enable Paypal Standard”
  3. Enter the email that is associated with your Paypal account in both fields (paypal email and receiver email)

woocommerce-integration3.gif

Piece of cake. Let’s now move onto the next step.

  1. Click on “Integration”
  2. Enter your Google Analytics tracking ID – eg UA-73222619-2 (You can find this inside your actual tracking code in GA)
  3. Enter your domain name. I took out the “http://” (not sure if this made any difference, but what I have here definitely works)
  4. If you are using Yoast for SEO (which I am in this case, infact I highly recommend it) then leave this box UNCHECKED. You don’t want two instances of Google Analytics tracking code per page.
  5. Check this box
  6. Check this box as well.

woocommerce-integration.gif

Okay, that’s it for that. Now let’s move onto the next step.

STEP 2. Setting up Paypal

Log into Paypal and do the following

  1. Click on “Profile”
  2. Then click on “My Selling Tools”
  3. Then click on “Website Preferences” …update

paypal1.gif

Done that? Cool, let’s move on.

Next, we want to enable “Auto Return” within Paypal. This ensures the customer is redirected BACK to our website after making payment. This is very important because it finalizes the transaction, and it’s the thank you page that we’re monitoring with Google Analytics as being our “goal” page. Make sense?

Okay, so do the following…

  1. Enable Auto Return
  2. Enter in the following within the Return URL – http://www.yourdomain.com.au/checkout/order-received/?utm_nooverride=1

Wait, what?

Don’t panic, let me explain.

  • Firstly that URL is what WooCommerce redirects customers to after an order has been processed. It’s like that by default, so don’t muck around changing anything.
  • http://www.yourdomain.com.au is just an example, so be sure to type in your OWN domain there.
  • This bit at the end, ?utm_nooverride=1 simply prevents Paypal as being acknowledged as the source of the sale within Google Analytics. Without this bit of code, ALL of your sales would originate from Paypal, and that’s silly. The whole purpose of doing this is so we can monitor conversions within Google Analytics and more importantly – know where they came from.

Okay, got it? Good, set your options just like I said.

paypal2.gif

Once we’ve done that, it’s time to move on to the next step which involves creating our goal within Google Analytics.

STEP 3. Setting up goals in Google Analytics

Now the fun really begins. This is where I start talking about “regular expressions” as a match type within Google Analytics. If you’re not sure what the regular expressions are, here’s an example.

{[-+]?([0-9]+\.?[0-9]*|\.[0-9]+)([eE][-+]?[0-9]+)?}

Now if you’re anything like me, just looking at that will give you a headache. To me, it looks like a cat ran across my keyboard. But nevermind, don’t get too concerned, I’ll just show you what need to type in so that this works, and you can get back to doing something more important like watching cats playing the piano on Youtube.

Let’s begin with creating our goal.

Log into Google Analytics and select the property you wish to monitor. Then do the following…

  1. Click on “Admin”
  2. Click on “Goals”

google-analytics1.gif

Once you’ve done that, you should be at a screen that looks like this below. Just click on “Create a Goal”

google-analytics2.gif

Then do the following.

  1. Underneath template, select “Revenue”, as we want to track when sales are taking place.
  2. Click on “Next Step”

google-analytics31.gif

Okay, next step.

  1. Enter the name of your goal. I usually set mine to “Customer Purchase”. You can leave it default here if you like, it doesn’t matter.
  2. Select “Destination” as the type.
  3. Click on “Next Step”

google-analytics4.gif

Alrighty, once you’ve done that, then set your goal EXACTLY as I have it below.

  1. Select “Regular Expression” as the match type, then enter /?order=.{1,}&key=order_(.)
  2. Click on “Create Goal”

google-analytics5.gif

 STEP 4 – Testing

Ok, that’s everything that needs to be done in order to make this work, so now is a good time to test.

In order to simplify this process, I went about creating a product in my WooCommerce store and setting it at just $1. This way I can make a test purchase and it’s not going to cost me much. I know I could muck around in Paypal’s sandbox, but by the time I’d set that up, I could’ve been finished already.

Here’s my dummy product.

test-purchase1.gif

I add to cart, then check out then make payment with Paypal.

test-purchase2.gif

Upon completion of successful payment, Paypal automatically redirects me back to the website of which I made purchase from.

test-purchase51.gif

And lastly, I hit the thank you page, which is vital to complete the process.

test-purchase6.gif

And if I look in the address bar, this is an example of what I see.

http://www.yourdomain.com.au/checkout/order-received/?order=84&key=order_52db1b3099b98&utm_nooverride=1

Special tip #1

If you want to find out how I ended up figuring out the regular expression, do this.

  1. Log into Google Analytics
  2. Click on the property you want to track
  3. Click on Behaviour
  4. Click on Site Content
  5. Click on Content Drilldown
  6. Click on /checkout/ (You will only see this if you have performed a few test purchases. If you don’t see it, then do some test purchases)
  7. Click on /order-received/
  8. Then you should see all of the destination pages (as Google interprets them within Google Analytics)

See below.

troubleshooting.gif

Once I had this information, filling in the blanks was relatively easy.

Special tip #2

You might be thinking, “What if the user closes the browser or something at Paypal and they don’t come back to the thank you page? Wouldn’t that screw everything up?” The answer to that unfortunately is yes, but that’s simply beyond our control.

The best way to check the accuracy of your data would be to cross check it within WooCommerce as well as Google Analytics. It’s not ideal, but it’s better than nothing.

The other thing that might be worth a try is to use a simple Javsascript popup just before the check out process that reads, “Be sure to complete payment at Paypal, do not close the browser or click away”.

Conclusion

As with any form of online business – it comes back to measuring everything, so that you know whats going on. Once you get an idea of how your site is performing, you can start making changes to try and improve your conversion rates. This gives you more control as it eliminates any guesswork.

That’s it for now. I hope you’ve found this short tutorial helpful. I know I would have saved myself a lot of time if I had of had something like this when I was setting this up!

Be sure to give me some social love because that makes me feel all warm n fuzzy.

8 comments on “WooCommerce Goal Tracking With Google Analytics and Paypal

  1. Matt on

    Hey John

    The latest version of WooCommerce does not have integration built into, you need to install the plugin “WooCommerce Google Analytics Integration” to enable integration settings… great piece of content by the way, thanks for putting this together…

    Reply
  2. Julie on

    hey hi,

    I am using woocommerce for my affiliate site. I was creating a goal and funnel for my website and after trying lots of stuff, still unable to achieve what I want. Here is a summary of what i need in google analytics Goal

    1. My final page/Goat is CHECKOUT page i.e. domain.com/checkout/

    2. My funnel should be like this

    Step 1 = Product Url i.e. domain.com/product/(xyz)/
    Step 2 = Cart URL = /cart/

    Can you tell me how to setup this ?

    When a person go to checkout, it redirects him to the other website.

    Reply
  3. Rachael on

    Hi John

    This article is great. Very clear. However it’s not usable as the plugin mentioned by another commenter has been out of date for a while, as Woo stopped the auto integration. Would love to see how you would get round this.

    Thanks, Rachael

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.