Our default link tracking mechanism relies on a script provided by SocialLadder that drops a cookie on the purchaser’s browser. This cookie identifies the user and the sale initiated when they first click a referral link. On the checkout page, our script retrieves that information and links the sale to the ambassador who shared the link.
If you prefer to implement link tracking through direct API calls instead of using our script, you'll need to follow this flow:
Read the ambassadorID from the referral link and store the identifier
Call a SocialLadder endpoint to exchange the ambassador ID for a referral tracking ID
Store the referral tracking information on your end
On purchase completion, call SocialLadder’s track endpoint with the tracking ID and purchase details
Here are the steps you'll need to follow to retrieve a referral tracking ID:
Step 1: Extract the Ambassador ID from Your Referral Link
When a user clicks a referral link, extract the ambassadorID parameter from the URL. This value connects the purchase back to the referrer.
Example referral link: https://yoursite.com?ambassadorID=abc123xyz
Step 2: Call the ProcessInviteToBuy Endpoint
Make a GET request to exchange the ambassador ID for an InviteToBuyGUID:
Step 3: Parse the Response
The endpoint returns a JSON response with the following properties:
{
"InviteToBuyGUID": "550e8400-e29b-41d4-a716-446655440000",
"PixelTrackCode": "track123",
"DiscountCode": "REFER10",
"cookieExpireMins": 1440,
"Result": 1
}
Response Fields
Parameter | Description |
InviteToBuyGUID | Unique identifier for this referral session (required for tracking the purchase). If you're using our POST /api/v2/conversion endpoint to submit sales, this field should be sent as the conversionCookieGUID. |
PixelTrackCode | Equivalent to the shopCode used in other endpoints. It identifies the conversion campaign the sale belongs to. You can learn how to retrieve and use it in the articles covering sale submission. |
DiscountCode | Promotional code associated with the ambassador who shared the referral link. |
cookieExpireMins | Session duration (in minutes) when using SocialLadder cookies. If you're implementing API-based tracking as described here, your tracking ID will not expire. |
Result | 1 indicates success; any other value indicates an error |
Step 4: Track the Purchase Completion
With the InviteToBuyGUID, you can now call the tracking APIs outlined in the Conversion API documentation you have access to.
