agentleFS
itsryanarmaniitsryanarmani/skills/ads-snapchat/SKILL.md

ads-snapchat

Skill1 starsChanged 4 days agoMITView on GitHub

Use when creating a Snapchat Ads account, installing Snap Pixel, sending web conversions through Snapchat Conversions API v3, pairing Pixel and CAPI events, preserving ScCid, or debugging consent, attribution windows, event age, and Events Manager verification.

  • Sends data out

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 8 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Use one Pixel ID for the browser Pixel and web CAPI.

    line 9
  2. Distinctive:

    Create a Snapchat account, business account, and Public Profile.

    line 14
  3. Distinctive:

    Create the ad account and add a payment method before launch.

    line 16
  4. Distinctive:

    Create the Pixel in Ads Manager.

    line 21
  5. Distinctive:

    Use these adapter names. Snap does not define process environment variable names:

    line 27
  6. Distinctive:

    Do not pass raw email to the Pixel.

    line 76
  7. Very specific:

    Use uppercase Snap event names.

    line 136
  8. Very specific:

    Do not silently map lead or refund to one.

    line 152
  9. Very specific:

    If the Pixel creates its own ID, it cannot match a server event.

    line 164
  10. Very specific:

    UNVERIFIED: do not claim a vendor storage lifetime.

    line 174
  11. Distinctive:

    Do not treat an immediate Ads Manager count as final.

    line 196
  12. Distinctive:

    Use Snap's server-side validation endpoints before production dispatch:

    line 202
  13. Very specific:

    Keep SNAPCHAT_ADS_CAPI_TOKEN in the deployment secret store.

    line 237

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Snapchat Ads

Snapchat supports self-serve Ads Manager accounts and a public web Conversions API. Use one Pixel ID for the browser Pixel and web CAPI. Use the hub for consent, normalization, dispatch, retries, and payment reconciliation.

Account and API access

  1. Open Snap Ads Manager and select Sign Up.
  2. Create a Snapchat account, business account, and Public Profile.
  3. Enter the business country, currency, phone number, and website.
  4. Create the ad account and add a payment method before launch. Snap's business setup guide documents this self-serve path. Sign-up is country-limited. Check Snap's current eligible-country list. Ads require a Public Profile. Create the Pixel in Ads Manager. It belongs to an ad account and has a UUID. See the Snap Pixel reference. Conversions API access needs a Business Manager. An Organization Admin opens Ads Manager → Business Details → Conversions API Tokens and generates a static, long-lived token. It does not expire and only works with assets in that organization. Snap also supports partner integrations. See CAPI access requirements. Use these adapter names. Snap does not define process environment variable names:
SNAPCHAT_ADS_PIXEL_ID   public Pixel UUID; safe in the browser
SNAPCHAT_ADS_CAPI_TOKEN server-only long-lived CAPI token

Client-side Snap Pixel

Load the official asynchronous script once in the document head on every page. The official installation example loads https://sc-static.net/scevent.min.js, initializes the Pixel ID, and tracks PAGE_VIEW. A current Snap installation guide also places the script in the head on all pages.

<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';
  var r = t.createElement(s);
  r.async = true;
  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', '<SNAPCHAT_ADS_PIXEL_ID>');
snaptr('track', 'PAGE_VIEW');
</script>

Send a canonical event ID as client_dedup_id when the browser and server both send the event. For a purchase, also send the same order reference as transaction_id:

snaptr('track', 'PURCHASE', {
  client_dedup_id: event.event_id,
  transaction_id: event.order_id,
  price: event.value,
  currency: event.currency,
});

Do not pass raw email to the Pixel. Apply consent and Snap's hashing rules to any user data. The Pixel FAQ says Snap accepts SHA-256 hashed user data.

Server-side Conversions API v3

Send web events to:

POST https://tr.snapchat.com/v3/{PIXEL_ID}/events?access_token={TOKEN}
Content-Type: application/json

The CAPI request guide requires event_name, event_time, action_source, and event_source_url for web events. It requires at least one matching signal: hashed em, hashed ph, or both client_ip_address and client_user_agent. A PURCHASE also requires value and currency in custom_data.

{
  "data": [{
    "event_name": "PURCHASE",
    "event_time": "<epoch_seconds>",
    "event_source_url": "https://example.com/checkout/complete",
    "action_source": "WEB",
    "event_id": "payment_evt_123",
    "user_data": {
      "em": ["<sha256(trim(email).toLowerCase())>"],
      "ph": ["<sha256(country-code digits)>"],
      "client_ip_address": "<request IP>",
      "client_user_agent": "<request user-agent>",
      "sc_click_id": "<ScCid value>",
      "sc_cookie1": "<_scid value>"
    },
    "custom_data": {
      "value": 49.99,
      "currency": "USD",
      "order_id": "order_123"
    }
  }]
}

Snap's parameter reference defines the identity rules:

  • em: trim, lowercase, then SHA-256 hash as UTF-8.
  • ph: include the country code, remove +, spaces, punctuation, and the national leading zero, then SHA-256 hash.
  • client_ip_address, client_user_agent, sc_click_id, and sc_cookie1 are not hashed.
  • external_id is a stable first-party ID. Hashing is recommended.

Apply the ad-conversion-hub consent gate before hashing or dispatch. Do not require ScCid before sending a purchase. Organic, direct, email, and SEO purchases still need measurement.

