Weibo setup
ads.conversions.track() call fans the event out to Weibo server-side — no per-platform code.Setup guide
Overview
adscapi sends server-side OCPA conversion callbacks (转化回传) to Weibo Ads over the
GET /v3/track/activate endpoint. Weibo attributes a conversion by mark_id — the click
identifier carried on the landing-page URL — not by hashed email or phone. Weibo takes NO
PII. Events older than 2 hours are dropped as natural traffic, so send in near real time.
Prerequisites
- A Weibo Ads (微博广告 / 超级粉丝通) advertiser account.
- An OCPA campaign whose landing-page URL carries the Weibo click macro, so each visit
arrives with a
mark_idquery parameter to attribute against.
1. Create an account
- Sign in at https://biz.weibo.com/ and open the Weibo Ads console (超级粉丝通).
- Create an advertiser, then an OCPA campaign with a conversion goal (转化目标).
- Register a developer app at https://developers.biz.weibo.com/ to obtain OAuth credentials for the callback API.
2. Get your credentials
| Secret | Where to get it |
|---|---|
WEIBO_TRACK_TOKEN |
The OAuth2 access token from the Weibo biz OAuth flow (GET https://api.biz.weibo.com/oauth/token). Sent as Authorization: Bearer <token>. Refresh it before it expires (max ~24h). |
WEIBO_HOST (optional) |
The callback source domain — your landing-page host, e.g. replytosocial.com. If unset, adscapi derives it from the event's page URL. |
The mark_id is not a secret: your site reads it from the landing-page URL and passes it
to adscapi as clickIds.mark_id on the event.
3. Configure adscapi
export WEIBO_TRACK_TOKEN="…"
export WEIBO_HOST="replytosocial.com" # optional; else derived from the page URL
4. Verify
adscapi verify --platform weibo
Expected: [OK ] weibo — …. If it fails, see Troubleshooting.
5. Event mapping
adscapi maps canonical events to Weibo numeric behavior codes. Unmapped events fall back
to 1100 (其他/other).
| Canonical | Weibo behavior |
|---|---|
| purchase | 1007 商品购买 (product purchase) |
| lead | 1001 表单提交 (form submission) |
| signup | 1001 表单提交 (registration ≈ form submission) |
| page_view | 1005 落地页访问 (landing-page visit) |
| other | 1100 其他 (other) |
Other documented codes: 1002 电话拨打 (phone call), 1003 有效咨询 (valid inquiry),
1004 微信复制 (WeChat copy), 1006 下载开始 (download start).
Troubleshooting
HTTP 401— token invalid or expired. Re-run the Weibo OAuth flow and refreshWEIBO_TRACK_TOKEN(tokens expire within ~24h).- Conversions not attributed — the event reached Weibo but had no
mark_id, or it arrived more than 2 hours after the click. Without amark_idthe hit counts as natural traffic. Make sure your landing page forwards the URL'smark_idintoclickIds.mark_id. - No value/currency — the Weibo callback carries no revenue field. Purchase value is not sent; only the conversion action (behavior) and its identity are.
1. Install adscapi
npm install adscapi # or run without installing: npx adscapi platforms
2. Get Weibo's tokens
Weibo activates once all of these are set. Run npx adscapi platforms to see them, then get each value from Weibo’s ads or events dashboard.
WEIBO_TRACK_TOKEN3. Set them for adscapi
Export the tokens in the environment that runs your server or the adscapi CLI.
export WEIBO_TRACK_TOKEN="…"
4. Verify
check confirms the secrets are present; verify calls Weibo’s API to confirm they are valid.
npx adscapi check npx adscapi verify --platform weibo
5. Track a conversion
One call, sent to Weibo and every other configured platform. Pass raw email — adscapi hashes per platform. Consent is required.
import { createAdscapi } from 'adscapi';
const ads = createAdscapi();
const results = await ads.conversions.track({
name: 'purchase',
value: 49,
currency: 'USD',
user: { email: 'buyer@example.com' },
consent: { adUserData: true, adPersonalization: true },
});See the exact request on the Weibo payload preview.