syndicate-test-conversion
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSyndicate Links Test Conversion
Syndicate Links测试转化
Use this skill to verify merchant attribution without creating a real payable affiliate event.
The shipped test rail is:
http
POST https://api.syndicatelinks.co/merchant/test-links
POST https://api.syndicatelinks.co/merchant/test-links/:code/fire-conversionDo not use the production conversion endpoint for smoke tests, do not add to production conversion payloads, and do not point at a separate sandbox URL.
isTest使用该技能可验证商家归因,无需创建真实的可结算联盟事件。
官方提供的测试流程接口如下:
http
POST https://api.syndicatelinks.co/merchant/test-links
POST https://api.syndicatelinks.co/merchant/test-links/:code/fire-conversion请勿使用生产转化端点进行冒烟测试,不要在生产转化请求体中添加参数,也不要指向单独的沙箱URL。
isTestPrerequisites
前置条件
- set to a Syndicate Links merchant key
TOKEN - A product ID owned by the merchant
- Optional: a program ID when the product belongs to a specific program
The test link flow creates or reuses an internal test affiliate and marks generated test events so they stay out of real publisher metrics and payouts.
- 已设置为Syndicate Links商家密钥
TOKEN - 拥有商家名下的产品ID
- 可选:若产品属于特定项目,需提供项目ID
测试链接流程会创建或复用内部测试联盟账号,并标记生成的测试事件,使其不会计入真实发布商的指标和佣金结算。
1. Confirm the merchant key is present
1. 确认商家密钥已配置
bash
test -n "${TOKEN:-}" || { echo "Set TOKEN to your Syndicate Links merchant key first"; exit 1; }bash
test -n "${TOKEN:-}" || { echo "请先将TOKEN设置为你的Syndicate Links商家密钥"; exit 1; }2. Generate a merchant test link
2. 生成商家测试链接
bash
curl -sS -X POST https://api.syndicatelinks.co/merchant/test-links \
-H "Authorization: Bearer ${MERCHANT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"productId": "product_uuid",
"programId": "program_uuid"
}' | python3 -m json.toolIf the product is products-first and has no program, omit . The API can mint the internal house program needed for the test-link flow.
programIdExpected response shape:
json
{
"trackingLink": {
"id": "...",
"code": "abc123xy",
"clickUrl": "https://api.syndicatelinks.co/click/abc123xy",
"destinationUrl": "https://merchant.example/product",
"productId": "...",
"programId": "...",
"affiliateId": "..."
},
"affiliate": {
"id": "...",
"name": "Merchant Name Internal Test",
"isInternalTest": true
}
}Copy for the next step.
trackingLink.codebash
curl -sS -X POST https://api.syndicatelinks.co/merchant/test-links \
-H "Authorization: Bearer ${MERCHANT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"productId": "product_uuid",
"programId": "program_uuid"
}' | python3 -m json.tool如果产品以产品为核心且无所属项目,可省略。API会自动创建测试链接流程所需的内部项目。
programId预期响应格式:
json
{
"trackingLink": {
"id": "...",
"code": "abc123xy",
"clickUrl": "https://api.syndicatelinks.co/click/abc123xy",
"destinationUrl": "https://merchant.example/product",
"productId": "...",
"programId": "...",
"affiliateId": "..."
},
"affiliate": {
"id": "...",
"name": "Merchant Name Internal Test",
"isInternalTest": true
}
}复制用于下一步操作。
trackingLink.code3. Fire the synthetic test conversion
3. 触发模拟测试转化
bash
TRACKING_CODE="abc123xy"
ORDER_ID="test-$(date +%s)"
curl -sS -X POST "https://api.syndicatelinks.co/merchant/test-links/$TRACKING_CODE/fire-conversion" \
-H "Authorization: Bearer ${MERCHANT_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"saleAmount\": 99.99, \"orderId\": \"$ORDER_ID\"}" | python3 -m json.toolExpected response contains with:
eventtype: "conversion"- matching the test order
orderId saleAmountcommissionAmountcommissionStatus: "approved"
bash
TRACKING_CODE="abc123xy"
ORDER_ID="test-$(date +%s)"
curl -sS -X POST "https://api.syndicatelinks.co/merchant/test-links/$TRACKING_CODE/fire-conversion" \
-H "Authorization: Bearer ${MERCHANT_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"saleAmount\": 99.99, \"orderId\": \"$ORDER_ID\"}" | python3 -m json.tool预期响应包含字段,其中:
eventtype: "conversion"- 与测试订单一致
orderId - (销售额)
saleAmount - (佣金金额)
commissionAmount - (佣金状态:已批准)
commissionStatus: "approved"
4. Verify the real conversion rail separately
4. 单独验证真实转化流程
For production conversion reporting, use the real merchant endpoint with a real tracking link:
bash
curl -sS -X POST https://api.syndicatelinks.co/merchant/conversions \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"trackingCode": "real_tracking_code",
"orderId": "real_order_id",
"saleAmount": 99.99,
"currency": "USD"
}' | python3 -m json.toolUse this only when you intentionally want to record a real conversion. The test-link endpoint is safer for smoke tests.
如需生产转化报告,请使用真实商家端点和真实跟踪链接:
bash
curl -sS -X POST https://api.syndicatelinks.co/merchant/conversions \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"trackingCode": "real_tracking_code",
"orderId": "real_order_id",
"saleAmount": 99.99,
"currency": "USD"
}' | python3 -m json.tool仅当你有意记录真实转化时才使用此接口。测试链接端点更适合冒烟测试。
Quick smoke test script
快速冒烟测试脚本
bash
#!/usr/bin/env bash
set -euo pipefail
PRODUCT_ID="${1:?Usage: $0 <product_uuid> [program_uuid]}"
PROGRAM_ID="${2:-}"
export PRODUCT_ID PROGRAM_ID
BODY=$(python3 - <<'PY'
import json, os
body = {"productId": os.environ["PRODUCT_ID"]}
program_id = os.environ.get("PROGRAM_ID")
if program_id:
body["programId"] = program_id
print(json.dumps(body))
PY
)
LINK_RESPONSE=$(curl -sS -X POST https://api.syndicatelinks.co/merchant/test-links \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d "$BODY")
CODE=$(printf '%s' "$LINK_RESPONSE" | python3 -c 'import json,sys; print(json.load(sys.stdin)["trackingLink"]["code"])')
ORDER_ID="test-$(date +%s)"
curl -sS -X POST "https://api.syndicatelinks.co/merchant/test-links/$CODE/fire-conversion" \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"saleAmount\":99.99,\"orderId\":\"$ORDER_ID\"}" | python3 -m json.toolbash
#!/usr/bin/env bash
set -euo pipefail
PRODUCT_ID="${1:?Usage: $0 <product_uuid> [program_uuid]}"
PROGRAM_ID="${2:-}"
export PRODUCT_ID PROGRAM_ID
BODY=$(python3 - <<'PY'
import json, os
body = {"productId": os.environ["PRODUCT_ID"]}
program_id = os.environ.get("PROGRAM_ID")
if program_id:
body["programId"] = program_id
print(json.dumps(body))
PY
)
LINK_RESPONSE=$(curl -sS -X POST https://api.syndicatelinks.co/merchant/test-links \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d "$BODY")
CODE=$(printf '%s' "$LINK_RESPONSE" | python3 -c 'import json,sys; print(json.load(sys.stdin)["trackingLink"]["code"])')
ORDER_ID="test-$(date +%s)"
curl -sS -X POST "https://api.syndicatelinks.co/merchant/test-links/$CODE/fire-conversion" \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"saleAmount\":99.99,\"orderId\":\"$ORDER_ID\"}" | python3 -m json.toolCommon pitfalls
常见误区
- Using real conversion fire for smoke tests. Use unless you intentionally want a real conversion.
/merchant/test-links/:code/fire-conversion - Missing product ID. requires a merchant-owned product ID.
POST /merchant/test-links - Wrong tracking code. The fire endpoint requires a test tracking link code, not a real affiliate link code.
- Expecting test rows in normal reports. Internal test events are filtered from real metrics by design.
- Wrong endpoint prefix. Use the exact merchant test-link paths shown above with no version prefix.
- 使用真实转化接口进行冒烟测试:除非有意记录真实转化,否则请使用接口。
/merchant/test-links/:code/fire-conversion - 缺少产品ID:接口必须提供商家名下的产品ID。
POST /merchant/test-links - 跟踪代码错误:触发转化的端点需要测试跟踪链接代码,而非真实联盟链接代码。
- 期望在常规报告中看到测试数据:内部测试事件默认会从真实指标中过滤掉。
- 端点前缀错误:请使用上述准确的商家测试链接路径,不要添加版本前缀。
Links
相关链接
- API reference: https://syndicatelinks.co/docs/api-reference
- Getting started: https://syndicatelinks.co/docs/getting-started