How it Works: Recharge to Google Analytics connection

Updated on 2021-12-28

Recharge to Google Analytics

This is a guide to how Littledata's Recharge connection works with your Google Analytics setup. We look at which subscription events you can track, how to use Littledata's views and filters in your GA account, and how the integration works behind the scenes.

tip:

For information on sending Recharge data to your Segment workspace, see the Shopify to Segment guide (under 'Subscription events').

Tracking subscription orders

In addition to the one-off orders tracked automatically by Littledata's Shopify connection, our Recharge connection tracks different types of subscription orders, including first-time subscription orders, recurring orders, and prepaid subscriptions. This helps with both marketing analysis (seeing where subscribers come from) and LTV analysis (seeing where your best subscribers come from, and how their subscriptions evolve over time).

We automatically sets the order affiliation in Google Analytics for all orders coming from Recharge as follows:

  1. First time subscription orders are tagged as Subscription First Order *
  2. Recurring orders generated by the terms of the subscription contract are tagged as Subscription Recurring Order
  3. Prepaid recurring orders generated by the terms of the subscription contract are tagged as Subscription Prepaid Order

* For subscriptions in the Shopify checkout, this affiliation is only added once you have authorized Littledata's app to access Recharge.

In Google Analytics 4 you'll need to create an event-scope custom dimension for the affiliation property to use this in segments or reports.

adding affiliation dimension

Recharge checkout events

These events work for Shopify's unified checkout. Read more about unified checkout steps.

When the end customer starts and progresses through the checkout we send events to Google Analytics:

StepGA4 event name
1begin_checkout
2add_shipping _info
3add_payment_info

These checkout step events contain all the product data, and can be segmented by product, SKU, brand etc - along with any other user dimension in GA.

The trigger for these events are checkout/created and checkout/updated webhooks from Recharge (fully server-side).

Littledata’s checkout tracking works without the need to add Google Tag Manager or other tracking scripts to the Recharge checkout. This simplifies implementation and reduces the risk that 3rd party scripts will interrupt or intercept sensitive payment details or other data.

Here is an example of a checkout event payload sent to Google Analytics 4:

{
  "name": "begin_checkout",
  "sent_from": "Littledata server",
  "currency": "USD",
  "value": 169.95,
  "littledata_client_id": "362565843.1666037349",
  "params":{
    "items":[
       {
         "item_id": "6572436193342",
         "item_name": "White Tee",
         "item_brand": "Littledata",
         "item_variant": "white / xl",
         "item_variant_id": "39391140118590",
         "item_sku": "TEE_123",
         "item_category": "Tees",
         "price": 169.95,
         "currency": "USD",
         "quantity": 1
        }
     ],
  }
}

Subscription lifecycle events

Littledata sends complete subscription lifecycle events to Google Analytics (or Segment). This helps you understand subscriber growth and customer behavior in more detail.

find recharge events in GA

The connection automatically adds tracking for the following events:

  • Subscription Created
  • Subscription Cancelled
  • Subscription Updated
  • Order Processed
  • Charge Failed
  • Payment Method Updated
  • Max Retries Reached

Read the full guide to tracking subscription lifecycle events in Google Analytics (and GA4) with Littledata. The guide includes details about event naming conventions in Segment and Google Analytics.

How to implement tracking for a Headless storefront using Recharge

All the steps needed in tracking and linking the customer journey on a Headless storefront are highlighted in our Headless Demo.

Depending on the destination of the data, there is a selection of identifiers that need to be passed onto the checkout order_attributes via the Recharge checkout API.

Where to find subscriptions in Google Analytics

With the Recharge connection, you can distinguish between three types of order:

  1. One-time orders (affiliate code: Shopify) standard one-off orders through your Shopify checkout
  2. First-time subscriptions (affiliate code: Subscription, Subscription First Order): first-time subscription orders made via Recharge
  3. Recurring orders (affiliate code: Subscription, Subscription Recurring Order): recurring subscription orders made via Recharge
  4. Prepaid orders (affiliate code: Prepaid, Subscription, Subscription Recurring Order) recurring subscription orders made via Recharge that are paid in advance for a fixed period of time, usually 6 or 12 months.

Learn more about how to segment orders using the 'Affiliation' dimension in Google Analytics.

How to match product impressions in Google Analytics

When you create a subscription product for your store, Recharge creates a secondary product containing the subscription criteria (delivery frequency, discounts, etc.). This is a clone of your one-time product with the addition of  subscription offerings.

The one-time and subscription products will look something like this:

tracking subscription products in google analytics

In order to have a consistent product reporting, it is crucial to have a matching SKU for a product that has both a subscription and non-subscription alternative, and their respective variants.

If the SKUs match, you will see this in your Product Performance reports:

Instead of this:

Doing this will ensure the presence of one-time and subscription products under the same product umbrella in your reports, resulting in a consistent and accurate representation of how your products are performing.

How the Recharge connection works behind the scenes

Littledata makes a server-side integration between Shopify and Google Analytics. Every time an order is processed on Shopify, Littledata links that revenue to the user in Google Analytics (as stored in the _ga cookie). To link orders to users, Littledata needs to add the customer’s client ID to the note attributes of the order; that will appear in your Shopify admin, but is not visible to customers.

If our app cannot find a user session associated with the order — for example, when the subscriber signed up before you installed Littledata’s tracking — we add a default client ID. You can still link all these ‘orphan’ user sessions together via the Shopify customer ID dimension.

Learn more