Festive price drop Growth $149$129/月 · Scale $299$249/月 | 截止日期 16 12月 低至 $129/月 查看价格
Tutorial

S2S Tracking: The Definitive Setup Guide for 2026

Dev Team

Dev Team

AffClix Engineering

22 min read

Server-to-server tracking is the most reliable, fraud-resistant, and privacy-compliant way to track affiliate conversions. Unlike pixel tracking it does not depend on a browser executing JavaScript — which means it works when ad blockers are active, ITP blocks cookies, or users have JavaScript disabled. This guide walks you through a complete implementation.

How S2S Tracking Works

S2S tracking replaces the browser as the intermediary in conversion reporting. Instead of a pixel firing in the user's browser, the advertiser's server sends an HTTP request directly to AffClix's postback endpoint when a conversion occurs. The user's browser is never involved in the attribution signal.

S2S Tracking Flow

1

User clicks affiliate link → AffClix generates unique click_id

2

AffClix redirects user to advertiser landing page with click_id in URL

3

Advertiser stores click_id in first-party cookie (server-side)

4

User completes purchase — advertiser server fires postback to AffClix

5

AffClix receives postback, attributes conversion to publisher — done

S2S vs Pixel Tracking

FactorPixel TrackingS2S Tracking
Ad blocker resistanceBlocked by ~42% of desktop usersNever affected — server-to-server
Safari ITP compatibilityBroken — 1-day cookie capFully compatible
JavaScript dependencyRequires JS executionZero JS dependency
Fraud riskBots can trigger pixelsCannot fake server requests
Privacy complianceRequires cookie consentNo cookie — more privacy-safe
Setup complexityDrop a tag — simpleRequires server integration

Step 1 — Generate & Store the Click ID

Every affiliate link processed by AffClix generates a unique click_id parameter appended to the redirect URL. This ID must be captured and stored on the advertiser side immediately — the most common S2S failure is losing the click_id between the landing page and the conversion page.

  • First-party cookie (recommended) — Set with HttpOnly + Secure flags, 30-day expiry. Survives page reloads, new tabs, and session timeouts.
  • URL parameter passthrough — Append to all internal links through the checkout flow. Fragile if any link breaks the chain.
  • Session storage only — Not recommended. Lost when user opens a new tab, and expires with the session.

Step 2 — Fire the Postback on Conversion

When a conversion event occurs, your server fires a GET request to your AffClix postback URL. The request must fire server-side — never from browser JavaScript — to bypass ad blockers and avoid bot manipulation.

Critical: Fire Server-Side Only

Postbacks fired via browser JavaScript are blocked by ad blockers (affecting 42% of desktop users). They can also be replayed by bots to generate fake conversions. Always fire from your application server using curl, axios, or similar.

PHP & Node.js Code Examples

PHP
// On landing page — store click_id immediately
if (isset($_GET['click_id'])) {
    setcookie('affclix_cid', $_GET['click_id'],
        time() + 86400 * 30,
        '/', '', true, true
    );
}

// On order confirmation — fire postback server-side
$cid = $_COOKIE['affclix_cid'] ?? null;

if ($cid && !Conversion::alreadyFired($order->id)) {
    $url = 'https://track.yourdomain.com/p?' . http_build_query([
        'auth'     => 'YOUR_POSTBACK_TOKEN',
        'click_id' => $cid,
        'event'    => 'purchase',
        'sale'     => $order->total,
        'currency' => 'USD',
        'order_id' => $order->id,
    ]);
    $ch = curl_init();
    curl_setopt_array($ch, [
        CURLOPT_URL            => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT        => 5,
        CURLOPT_SSL_VERIFYPEER => true,
    ]);
    curl_exec($ch);
    curl_close($ch);
    Conversion::markFired($order->id);
}
Node.js
const axios = require('axios');

async function firePostback(req, order) {
  const clickId = req.cookies.affclix_cid;
  if (!clickId) return;
  try {
    await axios.get('https://track.yourdomain.com/p', {
      params: {
        auth:     'YOUR_POSTBACK_TOKEN',
        click_id: clickId,
        event:    'purchase',
        sale:     order.total,
        currency: 'USD',
        order_id: order.id,
      },
      timeout: 5000,
    });
  } catch (err) {
    logger.warn('Postback failed', { clickId, err: err.message });
  }
}

Common Failures & Fixes

click_id lost between pages

Store in an HttpOnly first-party cookie (30-day expiry) on the landing page immediately when the click_id is present in the URL.

Postback firing in browser JS

Move the curl/axios call to your application server. Browser JS is blocked by ad blockers on 42% of desktop sessions.

Server firewall blocking outbound

Whitelist AffClix egress IPs in your firewall rules. Check AffClix docs for current IP ranges.

Double-firing on page refresh

Store fired order IDs in a DB table. Check before firing — skip if already recorded.

Missing required parameters

Use AffClix Postback Tester in the dashboard to validate your URL before going live.

Testing Your Integration

AffClix provides a built-in postback tester and a full sandbox environment. Run these checks before going live:

  • click_id appears in browser cookies after visiting the landing page
  • cookie persists when navigating through the full checkout flow
  • postback fires within 5 seconds of order confirmation
  • conversion appears in AffClix dashboard within 10 seconds
  • test passes with Safari + ad blocker active (the hardest case)
  • run an idempotency test — refresh the confirmation page and verify no duplicate conversion fires
Pro Tip

Always test on a real iOS device with Safari, not just desktop Chrome. Safari's ITP is the most aggressive tracking blocker in the field and will catch issues that Chrome testing misses.

常见问题

什么是 S2S(服务器端到服务器端)追踪?

S2S 追踪通过直接的服务器调用来记录点击与转化——重定向时存储 Click ID,转化触发时通过回传 URL 将其返回。由于完全不依赖浏览器存储,它不受 Cookie 拦截和广告拦截器影响。

为什么 S2S 追踪比像素追踪更可靠?

像素在浏览器中执行,第三方 Cookie 限制、ITP 和广告拦截器经常导致追踪失效。而回传直接在广告主与追踪平台的服务器之间运行,无论浏览器隐私设置如何,归因都能稳定完成。

配置 S2S 回传需要开发人员吗?

基础配置只需在落地页 URL 附加 Click ID 参数,并在转化时调用回传端点——大多数 CRM、电商系统和 MMP 都原生支持。定制化集成仅需轻量后端开发,通常不到一天即可完成。

Dev Team

Dev Team

AffClix Engineering Team building the tracking infrastructure that processes 50M+ clicks per day. Authors of the AffClix Postback API and S2S integration documentation.

Related Articles

行业洞察

2026 联盟营销 GDPR 与隐私合规指南

追踪技术

白标联盟平台:2026 年自研、采购与授权深度对比