Back to overview
Lesson 3 of 6

On-Chain Tracking and Attribution

8 min read

Two Tracking Layers: On-Chain and Off-Chain

Web3 affiliate tracking operates across two layers that do not exist together in traditional affiliate programs. The off-chain layer uses standard S2S postback -- click IDs, server-side event firing, and cookie-independent attribution. The on-chain layer uses smart contract referral codes embedded in blockchain transactions, providing immutable, publicly verifiable attribution. Most web3 programs need both layers working together.

The off-chain layer handles the acquisition funnel: ad clicks, landing page visits, sign-ups, and KYC completion. The on-chain layer handles the value events: deposits, trades, swaps, staking, and withdrawals. Connecting these two layers -- mapping an off-chain click ID to an on-chain wallet address -- is the core technical challenge of web3 affiliate tracking.

On-chain referral data is immutable and publicly auditable. This is an advantage for affiliate transparency -- partners can independently verify their referral counts and commission calculations by reading the blockchain, which reduces disputes and builds trust.

Smart Contract Referral Systems

DeFi protocols and on-chain applications can embed referral logic directly into smart contracts. When a user interacts with the protocol (swaps tokens, provides liquidity, mints an NFT), the transaction includes a referrer parameter -- typically the referring wallet address or a referral code mapped to a wallet. The smart contract records the referral on-chain and can automatically distribute commissions to the referrer wallet.

  • Referrer parameter: The referring wallet address or code is passed as a function argument in the smart contract call
  • On-chain mapping: The contract stores the referrer-to-user relationship permanently on the blockchain
  • Automatic distribution: Commission tokens can be sent to the referrer wallet in the same transaction or batched
  • Verifiability: Anyone can read the contract state to verify referral relationships and commission payments
  • Immutability: Once recorded, referral attribution cannot be altered or disputed

The limitation of pure on-chain tracking is that it only captures blockchain transactions. It cannot track pre-wallet events like website visits, sign-up form completions, or KYC verification. For centralized exchanges and hybrid platforms that have both web interfaces and on-chain components, purely on-chain tracking leaves gaps in the funnel.

Hybrid Attribution Architecture

The practical approach for most web3 programs is a hybrid model. S2S postback handles the off-chain funnel (click, visit, sign-up, KYC), and on-chain tracking handles value events (deposit, trade, stake). The connection point is the wallet address: when a user connects their wallet to the platform, the system links the off-chain click ID to the on-chain wallet address. From that point forward, all on-chain activity by that wallet is attributed to the original referrer.

EventTracking LayerData CapturedAttribution Use
Ad click / link clickOff-chain (S2S)Click ID, source, campaign, timestampFirst-touch attribution to affiliate
Website registrationOff-chain (S2S)User ID, email, registration sourcePostback fired to affiliate platform
Wallet connectionBridge eventWallet address linked to user ID and click IDConnects off-chain identity to on-chain wallet
First depositOn-chain or hybridDeposit amount, token, chain, walletCPA trigger event, postback + on-chain record
Trading activityOn-chainVolume, fees, pairs tradedRevShare calculation, volume-based commissions
Staking / LP provisionOn-chainAmount staked, duration, protocolLong-term engagement metric for RevShare

Wallet-Based Attribution Challenges

Wallet-based attribution introduces challenges that do not exist in cookie or click-based tracking. Users can have multiple wallets, making it possible for one person to appear as multiple referred users. Wallets can be created programmatically at near-zero cost, enabling bot-driven referral fraud. And wallet addresses are pseudonymous, making it difficult to link on-chain activity to real user identity for compliance purposes.

  • Multi-wallet users: Implement wallet clustering analysis to group wallets controlled by the same entity
  • Sybil attacks: Require minimum deposit or transaction thresholds before referral credit is granted
  • Wash trading: Monitor for circular transaction patterns between referrer and referred wallets
  • Identity linking: Use KYC data (where available) to connect wallet addresses to verified identities
  • Attribution windows: Set clear timeframes (30-90 days) for how long after wallet connection activity is attributed to the referrer

On-chain Sybil attacks (one person creating hundreds of wallets to claim referral rewards) are the web3 equivalent of multi-accounting in iGaming. Qualification rules that require minimum deposit amounts or cumulative trading volume before commission credit filter out most bot-generated wallets.

Choosing the Right Tracking Stack

The tracking stack depends on the project type. Centralized exchanges with user accounts can rely primarily on S2S postback with API-based revenue reporting -- the same architecture used in Forex IB programs. Fully on-chain DeFi protocols need smart contract referral logic with off-chain analytics for funnel reporting. Hybrid platforms (centralized exchange with DeFi features, or a GameFi platform with both web and on-chain components) need both layers connected at the wallet-address level.

Regardless of architecture, the affiliate management platform must ingest data from both layers and present a unified view. An affiliate partner needs to see total clicks, registrations, wallet connections, deposits, and trading volume in one dashboard -- not two separate systems. The commission engine must calculate payouts based on on-chain revenue data while the reporting layer shows the full funnel from click to revenue.

Key Takeaways

  • Web3 tracking requires two layers: off-chain S2S postback for the acquisition funnel and on-chain smart contract tracking for value events
  • The wallet connection event is the critical bridge that links off-chain click attribution to on-chain transaction data
  • On-chain referral data is immutable and publicly verifiable -- this transparency advantage reduces disputes between operators and affiliates
  • Sybil attacks (bot-generated wallets claiming referral rewards) are the primary fraud vector -- require minimum deposit or trading thresholds as qualification rules
  • The affiliate management platform must present a unified view across both on-chain and off-chain data for accurate reporting and commission calculation