How to Manage Subscription vs One-Time Purchases

Learn how to trigger events to only fire on subscription vs one-time purchase events

To fire a tag only on a subscription purchase, you need a way to differentiate if a purchase is one-time or a subscription.

This guide will show how to manage configurations with Elevar.

Server-Side Tracking

ReCharge Legacy Checkout

If you're using ReCharge Legacy Checkout then you can simply follow the configuration inside your Elevar destination:

If you are using a subscription provider (Skio, Ordergroove, Smartrr, etc) that uses the unified Shopify checkout, and you want to block all orders from being sent to a destination, then block the recurring orders by including subscription_contract in your settings here:

Client Side Tracking (for GTM)

Do you want to:

  • Split one-time vs subscription orders in GA/GA4
  • Create Subscription conversion for Google Ads (or another channel)

Then follow these steps inside of GTM to manage this.

🚧

You must be using Order Status Scripts for your purchase scripts

If you are tracking your events using the Custom Pixel in Shopify customer events, the selling_plan is not available in the dataLayer and this setup will not work. You cannot user the order status scripts if using Shopify Thank You Page extensibility.

Step 1: Create Custom Triggers in GTM

Navigate to Google Tag Manager > Variable > New
Let's title our variable js - Has Subscription Purchase, select Custom JavaScript as the Variable Type, and input the below in the Custom JavaScript box:

function(){

  var products = Shopify.checkout.line_items;

  for (var i = 0; i < products.length; i++){

    if (products[i].selling_plan_name){

      return true;

    }

  }

  return false;

}

  • Navigate to Triggers > New
  • Let's title our trigger Event - Subscription Purchase, select Custom Event as the Trigger Type, input dl_purchase as the Event Name, and add the condition for it to fire only when the js - Has Subscription Purchase variable we just created equals 'true'. Save it.

  • Duplicate the Event - Subscription Purchase trigger you just created.

  • Title this duplicate Event - One-Time Purchase, and update the condition to only fire when the Subscription Purchase variable equals 'false'.

Step 2: Setup a Subscription Purchase Tag

  • Navigate to Google Tag Manager > Tags > New
  • Let's title our tag GA4 Event - Subscription Purchase & select Google Analytics: GA4 Event as the tag type.
  • You can then match the tag setup below. Make sure to use the Configuration tag that maps to your intended GA4 Property!

  • For the trigger, select the Event - Subscription Purchase trigger you created in Step 1.

  • Then save! Voila - you have your Subscription Only Purchase GA tag!

Step 3: Setup a One-Time Purchase Tag

  • In Google Tag Manager > Tags > New

  • Let's title our tag GA Event - One Time Purchase & select Google Analytics: GA4 Event as the tag type.

  • You can then match the tag setup below. Make sure to use the Configuration tag that maps to your intended GA4 Property!

  • For the trigger, select the Event - One-Time Purchase trigger you created in Step 1.

  • Save your tag and be sure to publish your changes in GTM!

You can now use these same triggers and associate to any other tag in GTM.

Limitations

  • This setup will not work if you have our upsell tracking implemented that fires the dl_purchase event from the post-purchase offer page.
  • This setup will not work if you are using the custom pixel within Shopify's customer events for tracking your checkout and purchase events. You must be using the order status scripts for your Elevar script. This is not compatible with Shopify Thank You Page extensibility.