Two ways to calculate customer lifetime value for ecommerce using Google Analytics data

Many of our customers come to us with a similar question: “how do I measure ecommerce lifetime value (LTV)?”

The latest episode in our Learning Videos series shows you how to do just that for both your one-off purchasers and subscription customers.

Our step-by-step tutorial covers two methods of calculating customer LTV using your Google Analytics (GA) data. You’ll get to know Littledata’s custom dimensions in GA and learn how to visualize your calculations in Google Data Studio.

During installation, Littledata automatically creates several custom dimensions in your connected Google Analytics property. These custom dimensions include:

  • Lifetime Revenue, the sum total a customer has spent in your Shopify store (including one-time purchases and subscription orders)
  • Shopify Customer ID, the unique identifier Shopify assigns to each customer
  • Last Transaction Date
  • Payment Gateway
  • Purchase Count

They offer better data to help you understand your customers’ buying behavior, then calculate and visualize their LTV.

customer lifetime value calculation google analytics

To kick things off, you’ll first need to export your data from GA to Google Sheets or another spreadsheet tool via CSV. Once you’ve enabled the GA add-on in Google Sheets, you’re ready to get started.

Method 1: Calculate LTV by Lifetime Revenue, Shopify Customer ID, and Transaction Count

In the first method of calculating lifetime value, we’ll use Transactions as the metric. The dimensions we’ll use—Shopify Customer ID and Lifetime Revenue—correspond with ga:dimension5 and ga:dimension3, respectively.

Use the image below as a guide to set up your report:

Calculate LTV by Lifetime Revenue, Shopify Customer ID & Transaction Count

Next, set your Metrics Reference as Transactions and your Dimensions Reference as Custom Dimensions.

After you run the report, Google Sheets should look something like this:

customer LTV Littledata

Finally, use Google Sheets’ built-in functions to calculate the average or median LTV of your customers.

Method 2: Calculate LTV by Source/Medium, Transaction ID, Shopify Customer ID, and Transaction Revenue

This second LTV calculation method helps you track which marketing channels bring in your most valuable customers: the ones who spend the most over time.

In this method, use Transaction Revenue as the metric and Source/MediumTransaction ID, and Shopify Customer ID as the metrics. These correspond with ga:sourceMediumga:transactionId, and ga:dimension1 respectively.

This method requires the widest date range possible to capture the most transactional data possible—preferably since you started using Littledata.

Before running the report, your Google Sheet should appear as follows:

Calculate LTV by Source/Medium, Transaction ID, Shopify Customer ID and Transaction Revenue

After exporting your data, your result will look like this—a list of transactions with source/medium and revenue data:

customer LTV by marketing channels calculation results

Next, select all the data in your report to create a pivot table, aggregating by source/medium per customer. The result will reveal the total revenue per customer, per source.

After completing the pivot table, you’re ready to visualize your data in Data Studio.

Build Reports in Google Data Studio

Google Data Studio is one of our recommended reporting tools for ecommerce sites. Why? Because it’s free, powerful, and works really well with Google Analytics.

The first step in visualizing your data is to import your data into Google Data Studio by setting Google Sheets as your source. To do this, select your Google Sheets file followed by the pivot table you created in the previous method, and add it to your report in Google Data Studio.

Change the data source by setting the aggregation to median so results yield the median lifetime revenue per traffic source.

Your report dimension should be set to ga:sourceMedium and your metrics should be set to ga:transactionrevenue and ga:dimension1. Modify Shopify Customer ID from sum to count distinct to reveal the total unique customer IDs, which we’ll use to sort our data. Sort by Shopify Customer ID to see the traffic source that brings the most customers to your site.

 customer LTV google data studio

The resulting report shows you the median lifetime revenue per traffic source, sorted by the total customers per source.


Quick Tips for Subscription Stores Using Custom Dimensions in GA

3 Deep Dives into Customer Lifetime Value for Ecommerce Sites

LTV from GA vs LTV provided by Littledata

How to Calculate Customer Lifetime Value in GA for Shopify Stores

Custom Dimensions for Calculating Customer Lifetime Value

Subscription Analytics

Does Littledata work with my ecommerce reporting tool?

Why doesn’t Shopify analytics match Google Analytics? [ebook]

Why doesn’t Shopify analytics match Google Analytics? [ebook]

Shopify analytics is fine for what it is: a siloed data source that is good at

Introducing Littledata Plus plans for Shopify and Shopify Plus
littledata plus

Introducing Littledata Plus plans for Shopify and Shopify Plus

As Shopify has continued to scale its Shopify Plus plans, Littledata

You May Also Like