> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cometly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Track first-time purchases in Shopify

> Track first-time purchases in Shopify with a Cometly webhook event, so you can see which ads bring in new customers and not only repeat orders.

If your Shopify store has a subscription model, you can track first-time purchases in Shopify separately from repeat orders with Cometly **Webhooks**. A webhook is a message Shopify sends to Cometly each time an order is created. By default, Cometly tracks every purchase as a "Purchase" event (an event is an action Cometly tracks, such as a lead or a purchase). With this guide you create a separate "First Time Purchase" event that only records initial orders.

This matters because renewals and repeat orders can hide where your new customers come from. With first orders in their own event, you can see which campaign, ad set and ad produced each new customer.

## Before you start

* Set up Shopify tracking as described in [Shopify](https://docs.cometly.com/integrations/platforms/shopify.md), including the Cometly pixel (the tracking script on your store).
* If you need help with mapping or filters at any point, see the [Cometly webhooks guide](https://docs.cometly.com/integrations/webhooks.md).

## Step 1: Create a new event in Cometly

1. In Cometly, go to **Events Manager**.
2. Click **Create Event**.
3. Under **App / Integration**, select **Webhooks**.
4. For the event name, choose **Create New Event** and name the event **First Time Purchase**. Click **Create**.
5. Cometly shows **Your webhook URL**. Click **Copy**. You use this URL in Shopify to send data to Cometly.

## Step 2: Set up the webhook in Shopify

1. In your Shopify admin, go to **Settings**.

2. Under Settings, scroll down and click **Notifications**.

3. On the Notifications page, find the **Webhooks** section and click **Create webhook**.

4. Configure the webhook with the following settings:

   * **Event:** choose **Order Creation**.
   * **Webhook URL:** paste the Cometly webhook URL you copied earlier.
   * **Webhook API version:** select the version marked **(Latest)**. When this guide was written, that was **2025-01 (Latest)**.

## Step 3: Map the data in Cometly

When your next order is placed (in particular a subscription or first-time purchase), map the incoming data in Cometly.

1. In Cometly, open **Events Manager**, find the new **First Time Purchase** event and click **Configure**.

2. Click **Check for Data** to see the incoming data from Shopify's webhook, select a record and click **Continue With Selected Record**.

3. Map the following Cometly fields, then click **Save & Continue**:

   * **Email**: the customer's email address.
   * **Event Time**: when the event happened. The mapping step requires it, together with Email.
   * **First Name**: the customer's first name.
   * **Last Name**: the customer's last name.
   * **Comet Token**: a unique token for tracking the customer's session.
   * **Fingerprint**: a unique identifier for the customer.
   * **IP**: the IP address of the customer.

> [!WARNING]
>
> The Comet Token, Fingerprint and IP mappings are required for Shopify to track first-time purchases.

## Step 4: Add filters to identify first-time purchases

Filters make sure that only first-time purchases are recorded under the "First Time Purchase" event. On the **Filtering** step, add the following filters, then click **Activate**:

1. **Successful payments**

   Use Shopify's payment status field (for example `data.object.status`) to filter for successful payments. Look for values like **paid**.

2. **First-time orders only**

   Use Shopify's customer order count field (for example `customer.orders_count`) to filter for first-time orders. Set the condition to `customer.orders_count = 1`. This includes only customers with exactly one order, which indicates their first purchase.

![Filtering step of a webhook event with the filters email is not empty, financial\_status is paid and customer.orders\_count is equal to 1, each showing PASS against the test record, above the Activate button](https://mintcdn.com/cometly/4NU5YV9iL1PADmGE/images/integrations/guides/shopify-first-time-purchases/01.webp?fit=max\&auto=format\&n=4NU5YV9iL1PADmGE\&q=85\&s=6f8428146efb64e005e41aa9d6e477af)

## Check it worked

In **Events Manager**, the **First Time Purchase** event shows a switch that is turned on in the **Status** column. After a new customer places their first order, open the **Events Log** tab: the event appears there within 60 seconds, with **SUCCESS** in the **Details** column.

## Troubleshoot Shopify first-time purchase tracking

* If you don't see data after setting up the webhook, make sure Shopify is sending orders correctly. Use the **Check for Data** button in Cometly to confirm incoming payloads.
* If your filters do not work as expected, double-check the data fields that Shopify sends in the webhook payload (for example the field names for `status` and `customer.orders_count`).

## Frequently asked questions

### Why are the Comet Token and Fingerprint empty in my Shopify webhook data?

Shopify only includes these values when the Cometly pixel was installed on your store at the time the customer placed the order. Install the pixel as described in [Shopify](https://docs.cometly.com/integrations/platforms/shopify.md), then use an order placed after that as your sample record.

### Why is my Shopify test order not showing as a First Time Purchase in Cometly?

Test data sent before the webhook was activated is not processed and does not appear in your reports. Finish the **Filtering** step, click **Activate**, then place a new first order to test.

### How long does it take for a first-time purchase to show up in Cometly?

The event shows in the Events Log within 60 seconds of being sent. It can take up to 15 minutes to appear in the reporting areas, such as the Report Builder or Ads Manager.

## Next steps

* [Learn how webhook mapping, filters and activation work](https://docs.cometly.com/integrations/webhooks.md)
* [Set up the Shopify integration for all paid orders](https://docs.cometly.com/integrations/platforms/shopify.md)
* [Use the Events Log to check incoming events](https://docs.cometly.com/support/troubleshooting/general/event-log.md)
* [Manage custom events](https://docs.cometly.com/guides/events/custom-events.md)

Still have questions or need a hand? We're happy to help. Reach our team at [support@cometly.com](mailto:support@cometly.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.