The Liquid Rewards clickthrough API records when users engage with affiliate product offers and handles the redirect flow through affiliate tracking links. Proper click tracking ensures correct attribution for your loyalty program.
Always record clicks before redirecting the user. If the click is not recorded, your program may not receive affiliate commission for the sale.
Recording a Click
When a user clicks a product, POST to /clickthrough/{convo_id} with the click details. Returns HTTP 202 Accepted on success.
curl -X POST https://rewardsbot-prod.liquidrewardsapi.com/clickthrough/SESSION_ID \
-H "Content-Type: application/json" \
-d '{
"program": "my-loyalty-program",
"email": "user@example.com",
"convo_id": "SESSION_ID",
"presentation_id": "pres-001",
"click_id": "click-abc123",
"click_datetime": "2024-01-15T10:30:00Z"
}'
Request Fields
Your loyalty program identifier.
The user’s email address.
The conversation/session ID. Must match the {convo_id} path parameter.
The offer presentment ID that was shown to the user.
A unique identifier for this click event. Generate a new value for every click.
ISO 8601 timestamp of when the click occurred (e.g., "2024-01-15T10:30:00Z").
Clickthrough Redirect
For redirect-based affiliate tracking, use GET /clickthrough/{convo_id}/{presentment_id}. The API records the click and issues a redirect to the affiliate tracking URL.
curl "https://rewardsbot-prod.liquidrewardsapi.com/clickthrough/SESSION_ID/PRESENTMENT_ID?email=user@example.com&program=my-loyalty-program&click_id=click-abc123&click_datetime=2024-01-15T10%3A30%3A00Z"
Query Parameters
The user’s email address.
Your loyalty program identifier.
A unique identifier for this click event.
ISO 8601 timestamp of the click (URL-encoded). Example: 2024-01-15T10%3A30%3A00Z.
Generating Click IDs
Generate a unique click_id and capture the current timestamp for each click event:
const clickId = `click-${Date.now()}-${Math.random().toString(36).slice(2)}`;
const clickDatetime = new Date().toISOString();
Click Tracking Flow
The typical end-to-end flow for recording and handling a product click:
User sees a product offer
Your UI renders a product card or carousel item from the ShopperReply or offers API. Each product has a presentation_id and a direct_link (affiliate URL).
User clicks the product
Intercept the click event in your frontend before navigating away.productCard.addEventListener('click', async (event) => {
event.preventDefault(); // Hold navigation until click is recorded
await recordClick(product);
window.location.href = product.direct_link;
});
Record the click
POST to /clickthrough/{convo_id} with all required attribution fields.async function recordClick(product) {
const clickId = `click-${Date.now()}-${Math.random().toString(36).slice(2)}`;
const clickDatetime = new Date().toISOString();
await fetch(`https://rewardsbot-prod.liquidrewardsapi.com/clickthrough/${convoId}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
program: 'my-loyalty-program',
email: currentUser.email,
convo_id: convoId,
presentation_id: product.presentment_id,
click_id: clickId,
click_datetime: clickDatetime
})
});
}
Redirect the user
After the click is successfully recorded (HTTP 202), redirect the user to the affiliate direct_link from the product info. The affiliate link handles tracking on the merchant’s side.window.location.href = product.direct_link;