Skip to main content

Installing Conversion Tracking on a Headless Shopify Store

Follow these steps to enable SocialLadder’s link-based sales attribution in a headless Shopify implementation.

Marshall avatar
Written by Marshall
Updated this week

Important Notes:

  • You must first follow the instructions in this article to configure the SocialLadder App in Shopify if it hasn’t already been set up.

  • The SocialLadder Tracking Pixel enables our platform to receive information necessary to provide credit to ambassadors for the sales they’ve driven.

1. How It Works

When an ambassador shares a link through SocialLadder, it’s a shortened link that redirects to your eCommerce site.
That link contains special URL parameters. The SocialLadder tracking script reads these parameters and stores them in a browser cookie named:

sl-track-purchase

Your store should capture the cookie value and attach it to the order using Shopify’s note_attributes field.
When SocialLadder syncs your Shopify orders, it will read this note attribute, match it to the correct ambassador, and attribute the sale.

2. Install the SocialLadder Tracking Script

The following code needs to be installed on the home page or any landing page that an ambassador link can be directed to:

<script src="https://socialladder.rkiapps.com/ecom/socialladder-ecom.js" type="text/javascript">
</script>

3. Capture the Tracking Cookie

Add a helper function to your JavaScript to read the cookie value such as below:


JavaScript Example:

function getSocialLadderCookie() {
const name = 'sl-track-purchase=';
const cookies = decodeURIComponent(document.cookie).split(';');
for (let c of cookies) {
c = c.trim();
if (c.startsWith(name)) {
return c.substring(name.length);
}
}
return null;
}

4. Attach the Cookie to note_attributes

When creating your checkout or order (via Storefront API or your backend), attach the cookie value to Shopify’s note_attributes using the key:

This key must have this exact value:

social_ladder.tracking_cookie

JavaScript Example:

const trackingCookie = getSocialLadderCookie();
if (trackingCookie) {
const noteAttributes = [
{
name: "social_ladder.tracking_cookie",
value: trackingCookie
}
];

const checkoutPayload = {
lineItems: [...],
noteAttributes: noteAttributes
};

// Send checkoutPayload to Shopify's checkout/cart API
}

JSON Example:

"note_attributes": [
{
"name": "social_ladder.tracking_cookie",
"value": "TRACKING_COOKIE_VALUE"
}
]

You can attach this at the cart, checkout, or order level depending on your custom flow.

5. Verify It’s Working

  1. Place a test order using an ambassador link.

  2. In Shopify Admin, open the order.

  3. Scroll to Additional Details and confirm that social_ladder.tracking_cookie appears with a valid value.

  4. Once confirmed, SocialLadder will attribute orders using this value when syncing orders from Shopify.

Tips & Best Practices

  • Ensure the cookie script loads on all pages an ambassador link may land.

  • If using custom checkout flows, validate that the note_attributes are properly passed.

Related Articles

Did this answer your question?