Start Here 👋
If your Shopify store has a subscription model and you want to track first-time purchases only, Cometly provides the flexibility to do this using its Webhooks feature. By default, Cometly tracks every purchase as a "Purchase" event, but you can create a separate "First Time Purchase" event to focus specifically on initial orders.
Step 1: Create a New Event in Cometly
Navigate to the Events Manager in your Cometly dashboard.
Click Add Event to create a new event.
Select Webhooks as the integration option.
On the next step, name the event First Time Purchase.
Once created, Cometly will provide you with a Webhook URL. Copy this URL—you’ll use it in Shopify to send data to Cometly.
Step 2: Set Up the Webhook in Shopify
In your Shopify admin dashboard, go to Settings.
Under Settings, scroll down and click Notifications.
On the Notifications page, locate the Webhooks section and click Create webhook.
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 2025-01 (Latest) for the API version.
Step 3: Map Data to the Cometly Webhook
When your next order is placed (particularly one that is a subscription or first-time purchase), you'll need to map the incoming data in Cometly. If you need help at any point while mapping and filtering data for the Cometly Webhook, please visit our Cometly Webhooks guide.
In Cometly, open the Events Manager and locate the new event (First Time Purchase) under Webhooks.
Use the Check for Data button to see the incoming data from Shopify’s webhook.
Map the following fields to the Cometly webhook:
Email: The customer’s email address.
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.
Important: the comet_token, fingerprint, and ip are a mapping requirement for Shopify to track first time purchases.
Step 4: Add Filters to Identify First-Time Purchases
Filters help ensure that only first-time purchases are recorded under the "First Time Purchase" event. Add the following filters in the Cometly webhook configuration:
Successful Payments:
Use Shopify’s payment status field (e.g.,
data.object.status
) to filter for successful payments. Look for values like paid.
First-Time Orders Only:
Use Shopify’s customer order count field (e.g.,
customer.orders_count
) to filter for first-time orders. Set the condition to:customer.orders_count = 1
This ensures only customers with exactly one order (indicating their first purchase) are included.
Notes
If you’re not seeing data after setting up the webhook, ensure Shopify orders are being sent correctly. Use the Check for Data button in Cometly to confirm incoming payloads.
If your filters are not working as expected, double-check the data fields being sent by Shopify in the webhook payload (e.g., the field names for
status
andcustomer.orders_count
).
Additional Help
For troubleshooting your webhook setup or further questions, please contact support@cometly.com or refer to the Cometly Webhooks Integration Guide.
By following this guide, you’ll be able to effectively track first-time purchases and gain valuable insights into your customer acquisition.