Snap Pixel & Conversions API Implementation | OpsBlu Docs

Snap Pixel & Conversions API Implementation

Technical guide to Snap Pixel (snaptr) installation, Conversions API server-side tracking, Dynamic Ads setup, event deduplication, and app install...

How Snapchat Tracking Works

Snapchat's measurement system uses the Snap Pixel (browser-side) and the Conversions API (server-side). Both feed attribution data into Snapchat Ads Manager for reporting, optimization, and audience building.

Browser-side (Snap Pixel): The pixel loads sc-static.net/scevent.min.js, which initializes a global snaptr function. On initialization, it sets a _scid first-party cookie for user identification. The pixel also reads the ScCid URL parameter (Snap Click ID) appended to landing page URLs from ad clicks. When events fire, the pixel sends requests to tr.snapchat.com containing event data, the _scid cookie, and any user data parameters.

Server-side (Conversions API): The Conversions API (CAPI) accepts event data via HTTPS POST to tr.snapchat.com/v2/conversion. It requires a CAPI token generated in Snap Ads Manager. Server-side events bypass ad blockers and provide coverage for users on restricted browsers.

Deduplication: When running both pixel and CAPI, Snapchat deduplicates events using the client_dedup_id field. If the same client_dedup_id arrives from both sources within the deduplication window, Snapchat keeps one event. Always generate a matching ID and send it through both channels.

Identity resolution: Snapchat matches conversions to ad interactions through the _scid cookie, the ScCid click identifier (from ad click URLs), hashed email, hashed phone, and hashed IP address. The click ID provides the strongest attribution signal.


Installing the Snap Pixel

Add the base pixel code inside <head> on every page:

<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>

Replace YOUR_PIXEL_ID with the pixel ID from Snap Ads Manager > Events Manager.

The user_email parameter in init is optional but recommended. If available at page load, pass the user's email for Advanced Matching. Snapchat auto-hashes it with SHA-256.

Via Google Tag Manager: Use the Snapchat Pixel template from the GTM Community Gallery. Set the pixel ID and fire it on All Pages for the PAGE_VIEW event. Add separate tags for conversion events.


Conversion Tracking

Standard Events

Fire conversion events with snaptr('track'):

// Purchase
snaptr('track', 'PURCHASE', {
  price: 79.99,
  currency: 'USD',
  transaction_id: 'order_12345',
  item_ids: ['SKU-001', 'SKU-002'],
  item_category: 'Apparel',
  number_items: 2,
  client_dedup_id: 'dedup_order_12345_1709510400'
});

// Add to Cart
snaptr('track', 'ADD_CART', {
  price: 39.99,
  currency: 'USD',
  item_ids: ['SKU-001'],
  number_items: 1,
  client_dedup_id: 'dedup_atc_SKU001_1709510400'
});

// View Content
snaptr('track', 'VIEW_CONTENT', {
  item_ids: ['SKU-001'],
  item_category: 'Apparel',
  price: 39.99,
  currency: 'USD'
});

// Sign Up
snaptr('track', 'SIGN_UP');

// Start Checkout
snaptr('track', 'START_CHECKOUT', {
  price: 79.99,
  currency: 'USD',
  number_items: 2
});

// Add Billing Info
snaptr('track', 'ADD_BILLING');

// Search
snaptr('track', 'SEARCH', {
  search_string: 'winter jackets'
});

Full list of standard events: PAGE_VIEW, VIEW_CONTENT, ADD_CART, START_CHECKOUT, ADD_BILLING, PURCHASE, SIGN_UP, SEARCH, ADD_TO_WISHLIST, LEVEL_COMPLETE, TUTORIAL_COMPLETE, INVITE, LOGIN, SHARE, RESERVE, ACHIEVEMENT_UNLOCKED, SPENT_CREDITS, RATE, SAVE, SUBSCRIBE, COMPLETE_TUTORIAL, APP_OPEN, LIST_VIEW.

Custom Events

For events not covered by standard types:

snaptr('track', 'CUSTOM_EVENT_1', {
  description: 'quiz_completed',
  client_dedup_id: 'dedup_quiz_user123_1709510400'
});

Snapchat supports CUSTOM_EVENT_1 through CUSTOM_EVENT_5. These can be used for audience building and custom conversion goals.


Server-Side Conversions API

The Conversions API sends event data from your server for improved tracking reliability.

Authentication

Generate a CAPI token in Snap Ads Manager > Events Manager > Conversions API Tokens. The token is scoped to a specific pixel.

Sending Events

curl -X POST "https://tr.snapchat.com/v2/conversion" \
  -H "Authorization: Bearer YOUR_CAPI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "pixel_id": "YOUR_PIXEL_ID",
    "event_type": "PURCHASE",
    "event_conversion_type": "WEB",
    "timestamp": "1709510400000",
    "hashed_email": "a]c4db8a2e6...",
    "hashed_phone_number": "1a2b3c4d5e...",
    "hashed_ip_address": "f6e8b2c1...",
    "user_agent": "Mozilla/5.0...",
    "click_id": "ScCid_value_from_url",
    "price": "79.99",
    "currency": "USD",
    "transaction_id": "order_12345",
    "item_ids": ["SKU-001", "SKU-002"],
    "number_items": "2",
    "client_dedup_id": "dedup_order_12345_1709510400",
    "page_url": "https://example.com/checkout/confirm"
  }'

