Install
openclaw skills install @cloudcode-hans/ali-promotion-roiAnalyze Alibaba International (alibaba.com) promotion ROI - evaluates total promotion spend vs. actual completed orders and revenue. Use when the user asks about Alibaba 国际站推广投入产出, 推广 ROI, 阿里广告效果分析, 标准推广/全站推广效果对比, 月度推广总结, or wants to know how much each completed order costs (CPO). Reads pre-loaded data from MySQL via sql-linker-cli (tables: alibaba_intl_orders + alibaba_intl_promotion_daily). Does NOT load data - that requires separate ingestion scripts.
openclaw skills install @cloudcode-hans/ali-promotion-roiUse this skill when the user wants to:
standard_promotion (标准推广) vs sitewide_promotion (全站推广)Do NOT use this skill for data ingestion. Loading Excel into MySQL is handled by scripts/alibaba_intl/load_orders.py and load_promotion.py. This skill only reads existing data.
alibaba_intl_orders (信保订单明细)alibaba_intl_promotion_daily (标准+全站推广日度合并)db_bridge)table_dictionary.json (already done if you ran add_orders_promotion_to_dictionary.py)If tables are missing, tell the user to run the ingestion scripts first.
cd skills/ali_promotion_roi
python scripts/cli.py # Full report (all months)
python scripts/cli.py --month 2026-01 # Single month
python scripts/cli.py --rate 7.25 # Custom USD/CNY rate
python scripts/cli.py --by-type # Only promotion-type breakdown
python scripts/cli.py --by-date # Only daily drilldown
python scripts/cli.py --json > report.json # JSON for further processing
The CLI uses DBBridge with explicit credential approval (explicit_credential_approval(approved=True)) — this is required when the sql-linker-cli credential gate is enabled.
The report contains 3 sections:
references/metrics.md for full definitions)order_amount + shipping_fee - discount_amountorder_status = '订单完成' (closed/refunded excluded)This skill reads from MySQL via sql-linker-cli's DBBridge:
| Table | Purpose |
|---|---|
alibaba_intl_orders | Order facts (信保订单, row-level) |
alibaba_intl_promotion_daily | Daily promotion metrics (standard + sitewide merged) |
For schema details, read references/schema.md. For metric definitions and common pitfalls, read references/metrics.md.
ali_promotion_roi/
├── SKILL.md # This file
├── scripts/
│ ├── cli.py # CLI entry: argparse + report rendering
│ └── roi.py # Pure compute: fetch / compute_summary / compute_by_type / compute_by_date
└── references/
├── schema.md # Table column reference
└── metrics.md # Metric definitions + analysis patterns
The scripts/roi.py module exports reusable functions (fetch_orders, fetch_promotion, compute_summary, compute_by_type, compute_by_date, connect_db) — you can import roi from another script to embed ROI logic in larger workflows.
| Symptom | Cause | Fix |
|---|---|---|
[WARN] 没有数据 | Tables empty or not loaded | Run ingestion scripts first |
TableAccessDenied | Tables not in table_dictionary.json | Run add_orders_promotion_to_dictionary.py |
Silent credential access requires explicit approval | Gate enabled but approved=True not passed | The CLI already handles this — re-run |
| ROI shows N/A | Cost = 0 (no promotion spend that month) | Expected, not an error |
To add new analyses (e.g., per-buyer-country ROI, per-product ROI):
scripts/roi.pyscripts/cli.pymain() with a new CLI flagKeep the compute layer pure (no SQL inside compute functions) — fetch all data upfront, then compute in-memory.