The SEM Source

From the blog

Ecommerce Tracking Using WooCommerce & GTM

eCommerce Analytics Setup

One of the most challenging aspects of digital marketing & client management is proving value. What better way to prove value than to show exact revenue dollars from marketing efforts? There's also enhanced eCommerce which shows conversion funnel details, but standard eCommerce provides great insights & is easy to set up using WooCommerce. Another perk is there's no web development or coding experience necessary.

HOW IT WORKS

Regardless of which CMS you use, this is how eCommerce tracking via Tag Manager works. WooCommerce just makes it easy, but these are the fundamental components.

STEP 1: GATHER THE DATA

After the user completes a checkout, the website needs to be configured to create a "data layer". This data layer makes the information easy-to-read for GTM.

STEP 2: CONFIGURE GTM TO READ & SEND THE DATA

Now we have to tell GTM to "read" the data in the data layer from Step 1, and send that data to Analytics.

STEP 3: CONFIGURE ANALYTICS TO SHOW THE DATA

This is the easiest part. Flip a few switches so Analytics reads the data from GTM.

WHAT YOU'LL NEED

Make sure you have everything you need before we get into the nitty-gritty.

  1. A Google Analytics (GA) account. You will need to have GA configured on the website, you can implement the GA code via Google Tag Manager, or another way if you prefer.

  2. A Google Tag Manager (GTM) account.

  3. The Google Tag Manager for WordPress plugin.

STEP 1: GATHER THE DATA

Setting up the Data Layer collects the data & makes it readable.

Step 1.1: Download & Install the PluginAdd New WordPress Plugin Screenshot

Download the Google Tag Manager for WordPress plugin. Log in to the WordPress dashboard and select "plugins" and "add new." Then click, "upload plugin" and upload the zip file which you downloaded from the above link.

 

Step 1.2: Configure the Plugin

Once you've got the plugin installed, navigate to "settings" and there should be a new option for "Google Tag Manager."Once you're there, you'll see a spot for "Google TagManager ID" where you input your ID (GTM-XXXXX).

Note - I have the container code placement set to "off" since I already have GTM placed on the site placed directly into the header.php file. Having duplicate tags on your site may cause errors in traffic.

GTM Plugin Settings WordPress

GTM for WordPress Settings

 

Once you've done this, jump over to the "Integration" tab and select "WooCommerce" and check the box for "Track classic e-commerce."Integration Tab GTM4WP

At this point you have the plugin creating the data layer when a user completes a checkout. You can even run a test checkout and view the source code of a checkout page to see if the parameters are coming through.

This plugin data-layer setup is the only piece that is unique to WooCommerce. You can use the following steps to configure eCommerce tracking using GTM & GA on any site. You can have a developer create a data layer using these parameters.

 

STEP 2: CONFIGURE GTM TO READ THE DATA

Now we set up GTM to read the data from the data layer.

Step 2.1: Make Sure You Have GTM Implemented Correctly

You can either implement GTM using the plugin we installed, or have it implemented working with a web developer following these instructions. Then you can use the Tag Assistant chrome extension to make sure it's working correctly.

Step 2.2: Set Up the Tag

On the "Tags" page, click the big red button for "New" to add a new tag. Then click the pencil icon in the "Tag Configuration" section, and select "Google Analytics - Universal Analytics.

Once you've selected that, you'll have a list of options. Make sure you select "Transaction" for "Track Type".

Under "Google Analytics Settings" pick "New Variable"- then input your tracking ID in this section (UA-XXXX) and go ahead and save the variable. Your finalized settings will look something

like this:

GTM UA Ecommerce Settings

Step 2.3: Set Up the Trigger

Click the pencil in the top-right corner of the "Triggering" section. Then on the "choose a trigger" page, click the little blue plus sign "+" in the top-right.

Once there, click into the "Trigger Configuration" box and select "Custom Event".Custom Event Trigger

You can name your even whatever you like, but I like to keep the naming consistent with the event name in Analytics. In this case, the plugin will create an event named "gtm4wp.orderCompleted". This is what your finalized event trigger will look like:Custom Event Trigger

Once you've completed this tag & trigger, make sure to save and publish your changes.

 

STEP 3: CONFIGURE ANALYTICS TO SHOW THE DATA

The last & easiest step is just flipping a couple of switches in Analytics.

Step 3.1: Make Sure Analytics is Working on Your Site

You can implement the Analytics tag via GTM or hard-coded, but make sure it's not on the site twice. Also, use the plugin mentioned in step 2.1 to make sure the Analytics tag is working.

Step 3.2: Set Up Ecommerce in Analytics

Once you're logged in to Analytics, select the "Admin" option on the left navigation. Then select "Ecommerce Settings" from the column under "View". Flip the switch for Ecommerce and then hit "Save" at the bottom.

eComm admin setting

LAST STEP: TESTING

It was pretty easy, but let's make sure it works.

The best way to test everything is to log in to your GTM profile, and click the "Preview" button in the top-right. GTM Preview Mode

Once you're in preview mode, open a new tab and complete a checkout. In preview mode, select "data layer" and it should look something like the below:Data Layer Values GTM Preview

As long as you're seeing this data layer information in GTM, and you've saved & published everything, this information should be sent to Analytics. At this point, you can go to Analytics and navigate to "Conversions" and "Ecommerce".

Ecommerce Overview

You should be able to see your test transaction here, just make sure your date view is "Today". Also note that sometimes it takes a couple of hours to see transactions in Analytics.

Comment below or send me a message with any questions!

 

Leave a Reply

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