The world’s leading publication for data science, AI, and ML professionals.

How to Set Up Ecommerce Tracking for your Teachable School using Google Analytics 4

Know who and how your best customers are finding your Teachable school.

Image via Motion Array under license to Eric Ramos.
Image via Motion Array under license to Eric Ramos.

Teachable allows creators to share what they know in an online course business. Creators can share video or text instruction to their students through free and paid options. Teachable offers easy-to-use features and fewer tech headaches to get an online course started. Once you get an online course set up, you can track and monitor student enrollments and sales within the Teachable platform.

Having been in Digital Marketing Analytics for the last 15 years, the most successful companies implement a culture of accelerated learning to make faster business decisions. Forecast, monitoring, and Tracking are vital in creating a foundation to measure your success.

Whether you are already generating sales or just getting started, eCommerce tracking will enable you to be more efficient where your resources go to monetize your business best.

After you implement eCommerce for your Teachable School from reading this blog post, you’ll be able to get the insights you need to acquire more of your best students.

Krista Seiden GA 4 eCommerce Report Walk-Through
Krista Seiden GA 4 eCommerce Report Walk-Through

Google Analytics is a web analytics tool that allows you to discover how audiences arrive at your site and what they are doing. The origin of Google Analytics goes as back as 1996 from a group of founders based in San Diego. For eCommerce websites such as your teachable online school, your goal is to make it seamless for a visitor to enrol in your free and paid courses.

Google Analytics 4 offers a set of "Monetization" reports that let you analyze purchase activity on your site. You can see product and transaction information, eCommerce conversion rates, and data on product lists, promotions, coupons related to conversions. Krista Seiden highlights a few of the "Monetization Reports" that you would expect to see when you set up your Google Analytics eCommerce tracking correctly.

Krista Seiden GA 4 eCommerce Overview Report
Krista Seiden GA 4 eCommerce Overview Report

While Teachable has a native Google Analytics integration that is easy to set up in your teachable school, it stops short of utilizing the Google Analytics 4 e-commerce reporting for two primary reasons.

  • Google Analytics 4 is new. Google released GA4 in October 2020, and some legacy features such as implementing eCommerce tracking in G4 is still in its infancy, as explained in Simo Ahavas’ blog post.
  • Teachable prohibits 3rd party tracking on the Checkout page where the Credit Card form exists. Without Google Analytics on the Checkout page, this limits data about the transaction from natively being captured in Google Analytics.

I wrote this article in December 2020 when there hasn’t been a native Teachable eCommerce Google Analytics 4 solution. This article may outdate itself in the future; however, for now, this will allow creators to take advantage of GA4 Ecommerce reports.

What exactly happens

When a person decides to sign up or pay for an online course, the visitor goes to the Teachable hosted payment page to complete the order. For example, if your Teachable school is on website.com, a user would be sent to a payment page on sss.teachable.com to complete the transaction. Unfortunately, you can’t add 3rd party tracking tags like Google Analytics on their pages to more easily track eCommerce metrics.

Image by Author: Teachable Prohibits 3rd Party Tracking on the Sign Up page limiting native eCommerce Tracking in GA
Image by Author: Teachable Prohibits 3rd Party Tracking on the Sign Up page limiting native eCommerce Tracking in GA

Once a user has successfully submitted for payment or free sign-up, Teachable routes them back to your Teachable school with appended transaction information from the checkout page to your Thank You Page.

Because you can have Google Analytics on the Thank You Page, you can retrieve the transaction information from the URL String’s query parameters into a structured format needed for Ecommerce Tracking via Google Tag Manager.

Image by Author: Teachable does persist Transaction information in the URL String of the Thank You Page URL.
Image by Author: Teachable does persist Transaction information in the URL String of the Thank You Page URL.

Prerequisites

Here are some prerequisites before implementing Ecommerce tracking.

Step 1: Data Collection

On the Thank You Page, the URL will contain query string parameters appended to the Thank You page URL. The URL will look like this if the Teachable School name is website.com.

Image by Author: Query String Parameters appended to the Thank You Page URL.
Image by Author: Query String Parameters appended to the Thank You Page URL.