Canonical event mapping

Use uppercase Snap event names. The supported names include PURCHASE, START_CHECKOUT, VIEW_CONTENT, SIGN_UP, PAGE_VIEW, SUBSCRIBE, and five custom events. See the official event list.

Hub eventSnap eventAdapter note
page_viewPAGE_VIEWSend the full page URL.
view_contentVIEW_CONTENTPut product IDs in content_ids.
leadUNMAPPEDSnap lists no native LEAD event. Do not invent one.
signupSIGN_UPKeep the same ID in client_dedup_id and event_id.
begin_checkoutSTART_CHECKOUTUse checkout_id as the event ID when stable.
purchasePURCHASESend value, currency, and order_id.
subscription_startSUBSCRIBESend subscription_id without hashing.
refundUNMAPPEDSnap lists no native REFUND event. Do not invent one.

Snap supports CUSTOM_EVENT_1 through CUSTOM_EVENT_5, but assigns them no meanings. Do not silently map lead or refund to one.

Deduplication

For web, Snap matches the Pixel's client_dedup_id with CAPI's top-level event_id. Use the same opaque value, Pixel ID, and event name on both sides. The deduplication guide says the normal cross-channel window is 48 hours.

For PURCHASE, send the order reference too. The Pixel field is transaction_id. CAPI v3 calls the same value custom_data.order_id. Snap documents this as a fallback deduplication signal with a window of up to 30 days.

If the Pixel creates its own ID, it cannot match a server event. Set client_dedup_id yourself when shipping both sources.

Click ID and cookies

Snap appends ScCid to an ad destination URL. Send it as user_data.sc_click_id, or send the full URL in event_source_url and let CAPI extract it. The CAPI click-ID guide says to persist it for all later events in that session.

Snap does not state a browser-cookie TTL for ScCid in the current CAPI docs. UNVERIFIED: do not claim a vendor storage lifetime. Store first-touch and most-recent values in first-party storage under the product's retention policy. Pass the Pixel's _scid cookie as sc_cookie1 when available.

The Ads API measurement reference supports swipe-up attribution windows of 1, 7, or 28 days, and view windows of 1 hour, 3 hours, 6 hours, 1 day, or 7 days. These are attribution windows, not a browser storage TTL.

Tracking quirks that cause failures

  • Current v3 parameters say event_time cannot be more than 7 days old. Send the actual conversion time in epoch seconds or milliseconds. Send events promptly.
  • Web CAPI needs event_source_url, even when the event came from a webhook.
  • A request can be syntactically valid but fail matching without em, ph, or the IP-plus-user-agent pair. Keep these fields when consent allows them.
  • For web opt-out handling, Snap documents data_processing_options: ["LMU"]. Older examples use data_use: ["lmu"]; follow the current parameter reference.
  • A CAPI token and Pixel from different organizations fail authorization. Generate the token in the same Business Manager that owns the Pixel.
  • CAPI batches support up to 2,000 events. Apply the hub's bounded retry policy.
  • Snap's deduplication diagnostics can take up to 24 hours to update after a fix. Do not treat an immediate Ads Manager count as final.
  • App events use snap_app_id, not pixel_id. App events also need app_data.extinfo and advertiser_tracking_enabled for iOS ATT status.

Verification

Use Snap's server-side validation endpoints before production dispatch:

curl -sS -X POST \
  "https://tr.snapchat.com/v3/$SNAPCHAT_ADS_PIXEL_ID/events/validate?access_token=$SNAPCHAT_ADS_CAPI_TOKEN" \
  -H 'Content-Type: application/json' \
  --data @snap-test-event.json

curl -sS \
  "https://tr.snapchat.com/v3/$SNAPCHAT_ADS_PIXEL_ID/events/validate/logs?access_token=$SNAPCHAT_ADS_CAPI_TOKEN"

curl -sS \
  "https://tr.snapchat.com/v3/$SNAPCHAT_ADS_PIXEL_ID/events/validate/stats?access_token=$SNAPCHAT_ADS_CAPI_TOKEN"

The Verify Setup guide defines POST /events/validate as a near-real-time test. A valid response proves Snap accepted the test payload. The logs show event status and errors. The stats response shows the test event count in the past hour. Then confirm the event and deduplication signals in Events Manager Diagnostics, and reconcile production PURCHASE events with payment-provider succeeded charges.

Common pitfalls

  • Using the old v2 endpoint. Use CAPI v3 at tr.snapchat.com/v3/....
  • Sending transaction_id in CAPI v3 instead of custom_data.order_id.
  • Generating a different server ID instead of reusing the browser ID.
  • Sending raw email or phone values.
  • Treating ScCid as required for every conversion.
  • Sending the wrong time unit, or sending events older than the v3 limit.
  • Assuming a VALID HTTP response is reporting proof. Check test logs and Diagnostics.
  • Creating a Pixel in one organization and a token in another.
  • Mapping lead or refund to an invented native event name.

Security

Keep SNAPCHAT_ADS_CAPI_TOKEN in the deployment secret store. Never expose it to the browser, commit it, log it, or put it in client URLs. Redact access tokens. Send only consent-approved identifiers. Hash user identity fields as Snap requires. Load the Pixel only from Snap's official HTTPS origin. Do not log click IDs or PII.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.