Hashing requirements: Email must be lowercase, trimmed, then SHA-256 hashed. Phone numbers must include country code without symbols or spaces, then SHA-256 hashed. IP address must also be SHA-256 hashed for the CAPI (unlike most platforms that accept plaintext IP).

Click ID (ScCid): Snapchat appends a ScCid parameter to landing page URLs from ad clicks. Capture this value on your landing page and pass it to your server for CAPI events. It provides the strongest attribution match.

Deduplication

The client_dedup_id must match between the pixel call and the CAPI request:

// Browser-side: generate dedup ID and pass to both channels
var dedupId = 'dedup_' + orderId + '_' + Date.now();

snaptr('track', 'PURCHASE', {
  price: 79.99,
  currency: 'USD',
  client_dedup_id: dedupId
});

// Send dedupId to your server with the order data for CAPI

Dynamic Ads

Dynamic Ads serve personalized product ads based on catalog data and pixel activity. They require a product catalog and pixel events with matching item_ids.

Catalog setup: Upload a product feed to Snap Ads Manager > Catalogs. Required fields: id, title, description, link, image_link, price, availability.

Required pixel events for Dynamic Ads:

  • VIEW_CONTENT with item_ids matching catalog id values
  • ADD_CART with item_ids
  • PURCHASE with item_ids
// Product page view - item_ids must match catalog feed IDs
snaptr('track', 'VIEW_CONTENT', {
  item_ids: ['SKU-001'],
  price: 39.99,
  currency: 'USD'
});

Snapchat uses these events to build retargeting audiences: users who viewed products but did not purchase, users who added to cart but abandoned, and users who purchased (for cross-sell or exclusion).


Audience Building

Snapchat builds audiences from pixel and CAPI data:

  • Pixel Custom Audiences: Target users who triggered specific events. Lookback window 1-180 days.
  • Customer List Audiences: Upload hashed emails or phone numbers (SHA-256). Minimum 1,000 records.
  • Lookalike Audiences: Expand from a source audience. Available in Small (top 1%), Medium (top 5%), and Large (top 10%) sizes.
  • Snap Audience Match (SAM): Matches your customer data against Snapchat's user base for direct targeting.
  • Engagement Audiences: Target users who interacted with your Snap ads (views, swipe-ups, shares).

Audience rules for retargeting:

  • Viewed products in the last 14 days but did not add to cart
  • Added to cart in the last 7 days but did not purchase
  • Purchased in the last 90 days (for repeat purchase or exclusion)

App Install and Event Tracking

For mobile app campaigns, Snapchat uses a Mobile Measurement Partner (MMP) integration or the Snap App ID.

MMP integration: Connect your MMP (AppsFlyer, Adjust, Branch, Kochava, Singular) in Snap Ads Manager > Events Manager > App Events. The MMP handles attribution and postback events to Snapchat.

Tracked app events:

  • APP_INSTALL - attributed installs
  • APP_OPEN - app sessions
  • PURCHASE - in-app purchases
  • Custom in-app events mapped through the MMP

Deep linking: Snap Ads support deferred deep linking through MMP partners. Users who click an ad, install the app, then open it are routed to the specific content referenced in the ad.


Common Issues

Pixel not firing: Verify the pixel ID in snaptr('init'). Use the Snap Pixel Helper Chrome extension. Ensure sc-static.net is not blocked by consent management tools or ad blockers.

Duplicate conversions: Missing or mismatched client_dedup_id values cause double-counting when using both pixel and CAPI. Generate the dedup ID client-side and send it through both paths.

CAPI returns 401 Unauthorized: The CAPI token may be expired or invalid. Regenerate in Snap Ads Manager. Tokens are scoped per pixel -- using a token from one pixel for a different pixel ID fails.

No conversions in reporting but events appear in Events Manager: Check the attribution window settings. Default is 28-day click / 1-day view. If the conversion happens outside this window, it is tracked but not attributed to the campaign.

ScCid not in landing page URL: Verify that auto-appending is enabled in campaign settings. Check that your landing page URL does not strip query parameters via redirects or server-side URL rewriting.

Dynamic Ads not populating: Ensure item_ids in pixel events exactly match id values in the catalog feed (string matching, case-sensitive). The catalog must be active with approved products.

Low match rates on CAPI: Include as many identifiers as possible: hashed email, hashed phone, hashed IP, user agent, and click_id (ScCid). The click ID provides the strongest match.


Platform-Specific Considerations

Snap Audience Network: Ads can extend beyond Snapchat to third-party apps through the Snap Audience Network. Pixel and CAPI events are attributed the same way. The event_conversion_type should be set to WEB for website events and MOBILE_APP for app events.

Privacy and Restricted Data: Snapchat requires that advertisers in regulated industries (health, finance, alcohol) do not pass restricted data categories through the pixel or CAPI. Review Snapchat's Restricted Data Terms before implementing tracking for these verticals.

Event batching: The CAPI supports sending multiple events in a single request by passing an array of event objects. For high-volume sites, batch events server-side and send within 1 hour of occurrence for accurate attribution.

Testing: Use the Test Events tool in Snap Ads Manager > Events Manager. Fire test events from your development environment and confirm they appear in the dashboard. Test both pixel and CAPI events separately to verify deduplication works correctly.

EU data processing: For users in the EU, configure the pixel consent mode by calling snaptr('init', pixelId) only after consent is obtained. The CAPI should also only fire after valid consent. Snapchat processes EU user data per their Data Processing Agreement.