Adsourcer Developer

Click tracking

Every ad includes a signed click_url. Use it as the link href — Adsourcer handles attribution and redirect.

How it works

  1. POST /v1/ads/recommend returns a click_url for each ad
  2. Your UI links the ad CTA to that URL
  3. The user hits GET /v1/click/{token}
  4. Adsourcer validates the token, records the click, and 302-redirects to the advertiser

Do not unwrap URLs

Never extract the destination URL from the token yourself. Always send users through click_url so clicks are attributed correctly.

Example click_url

text
http://localhost:8000/v1/click/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Tokens are signed and time-limited. Expired or tampered tokens return 404.

Publisher responsibilities

  • Use click_url directly — do not modify query parameters
  • Display sponsored disclosure labels alongside every ad
  • Do not prefetch or bot-click redirect URLs

Legacy manual clicks

POST /v1/events/click still exists for custom flows, but signed redirects are the recommended path. See Events.