Transaction information is displayed in query parameters such as "sale_id, final_price, purchased_course_id," with their corresponding values. Teachable uses these data points as well for their reporting purposes within the Admin Dashboard.

Our goal is to parse the individual parameters and their values from the query string so we can map this into Google Analytics 4 eCommerce schema.

Google Tag Manager User-Defined Variables

To capture this information in Google Analytics, we will need to set up User Defined Variables in Google Tag Manager to retrieve the Query String parameter and their corresponding values.

Image by Author: In Google Tag Manager, create User-Defined Variables for each of the Query String Parameters.
Image by Author: In Google Tag Manager, create User-Defined Variables for each of the Query String Parameters.

In our case, there are 13 user-defined variables that we will need to create.

Image by Author: A list of Query String Parameters that are in the Thank You Page URL.
Image by Author: A list of Query String Parameters that are in the Thank You Page URL.

Because the Teachable Course Name is not in the query string parameter, we will use the Page Title to hold the Course Name. You can do this by creating another User-Defined Variable using a DOM Element Variable Type and CSS Selector Selection Method. You will need to specific title as the Element Selector.

Image by Author: In Google Tag Manager, create User-Defined Variable to capture the Course Name via the Page Title.
Image by Author: In Google Tag Manager, create User-Defined Variable to capture the Course Name via the Page Title.

Step 2: Data Normalization

Any values in the URL string related to fields that capture Price and Sales Amounts such as purchased list price and the final total omit the decimal place in the Query String Parameter. We can also compute Discount using the Purchased List Price and Final Total to capture the Discount value associated with a purchase.

Create the following three additional User-Defined variables in Google Tag Manager.

Step 3: Thank-You Page Trigger

Create a trigger that will fire when the Page URL contains thank-you. This will be needed for the next step to indicate when to capture and persist the Query String data for Google Analytics 4 Ecommerce reports.

Image by Author: In Google Tag Manager, create a Trigger to fire only on Thank You Pages.
Image by Author: In Google Tag Manager, create a Trigger to fire only on Thank You Pages.

Step 4: Data Capture

Now that we have set up the ability to capture the Query String Parameters, we are ready to capture the data into the schema structure for Google Analytics 4 Ecommerce Tracking.

A transaction is equivalent to Google Analytics 4 Ecommerce event type of purchase. There are Purchase parameters tied to both the Transaction and Item that Google Analytics 4 provides so you can map your User-Defined Variables that we are capturing. Google Analytics 4 eCommerce Tracking is event-based and collected through parameters defined in this Google Analytics 4 guide for purchase activities, and formatted with this layout.

For example, I mapped the fields from Teachable into Google Analytics 4 eCommerce schema.

  • product_name → item_name
  • sales_id →transaction_id
  • etc..

I then used the Trigger from the previous step to tell Google Tag Manager to collect the information only on Thank-You pages.

Image by Author: In Google Tag Manager, create a Tag to persist the Transaction data into GA 4 eCommerce schema.
Image by Author: In Google Tag Manager, create a Tag to persist the Transaction data into GA 4 eCommerce schema.

You can copy and paste this Tag into your Tag and make sure to update your Google Analytics Measurement ID, G-XXXXXXXX42" when you create your Tag.

Step 5: Test Your Implementation

With the help of Google Tag Manager Preview mode and Google Analytics 4 Debug Mode, you can test if your implementation will record online free and paid sign-ups to your Teachable School. Notably, Google Analytics 4 has a four to five-hour window when eCommerce transactions display in your Monetization reports.

If you want to learn more about both tools, Julius Fedorovicius has an excellent write up in his blog posts about Google Tag Manager Preview & Google Analytics 4 Debug View.

Summary

As a creator, your value and passion are in generating valuable content for your students. Teachable gives you a platform that does take away headaches from setting up an environment to host your courses and makes it simple to generate sales.

I hope this article gives you further guidance in taking one more step to know where you are acquiring your best customers. By having the ability to track eCommerce performance by channel, you can be more efficient with your time in focusing on what matters most.

Are you having trouble with implementing the solution? I mentor aspiring Data Analysts and overlooked talent to gain the experience they need to make a better living through contract jobs. If you want some help, complete this Google Form, and I will get back to you.


Related Articles