To monitor your Shopify sales on Tracknow, an integration is required.
By embedding the pixel image code, every completed purchase will be automatically sent with the relevant sales data to Tracknow, allowing you to track conversions directly on your dashboard.
Locating where the code is added on Shopify
- Log into your Shopify account and click ‘Settings’ on the left menu at the bottom
- On the newly opened menu, click ‘Customer events’
- Click ‘Add custom pixel’
- Give the pixel a name (suggested: “Tracknow”) and click ‘Add pixel’
- Here is where you’ll enter the code and then click ‘Connect’
Find your campaign’s Conversion Tracking URL on Tracknow
- Login as an admin to the Tracknow platform and click ‘Campaigns/Offers’ on the left menu
- Click on the name of the campaign you wish these purchases to be associated with
- Scroll down to the ‘Conversion Tracking Setup’ section on the campaign page and click on ‘IMAGE’
- Copy only the part of the link that is highlighted in the screenshot below
Adding the code
Whenever a purchase is made we would like to send the following details:
- Send the Shopify order ID
- Send the order’s amount
- Associate the purchase with campaign ID = 1 (the campaign ID may be different in your case, depending on which campaign on Tracknow you’d like the conversions to be added under)
We’ve prepared a simple template for you to use:
analytics.subscribe('checkout_completed', (event) => { // Wait for the 'completed' event
const campaign_id = 1; //Setting the campaign ID to 1 since that is the ID on Tracknow
const checkout = event.data.checkout; //Extracting order details
const order_id = checkout.order.id; //Getting the order's ID
const checkoutTotalPrice = checkout.totalPrice.amount; //Getting the order's amount
//Creating the URL
const url = `https://example.tracknow.info/success.jpg?campaign_id=${encodeURIComponent(campaign_id)}&order_id=${encodeURIComponent(order_id)}&amount=${encodeURIComponent(checkoutTotalPrice)}`;
fetch(url, {
method: 'GET',
mode: 'no-cors',
keepalive: true,
});
});
Copy and paste the code into the ‘Codes’ section in Shopify and click ‘Save’ to make the ‘Connect’ button available.
Lastly, connect the pixel.