Custom dimensions for calculating customer lifetime value

Updated on 2024-02-26

Calculating customer lifetime value (LTV) is essential for ecommerce businesses, but it can be difficult without the right analytics setup.

Littledata makes this easier for Shopify stores, and especially for subscription businesses, by adding custom dimensions to Google Analytics.

In addition to the dimensions below, Littledata tracks subscription orders from any checkout and allows the LTV of these orders to be tied back to marketing campaigns.

Custom event parameters

For all the ecommerce events from the checkout onwards we sent the following user parameters to help you build audiences, segments and analyse user behaviour using custom dimensions

lifetime_revenue_ldTotal of revenue from current and all previous purchases for that customer on ShopifyUser
purchase_count_ldCount of current and all previous purchases for that customerUser
last_transaction_date_ldDate of customer's last orderUser
shopify_customer_id_ldCustomer ID as used on ShopifyUser
littledata_client_idClient ID: the cookie identifier Google uses to group events by userUser
affiliationA coma-separated list of order tags. Untagged orders use ShopifyEvent
store_nameThe name of the Shopify store generating the event. Useful when you have multiple country stores feeding into one GA property.Event
app_idThe app identifier which generated the order.Event

User parameter naming was changed as of August 2023 to comply with GA4's 24 characters limit.

Automatic Custom Dimensions in GA4

In Google Analytics 4, each custom dimension that you wish to use in any report must be first configured based on user parameters that Littledata sends. One property can have up to 25 custom dimensions.

Littledata automatically sets up following custom dimension in your Google Analytics proper

Custom dimensionDescription
Lifetime RevenueTotal revenue of current and all previous purchases for that customer on Shopify
Purchase CountCount of current and all previous purchases for that customer
Last Transaction DateDate of customer's current / last order
Shopify Customer IDCustomer ID as used on Shopify
App NameName of the app on which the order was made

Setting up a GA4 custom dimension

If you want to set up further custom dimensions based on the above event parameters, follow these steps.

Step 1

Go to Configure > Custom definitions > Create custom dimensions

Step 2

Name your dimension, select User scope, and select the desired user property from the drop down menu

You can now start using this custom dimension in the standard reports as well as in custom reports from the Explore section. |

Sample use case

Let's say that you want to find the lifetime value by channel. Based on the combination of standard info in Google Analytics (eg channel grouping) and the following custom dimensions

  1. lifetime_revenue_ld
  2. shopify_customer_id_ld

You can calculate what is the lifetime revenue by channel (the full picture).

Create audiences based on the last purchase and number of orders of the customer:

Using a segment in Google Analytics you can create (and export as audience) a segment that includes all users with the custom dimension:

  • last_transaction_date_ld
  • purchase_count_ld

You then can use that segment to retarget them on Google Ads.

This is an example for users that have purchased only once in the last month:


Since the last transaction date is sent as custom dimension, you will need to a regular expression to match the date

Further reading