Home
Integrations Library
E-Commerce Integrations
Post-Purchase Tracking In Shopify
Post-Purchase Tracking In Shopify

SERIES:

Post-Purchase Tracking In Shopify

This article will explain the process of how to set up post purchases as upsell events inside Everflow.

The Goal

Your Shopify store is set up to offer customers additional products after their initial purchase is complete. You want to track these valuable upsells as a distinct conversion event in Everflow to properly reward the partners who drive them.

This guide walks you through the process of placing a script in your Shopify settings to track those post-purchase events.

Before You Begin

  • You need an active Shopify account with a post-purchase upsell app or feature enabled.
  • In Everflow, you must have an Offer ready with a specific Advertiser-Level Event created for the upsell (e.g., "Post-Purchase" or "Upsell").
Heads Up! On the Offer level, you must Allow Duplicates. Additionally, please contact the Everflow Support team to configure your account to deduplicate conversions by order_id + adv1. Without this setting, your upsell conversions will be tracked but flagged as invalid.
1 Gather Your Everflow Data First, you'll need three key pieces of information from your Everflow Offer page. Tracking Domain: Found on the Tracking card. Advertiser ID (aid): Found on the General card. Advertiser Event ID (adv_event_id): This is the ID for your specific upsell event, found on the Revenue & Payout card. In this example: Tracking Domain is https://www.serve-eflow-test.com Advertiser ID is 139 Advertiser Event ID is 26 Note On the Offer's Tracking card, ensure the Conversion Method is set to Javascript SDK. If it isn't, navigate to Edit -> Attribution and select it from the dropdown menu. 2 Prepare the Shopify Post-Purchase Code Here is the code snippet you will place in Shopify. Copy this code and replace the three placeholder values with the data you gathered in Step #1. INSERT_TRACKING_DOMAIN INSERT_ADVERTISER_ID INSERT_ADVERTISER_EVENT_ID
Code Snippet:
Example (Using our sample data):
__wf_reserved_inherit
3 Place the Code in Shopify In your Shopify admin dashboard, navigate to Settings -> Checkout Scroll down to the Order status page section Find the Additional scripts text box for the Post-purchase page Paste your completed code into this box Click Save
__wf_reserved_inherit

The Result

You're all set! When a customer completes an upsell after their initial purchase, the script will fire and send the conversion data to Everflow.

You will see it recorded under your designated upsell event, allowing you to accurately track performance and manage payouts for these high-value actions.

Tracking with Checkout Extensibility

Newer Shopify stores use Checkout Extensibility, which changes where tracking scripts can live. The key points to be aware of:

  • Checkout Extensibility removes the Order Status (Thank You) page "Additional scripts" section. However, the Post-purchase page "Additional scripts" section described above remains available, so the post-purchase upsell method in this guide still works.
  • For everything other than the post-purchase upsell, Checkout Extensibility stores track events using Customer Event Pixels instead of the classic "Additional scripts" boxes.
Note The Customer Event Pixel used for Checkout Extensibility does not currently expose an event for upsells or post-purchases. To track those, continue to use the Post-purchase page "Additional scripts" section, which stays accessible even when Checkout Extensibility is enabled.

Tracking Other Events with Customer Event Pixels

Beyond post-purchase upsells, you can track any of Shopify's standard customer events (for example, product_added_to_cart or checkout_completed) using Customer Event Pixels. This works for both standard Shopify and Shopify Plus stores. Shopify maintains the full list of standard event names in its Web Pixels API documentation.

To set up a Customer Event Pixel, you will need the same Everflow values gathered in Step #1 (Tracking Domain, Advertiser ID, and Advertiser Event ID), plus the exact Shopify standard event name you want to track.

Code Snippet:
Note If you are not using the Everflow app integration and do not want to edit your theme files, you can also place the Everflow click script through the page_viewed Customer Event Pixel. This is the same approach the Everflow integration uses to record the initial click.

Adjusting the Conversion Amount

When you use the Everflow Shopify integration's conversion script, the value sent to Everflow can be tailored to match how you want partners rewarded.

Shipping cost

By default, the integration sends the subtotal, which does not include shipping. (Prior to January 2020, the grand total including shipping was sent instead.) If you want partners to be paid on the grand total including shipping, switch to a custom script in the integration form and pass the total price macro:

Excluding tax and shipping (Checkout Extensibility)

On Checkout Extensibility stores, you can calculate a precise amount that excludes both tax and shipping before sending the conversion:

Passing Additional Data in adv Parameters

You can enrich your conversions by passing extra details into the adv1 through adv5 parameters of the conversion script. The exact field names differ slightly between the classic checkout and Checkout Extensibility.

SKUs

To pass every purchased SKU in a single adv parameter on a Checkout Extensibility store, build an array of SKUs from the line items and send it as a comma-separated string:

Customer first and last name

To include the customer's name, use the checkout object's shipping or billing address fields in an adv parameter within your custom conversion script:

Customer email

Email is collected automatically only when a conversion comes in through the API or webhook. To make sure email is always passed in your conversion script, add the email field explicitly:

Note This works when the standard Shopify checkout object is available. If you use a custom checkout page, the Shopify object may not be present, so run a test conversion to confirm nothing breaks before going live.

New vs. Returning Customers

Shopify exposes a value that indicates whether a buyer is placing their first order. On a Checkout Extensibility store, you can pass this true/false value into an adv parameter so you can distinguish new customers from repeat customers in your reports:

If you would rather record returning customers (where isFirstOrder is false) as a separate event, you can branch the conversion to add an Advertiser Event ID only for returning buyers:

Note The first-order value and the option to route returning customers to a separate event are only available on stores using Checkout Extensibility. Replace ADV_EVENT_ID with the Advertiser Event ID for your returning-customer event.

Passing Currency

On Checkout Extensibility stores, you can pass the order's currency alongside the conversion so multi-currency stores report correctly:

Order Number vs. Order ID

Shopify has two different order identifiers, and only one of them can be passed through your conversion script:

Order Number This is the number customers see on their confirmation page and order history (for example, #1001, incrementing by one for each order, with an optional prefix or suffix you can set in your Shopify admin). It is not available in Customer Event Pixels and is only delivered later through the webhook that fires after each conversion. Because of this, the order number cannot be passed in a conversion-script parameter such as adv1, and it cannot be sent to partners via their partner postback.
Order ID This is a unique, auto-generated internal number used for API purposes (a long string such as 2205783916624), visible in the URL of the order detail page in your Shopify admin. The order ID is collected in the conversion script, so it can be passed in an additional parameter (for example, adv1) and made available to partners.

Tracking Alongside TikTok

If you also run TikTok tracking with the Shopify integration, capture the TikTok click identifier (ttclid) by adding a parameters object to the EF.click() call in your Shopify integration's click script, then store the returned transaction ID back on the cart: