Sales Tracking on Shopify
Integrating Popin Sales Tracking on Shopify
This guide explains how to integrate Popin’s sales tracking pixel into your Shopify store using Shopify’s Customer Events feature. This integration allows you to track successful checkout events and link them to Popin user sessions for accurate sales attribution.
🧭 On This Page
Steps to Integrate Popin Sales Tracking
Code Snippet
Verification
🛠️ Steps to Integrate Popin Sales Tracking
Step 1: Access Your Shopify Admin Panel
Log in to your Shopify account.
From the admin dashboard, go to the Settings section (bottom-left corner).
Step 2: Navigate to Customer Events
In the Settings menu, scroll and select Customer Events.
This section allows you to configure custom event tracking on checkout and other key moments.
Step 3: Add the Custom Pixel
Click the Add Custom Pixel button.
In the dialog that opens:
Name:
popin_saletrack
Code: Copy and paste the JavaScript snippet provided below.
🔁 Important: Replace
YOUR_SELLER_ID
in the code with your actual seller ID, available in your Popin dashboard.
📄 Code Snippet
const popinSalesTracker = async ({ sellerId, orderId, amount }) => {
var popinDomain = "https://widget01.popin.to";
var popinUserData = await localStorage.getItem("popinUserData");
if (popinUserData) {
popinUserData = JSON.parse(popinUserData);
fetch(`${popinDomain}/api/v1/user/sale`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${popinUserData.popInToken}`,
},
body: JSON.stringify({
seller_id: sellerId,
order_id: orderId,
amount: amount,
}),
});
}
};
analytics.subscribe("checkout_completed", (event) => {
popinSalesTracker({
sellerId: YOUR_SELLER_ID, // Replace with your actual seller ID
orderId: event.data?.checkout?.order?.id,
amount: event.data?.checkout?.totalPrice?.amount
});
});
Step 4: Save Your Changes
Once you’ve entered the pixel name and pasted the code:
Click Save to activate the Popin sales tracking pixel.
The pixel will now listen for completed checkouts and send sale data to Popin in real-time.
Step 5: Verify Integration
To ensure successful setup:
Make a test purchase on your store.
Go to your Popin Dashboard > Sales Tracking.
Confirm the test order appears with the correct details (order ID, amount, etc.).
📞 Need Help?
If you encounter any issues during the integration:
Ensure the seller ID is correctly replaced in the script.
Verify that
popinUserData
is available in localStorage during checkout.Contact Popin Support for troubleshooting and assistance.
Last updated