Overview
When a visitor clicks a Snapchat ad and lands on your site, Snapchat appends sclid to the URL. Affclix captures this alongside utk_click_id so conversions are correctly attributed to both your affiliate and your Snapchat campaign.
- sclid auto-capture — stored in cookie + localStorage on landing automatically
- Snap Pixel (browser-side) — fires PURCHASE from the thank-you page
- Conversions API (server-side) — sends events from your server, bypassing ad blockers and iOS restrictions
- Advanced Matching — hashed PII for improved match rates on Snapchat's young, mobile-first audience
sclid Capture
Affclix captures sclid automatically after init(). The value is stored in a first-party cookie and in localStorage as a fallback.
AffclixSDK.init({
trackingDomain: 't.yourdomain.com',
cookieDomain: '.yourdomain.com'
});
// Read captured sclid at any time
var sclid = AffclixSDK.getAttribution().sclid;
console.log(sclid); // e.g. "CM7jLqAB..." Snapchat's default attribution window is 1 day for swipe-up clicks and 1 day for views. Set cookieTTL to 1 in AffclixSDK.init() if you want to match Snapchat's default window exactly.
Pixel Setup
Load the Snap Pixel base code on all pages. Fire purchase events only on the order confirmation page via the Affclix SDK.
Add base pixel to all pages
Place the Snap Pixel base code inside <head> on every page. Do not fire events in the base code.
Load Affclix SDK
AffclixSDK.init() captures sclid and UTM params on each page load.
Fire PURCHASE on thank-you page
Use AffclixSDK.adPlatforms.snapchat.sendConversionEvent() on the order confirmation page only.
<!-- Snap Pixel base code -->
<script type='text/javascript'>
(function(e,t,n){if(e.snaptr)return;var a=e.snaptr=function(){
a.handleRequest?a.handleRequest.apply(a,arguments):a.queue.push(arguments)};
a.queue=[];var s='script';r=t.createElement(s);r.async=!0;
r.src=n;var u=t.getElementsByTagName(s)[0];
u.parentNode.insertBefore(r,u);})(window,document,
'https://sc-static.net/scevent.min.js');
snaptr('init', 'YOUR_PIXEL_ID', {
'user_email': '__INSERT_USER_EMAIL__'
});
snaptr('track', 'PAGE_VIEW');
</script>
<!-- Affclix SDK -->
<script src="https://assets.affclix.com/sdk/v3/affclix-sdk.min.js"></script>
<script>
AffclixSDK.init({
trackingDomain: 't.yourdomain.com',
cookieDomain: '.yourdomain.com'
});
</script> Send Conversion
Call sendConversionEvent() on the order confirmation page. It fires both the Snap Pixel event and the Affclix postback.
// The Pixel ID comes from your snaptr base code — no need to repeat it.
AffclixSDK.adPlatforms.snapchat.sendConversionEvent('PURCHASE', {
price: 99.00,
currency: 'USD',
transaction_id: 'ORDER-1001',
item_ids: ['SKU-42', 'SKU-99'],
item_category: 'apparel'
}); | Parameter | Type | Required | Description |
|---|---|---|---|
eventName (1st argument) | string | Yes | Standard event: PURCHASE, ADD_CART, START_CHECKOUT, SIGN_UP |
price | number | Yes | Conversion value |
currency | string | Yes | ISO 4217 currency code |
transaction_id | string | No | Used as client_dedup_id for Pixel + CAPI deduplication |
item_ids | string[] | No | Product IDs in the order |
item_category | string | No | Product category for catalog-based retargeting |
Conversions API (CAPI)
Snapchat's Conversions API sends events server-to-server, bypassing iOS App Tracking Transparency restrictions and ad blockers. It is especially important for Snapchat given its predominantly mobile and iOS audience.
A large proportion of Snapchat users are on iOS. Browser-side Pixel alone misses many conversions due to ATT opt-outs. Running CAPI in parallel is strongly recommended for Snapchat advertisers.
// 1. Configure a serverSideEndpoint at init — the SDK then POSTs the
// Snapchat payload to YOUR server instead of calling snaptr directly:
AffclixSDK.init({
trackingDomain: 't.yourdomain.com',
serverSideEndpoint: 'https://api.yourdomain.com/capi/forward'
});
AffclixSDK.adPlatforms.snapchat.sendConversionEvent('PURCHASE', {
price: 99.00, currency: 'USD', transaction_id: '{ORDER_ID}'
});
// 2. Your endpoint receives this payload — forward it to the Snap
// Conversions API (tr.snapchat.com) with your CAPI token:
{
"platform": "snapchat",
"event_type": "PURCHASE",
"timestamp": 1784548800,
"snap_click_id": "{sclid}",
"page_url": "https://yourstore.com/thank-you",
"price": "99.00",
"currency": "USD",
"transaction_id": "{ORDER_ID}",
"item_ids": []
} Advanced Matching
Pass hashed customer data to improve Snapchat's match rate between ad clicks and conversions. Particularly effective on Snapchat where users are often logged in with a verified account.
// Advanced matching goes through the Snap Pixel base code —
// snaptr normalises and hashes these values before transmission.
snaptr('init', 'YOUR_PIXEL_ID', {
user_email: 'customer@example.com',
user_phone_number: '+919876543210'
});
AffclixSDK.adPlatforms.snapchat.sendConversionEvent('PURCHASE', {
price: 99.00,
currency: 'USD',
transaction_id: 'ORDER-1001'
}); All PII fields are SHA-256 hashed by the SDK before transmission. Raw values are never sent to Affclix or Snapchat servers in plain text. Date of birth is formatted as YYYYMMDD before hashing.
Deduplication
Snapchat uses client_dedup_id to deduplicate events received from both the browser Pixel and the Conversions API. Always pass orderId as the client_dedup_id in both calls.
| Signal | Pixel (browser) | CAPI (server) |
|---|---|---|
| client_dedup_id | orderId | orderId (must match) |
| event_name | PURCHASE | PURCHASE |
| sclid | read from cookie | passed in payload |
| user data | hashed via setUserData() | hashed in server payload |
Snapchat deduplicates events with the same client_dedup_id received within 5 minutes of each other. Events received outside this window may both be counted, so always fire Pixel and CAPI as close together as possible.
Testing
Use Snap Ads Manager → Events Manager → Pixel → Test Events to verify your Pixel and CAPI are firing correctly.
AffclixSDK.init({
trackingDomain: 't.yourdomain.com',
testMode: true,
debug: true
}); Install the Snap Pixel Helper Chrome extension to verify pixel fires in real time directly from your browser. It shows event names, parameters, and any errors for each Snap Pixel call on the page.