How to Properly Setup E-commerce Analytics for WordPress

Updated reading time
How to Properly Setup E-commerce Analytics for WordPress
Great companies working together to make WordPress Ecommerce Analytics available for everyone.

One of the recommended plugins to easily setup Ecommerce Analytics for your website would be the Enhanced Ecommerce Google Analytics Plugin for WooCommerce. This guide will cover the use of the plugin as well as the proper Google Analytics setup for your WordPress E-commerce website.

Steps to Setup WordPress E-commerce Analytics

  1. Install the plugin Enhanced Ecommerce Google Analytics Plugin for WooCommerce and follow the setup instructions
  2. Add necessary filters/views (optional)
  3. Add referral exclusions based on your payment gateways
  4. Setup Google Analytics conversion goals
  5. Complete a test purchase

1. Installing the Plugin Enhanced Ecommerce Google Analytics Plugin for WooCommerce

First off, we will have to install and activate the plugin. You can download the plugin here.
Afterwards, follow the installation instructions as mentioned on the plugin’s download page. It will consist of enabling E-commerce on Google Analytics, adding your Analytics Tracking Code, and adding meaningful checkout labels.

2. Add Necessary Filters/Views

When it comes to using Google Analytics, it is mandatory to have 3 different views, namely: 1 Master View, 2 Test View, 3 Raw Data View. You can see this being used in the Google Analytics Demo Account. The 3 Raw Data View is a renamed version of the first default view that you will notice (All Website Data).

Setting up the 3 Views and Their Filters

3 Raw Data View

Simply rename your All Website Data into 3 Raw Data View. This is because we will be using the other views to properly gather users with as little noise as possible of which might likely skew your data (bots, your office, etc.). Leave this without any such filters.

2 Test View

Create a View named as 2 Test View. And add 2 filters:

Filter #1: Include Only Internal IP Address. This will house all your test data and will be made sure not to conflict with the third view below.

Filter #2: Include Only Hostname. This will make sure that no one can skew your data by copying your Analytics tracking code on their website.

1 Master View

Create a View named as 1 Master View. Set this as your Property Settings › Default View. And add 2 filters:

Filter #1: Exclude Only Internal IP Address. As this is your default view, make sure that only your office IP address is excluded.

Filter #2: Include Only Hostname. This will make sure that no one can skew your data by copying your Analytics tracking code on their website.

3. Add Referral Exclusions Based on Your Payment Gateways

Payment gateways are used to transfer a customer’s details towards a different website — in this case, the payment provider — to complete the purchase with the remaining details. This helps make the customer’s checkout process easier and streamlined since the customer will most likely be familiar with navigating through a payment gateway, rather than the rest of the internet coming into terms with how to handle a checkout process.

For example, to make sure that Google Analytics does not track the user coming from paypal.com payment gateway as a new session, you will have to make sure that all your payment gateway domains are added to your Google Analytics Referral Exclusion List.

Bonus: Add an Auto-Return URL to Your Payment Gateway

Google Analytics would not track the purchase unless the user returns to your website to view the Order Confirmation page (in WooCommerce). Other payment gateways would automatically have the Auto-Return URL in place, however some of them like Paypal would require you to have this set up manually.

You can have a look at how to set up the Paypal Auto-Return URL here.

4. Setup Google Analytics Conversion Goals

In this case, you will set up the Purchase Complete goal. This is the goal that will be tracked when a customer completes their purchase, and return to the order confirmation page of your WordPress website. You will also be duplicating the goals towards all the other Views, so that goal tracking is consistent across the other views.

Adding the Goal

  1. Select your 2 Test View.
  2. Under your Admin › View column › Goals, click on + New Goal.
  3. Add the name Purchase Complete.
  4. Choose any Goal slot ID.
  5. And choose the Type as Event.
  6. Click Continue.
    And set the following as your Goal details (exactly as they are, including capitalisation):

    • Category: Enhanced-Ecommerce
    • Action: purchase
    • Label: order_confirmation

Duplicating the Goals to the Other Views

Now that you have the goal set up for your Test View, the exact same goal/s will have to be applied to all the other Views. You could manually re-add them.

But to quickly duplicate your goals onto all the other views:

  • Re-visit the Admin › View column › Goals
  • Select the Goals that need duplicating
  • And click on Share (next to the +New Goal button)
  • Select Share template link, and click the Share button

You will be provided with a unique URL. Copy this, and paste it into your browser address bar and visit the URL. Select your Google Analytics property from which to duplicate the goals, and click Create.

5. Complete a Test Purchase

Finally, you will want to make sure everything is in place by completing a test purchase. In WooCommerce, you can do so by enabling Sandbox Mode from your payment provider, for example, Paypal Sandbox mode, or Sagepay Test mode, to name a couple. Please refer to your payment gateway’s sandbox mode, and complete a test purchase.

You will then be able to view your Google Analytics account for any anomalies that might crop up. But hopefully, through properly following this guide you will not have any issues.

Congratulations! You’ve completed the setup instructions for setting up Enhanced E-commerce Analytics for WordPress. Once the transactions start rolling in, within 24 hours you will be able to view E-commerce analytics data and check if there are any referral exclusions to add.

Any questions let us know in the comments below!