Integrating Popin Sales Tracking on Shopify

Integrating Popin Sales Tracking on Shopify

To ensure seamless sales tracking with Popin, please follow the steps below to integrate the new Popin sales tracking pixel into your Shopify store.

Steps to Integrate Popin Sales Tracking

Step 1: Access Your Shopify Admin Panel

  1. Log in to your Shopify account.
  2. From the Shopify admin dashboard, navigate to the Settings section located at the bottom-left corner of the page.

Step 2: Navigate to Customer Events

  1. In the Settings menu, find and select Customer Events from the list.

Step 3: Add the Custom Pixel

  1. Click on the Add Custom Pixel button.
  2. In the dialog box that appears, enter the following details:
    • Name: popin_saletrack
    • Code: Copy and paste the following script, ensuring to replace YOUR_SELLER_ID with your unique seller ID from your Popin dashboard:

  1. const popinSalesTracker = async ({ sellerId, orderId, amount }) => { 
  2.     var popinDomain = "https://widget01.popin.to";
  3.     var popinUserData = await localStorage.getItem("popinUserData");
  4.     if (popinUserData) {
  5.         popinUserData = JSON.parse(popinUserData);
  6.         fetch(popinDomain + "/api/v1/user/sale", {
  7.             method: "POST",
  8.             headers: {
  9.                 "Content-Type": "application/json",
  10.                 Authorization: `Bearer ${popinUserData.popInToken}`,
  11.             },
  12.             body: JSON.stringify({
  13.                 seller_id: sellerId,
  14.                 order_id: orderId,
  15.                 amount: amount,
  16.             }),
  17.         });
  18.     }
  19. };

  20. analytics.subscribe("checkout_completed", (event) => {
  21.     popinSalesTracker({
  22.         sellerId: YOUR_SELLER_ID, // Replace with your seller ID
  23.         orderId: event.data?.checkout?.order?.id,
  24.         amount: event.data?.checkout?.totalPrice?.amount
  25.     });
  26. });

Step 4: Save Your Changes

  1. Once you've entered the name and code, click the Save button to activate the new pixel.

Step 5: Verify Integration

  1. After saving, it’s important to verify that the Popin sales tracking is functioning correctly. You can do this by making a test purchase and checking if the tracking data is recorded properly in your Popin dashboard.