1.8 KiB
1.8 KiB
Market Backend Metrics CSV Design
Goal
Extend the existing CSV export so it includes the six backend metrics already shown in the plugin UI.
Confirmed Decisions
- Reuse the current export flow.
- Do not add a separate backend request for CSV export.
- Read backend metrics directly from the in-memory
MarketRecord. - Append the six backend metrics columns after the existing CSV columns.
- Keep the existing CSV columns and ordering unchanged.
- Use these exact CSV headers:
看后搜率看后搜数新增A3数新增A3率CPA3cp_search
- If a record has no backend metrics, export empty strings for these six columns.
Architecture
src/content/market/csv-exporter.tsremains the single place that defines CSV column layout.- The exporter will keep current base columns and Xingtu rate columns, then append six backend metrics columns.
- No UI changes.
- No batch submission changes.
- No popup or config changes.
Data Source
Each exported row will read from:
- existing fields:
authorIdauthorNamelocationprice21To60srates.singleVideoAfterSearchRaterates.personalVideoAfterSearchRate
- new backend metrics fields:
backendMetrics.afterViewSearchRatebackendMetrics.afterViewSearchCountbackendMetrics.a3IncreaseCountbackendMetrics.newA3RatebackendMetrics.cpa3backendMetrics.cpSearch
Failure Handling
- Missing backend metrics: export blank cells
- Existing rate formatting behavior remains unchanged
- Backend loading state does not alter CSV structure; it only affects whether the cells contain values or blanks
Testing
Add tests for:
- backend metric headers appended to CSV
- backend metric values exported correctly
- empty backend metric cells when metrics are absent
- no regression in current base/rate export behavior