Quản lý Ngân sách và Campaign - Budget & Campaign Management
1. Tổng quan
1.1. Mục đích
Module này quản lý việc phân bổ ngân sách từ Scope xuống các Campaign cụ thể và theo dõi thực thi.
1.2. Phân biệt vai trò
- PM: Lập kế hoạch tài chính, phân bổ ngân sách, set KPI
- Ads Team: Thực thi campaign, optimize performance trong khuôn khổ đã định
PM không tạo ads. PM tạo kế hoạch tài chính.
2. Campaign Planning
2.1. Nguyên tắc phân bổ ngân sách
Mỗi Campaign là một "Budget Bucket"
Scope Budget: 800M
├── Campaign 1: 200M (Office workers)
├── Campaign 2: 250M (Housewives)
├── Campaign 3: 200M (Students)
└── Campaign 4: 150M (Retargeting)
Budget Allocation Rules
- Top-down: Từ Contract → Scope → Campaign
- Sum constraint: Σ campaign_budget <= scope_budget
- KPI alignment: Σ campaign_kpi >= scope_kpi_target
- Margin protection: Expected margin >= scope.margin_target
2.2. Campaign Plan Fields
{
"campaign_plan_id": "CMP-PLN-001",
"scope_id": "SCP-2026-001",
"contract_code": "KWP2026",
"scope_code": "FB01",
// Naming (machine-readable)
"campaign_code": "Kewpie-KWP2026-FB01-FB-Lead-Office-P1",
"campaign_name": "Kewpie Office Lead Gen - Phase 1",
// Platform
"platform": "FB",
"objective": "Lead",
"segment": "Office",
"phase": "P1",
// Budget
"budget_allocated": 200000000,
"daily_budget_cap": 2222222,
// KPI
"kpi_target": 12500,
"kpi_type": "leads",
// Pricing
"pricing_model": "CPL",
"break_even_cost": 16000,
"target_cost": 14000,
"profit_margin_target": 25,
// Timeline
"start_date": "2026-01-01",
"end_date": "2026-03-31",
"status": "active"
}
2.3. Use Cases
UC-BDG-01: Import phân bổ ngân sách (Excel/CSV)
Actor: PM
Precondition:
- Scope đã được tạo
- PM có quyền phân bổ budget
Main Flow:
-
PM download template Excel:
| contract_code | scope_code | campaign_code | platform | objective | segment | budget | kpi_target | start_date | end_date | -
PM điền thông tin cho từng campaign
-
PM upload file
-
Hệ thống validate từng row:
- Contract & Scope tồn tại
- Campaign code follow naming convention
- Budget > 0
- KPI > 0
- Dates hợp lệ
-
Hệ thống validate tổng thể:
SUM(campaign.budget) \<= scope.budget
SUM(campaign.kpi) \>= scope.kpi_target -
Hệ thống tính toán:
expected_cpa = campaign.budget / campaign.kpi
expected_profit = (campaign.kpi × unit_price) - campaign.budget
expected_margin = expected_profit / (campaign.kpi × unit_price) × 100 -
Hệ thống check margin:
IF expected_margin \< scope.margin_target
→ WARNING (có thể override) -
Hệ thống tạo các Campaign Plan
-
Hệ thống hiển thị summary:
- Total campaigns: N
- Total budget: X
- Expected KPI: Y
- Expected margin: Z%
Postcondition:
- Campaign Plans được tạo
- Sẵn sàng để execute
Exception Flow:
- Nếu validation fail → hiển thị errors và highlight các row lỗi
- PM fix và re-upload
UC-BDG-02: Tạo campaign plan thủ công
Actor: PM
Main Flow:
- PM chọn scope và click "Add Campaign"
- PM nhập thông tin:
- Campaign details
- Budget & KPI
- Timeline
- Hệ thống auto-generate campaign_code theo naming convention
- Hệ thống validate (same as UC-BDG-01)
- Hệ thống tạo campaign plan
UC-BDG-03: Tính toán break-even và profit
Actor: System (auto)
Formula:
// Break-even point
break_even_cpa = budget / kpi_target
// Expected profit
expected_revenue = kpi_target × unit_price
expected_cost = budget
expected_profit = expected_revenue - expected_cost
expected_margin = (expected_profit / expected_revenue) × 100
// Actual profit (real-time)
actual_revenue = kpi_achieved × unit_price
actual_cost = spend_to_date
actual_profit = actual_revenue - actual_cost
actual_margin = (actual_profit / actual_revenue) × 100
Display:
Campaign: Kewpie-KWP2026-FB01-FB-Lead-Office-P1
-------------------------------------------------
Budget: 200,000,000 VND
Spend: 150,000,000 VND (75%)
KPI Target: 12,500 leads
KPI Achieved: 10,000 leads (80%)
Break-even CPA: 16,000 VND
Target CPA: 14,000 VND
Actual CPA: 15,000 VND ✓ (under break-even)
Expected Revenue: 250,000,000 VND
Actual Revenue: 200,000,000 VND
Actual Cost: 150,000,000 VND
Actual Profit: 50,000,000 VND
Actual Margin: 25% ✓ (on target)
Status: ON TRACK
3. Campaign Naming Convention
3.1. Tại sao quan trọng?
Campaign naming là chìa khóa để mapping data từ BigQuery về system.
Nếu không có naming convention:
- Không biết campaign nào thuộc scope nào
- Không tính được budget/KPI cho đúng scope
- Không biết khi nào nghiệm thu
- Mất kiểm soát hoàn toàn
3.2. Format chuẩn
\<Client\>-\<Contract\>-\<Scope\>-\<Channel\>-\<Objective\>-\<Segment\>-\<Phase\>
Ví dụ
Kewpie-KWP2026-FB01-FB-Lead-Office-P1
Parse thành tokens
| Token | Value | Meaning |
|---|---|---|
| 0 | Kewpie | Client name |
| 1 | KWP2026 | Contract code |
| 2 | FB01 | Scope code |
| 3 | FB | Platform/Channel |
| 4 | Lead | Objective |
| 5 | Office | Segment/Audience |
| 6 | P1 | Phase |
3.3. Naming Rules
Client (Token 0)
- No spaces, use CamelCase
- Max 15 chars
- Examples: Kewpie, VinamilkVN, Grab, Shopee
Contract (Token 1)
- Format:
{ClientCode}{Year} - Examples: KWP2026, VNM2026, GRB2026
Scope (Token 2)
- Format:
{Channel}{Number} - Examples: FB01, TT01, WEB01, GG01
Channel (Token 3)
- FB = Facebook
- TT = TikTok
- GG = Google
- YT = YouTube
- IG = Instagram
- LI = LinkedIn
Objective (Token 4)
- Lead = Lead Generation
- Traffic = Website Traffic
- Conversion = Sales Conversion
- Engagement = Brand Engagement
- App = App Install
- Video = Video Views
Segment (Token 5)
- Mô tả audience chính
- No spaces, use CamelCase
- Examples: Office, Housewife, Student, Moms, Premium
Phase (Token 6)
- P1, P2, P3... = Phase number
- Q1, Q2... = Quarter
- Jan, Feb... = Month
- Test, Scale = Test/Scale phase
3.4. Parsing Logic (BigQuery)
-- Parse campaign name
SELECT
campaign_name,
SPLIT(campaign_name, '-')[OFFSET(0)] AS client,
SPLIT(campaign_name, '-')[OFFSET(1)] AS contract_code,
SPLIT(campaign_name, '-')[OFFSET(2)] AS scope_code,
SPLIT(campaign_name, '-')[OFFSET(3)] AS channel,
SPLIT(campaign_name, '-')[OFFSET(4)] AS objective,
SPLIT(campaign_name, '-')[OFFSET(5)] AS segment,
SPLIT(campaign_name, '-')[OFFSET(6)] AS phase
FROM ads_raw_data
3.5. Validation Tool
Hệ thống cung cấp tool validate campaign name trước khi tạo:
Input: Kewpie-KWP2026-FB01-FB-Lead-Office-P1
Output:
✓ Format: Valid
✓ Contract: KWP2026 exists
✓ Scope: FB01 exists in KWP2026
✓ Channel: FB matches scope.channel
⚠ Phase: P1 - ensure unique within scope
4. Auto Budget Guard
4.1. Mục đích
Tự động giám sát và bảo vệ ngân sách, tránh chạy lố.
4.2. Monitoring Rules
| Spend Level | Action | Notification |
|---|---|---|
| < 80% | Normal | None |
| 80-89% | Warning | Email to PM |
| 90-94% | Alert | Email + Slack |
| 95-99% | Critical | Email + Slack + SMS |
| >= 100% | Auto Pause | All channels + Director |
4.3. Use Cases
UC-GUARD-01: Warning Alert (80%)
Trigger: Spend >= 80% budget
Main Flow:
- Hệ thống detect spend >= 80%
- Hệ thống tính:
days_remaining = end_date - today
daily_pace_needed = (budget - spend) / days_remaining
current_daily_pace = spend / days_elapsed - Hệ thống tạo notification:
Campaign: Kewpie-...-Office-P1
Budget used: 80% (160M / 200M)
Days remaining: 30
Current pace: 2.2M/day
Needed pace: 1.3M/day
⚠ You are spending faster than planned.
Consider reducing daily budget or pause low-performing ads. - Email to PM
UC-GUARD-02: Critical Alert (95%)
Trigger: Spend >= 95% budget
Main Flow:
- Hệ thống detect spend >= 95%
- Hệ thống tính ETA (Estimated Time to hit 100%):
remaining_budget = budget - spend
current_daily_pace = spend_last_7_days / 7
eta_days = remaining_budget / current_daily_pace - Hệ thống tạo alert:
🚨 CRITICAL: Budget Almost Depleted
Campaign: Kewpie-...-Office-P1
Budget used: 95% (190M / 200M)
Remaining: 10M
At current pace (2.5M/day), budget will be depleted in 4 days.
ACTION REQUIRED:
- Reduce daily budget immediately, OR
- Request budget increase, OR
- Pause campaign - Email + Slack + SMS to PM
- Notification to Director
UC-GUARD-03: Auto Pause (100%)
Trigger: Spend >= 100% budget
Precondition:
- API integration enabled
- PM không override auto-pause setting
Main Flow:
-
Hệ thống detect spend >= 100%
-
Nếu có Meta Ads API integration:
- Hệ thống get campaign ID từ mapping table
- Call Meta API:
PATCH /{campaign-id}vớistatus: "PAUSED" - Log API response
-
Hệ thống update campaign_plan.status = "paused"
-
Hệ thống tạo incident log:
{
"type": "auto_pause",
"campaign": "Kewpie-KWP2026-FB01-FB-Lead-Office-P1",
"reason": "Budget depleted",
"spend": 200500000,
"budget": 200000000,
"timestamp": "2026-03-15T14:23:00Z"
} -
Hệ thống gửi notification:
🛑 CAMPAIGN AUTO-PAUSED
Campaign: Kewpie-...-Office-P1
Reason: Budget 100% depleted (200.5M / 200M)
The campaign has been automatically paused on Meta platform.
To resume:
1. Request budget increase from Director
2. System will resume campaign automatically -
Email + Slack + Push notification to:
- PM (owner)
- Director
- Ads Team
Postcondition:
- Campaign paused on Meta
- campaign_plan.status = "paused"
- Không spend thêm
Manual Override:
- Director approve budget increase
- Hệ thống update budget
- Hệ thống resume campaign
- Notification gửi đi
5. KPI Pace Monitoring
5.1. Mục đích
Đảm bảo campaign không chỉ trong budget, mà còn đạt KPI đúng tiến độ.
5.2. Pace Calculation
# Expected pace (should-be)
total_days = (end_date - start_date).days
days_elapsed = (today - start_date).days
expected_progress = days_elapsed / total_days
expected_kpi = kpi_target * expected_progress
# Actual pace
actual_kpi = kpi_achieved
actual_progress = actual_kpi / kpi_target
# Pace gap
pace_gap = actual_progress - expected_progress
# Status
if pace_gap \>= 0.1:
status = "ahead"
elif pace_gap \<= -0.1:
status = "behind"
else:
status = "on_track"
5.3. KPI Alert Rules
| Pace Gap | Status | Action |
|---|---|---|
| >= +10% | Ahead | Great job notification |
| -5% to +10% | On Track | None |
| -10% to -5% | Slightly Behind | Warning email |
| < -10% | Behind | Alert + Action required |
5.4. Use Case
UC-KPI-01: KPI Behind Alert
Trigger: Pace gap < -10%
Main Flow:
-
Hệ thống tính toán daily:
expected_kpi = 12500 × (45 days / 90 days) = 6250 leads
actual_kpi = 5000 leads
pace_gap = (5000 / 12500) - (45 / 90) = -10% -
Hệ thống tạo alert:
⚠ KPI BEHIND SCHEDULE
Campaign: Kewpie-...-Office-P1
Progress: 50% of time elapsed, but only 40% of KPI achieved
Target: 12,500 leads
Expected by now: 6,250 leads (50%)
Actual: 5,000 leads (40%)
Gap: -1,250 leads (-10%)
At current pace: 10,000 leads (80% of target)
RECOMMENDATION:
- Review ad creative performance
- Adjust audience targeting
- Consider increasing budget for top performers
- Review landing page conversion rate -
Email to PM với actionable insights
6. Profit Protection Engine
6.1. Mục đích
Ngăn chặn campaign chạy lỗ do:
- CPA cao hơn break-even
- Chi phí vượt kế hoạch
- Conversion thấp
6.2. Real-time Profit Calculation
# Expected profit (at planning stage)
expected_revenue = kpi_target × unit_price
expected_cost = budget_allocated
expected_profit = expected_revenue - expected_cost
# Actual profit (real-time)
actual_revenue = kpi_achieved × unit_price
actual_cost = spend_to_date
actual_profit = actual_revenue - actual_cost
# Projected profit (forecast)
if kpi_achieved \> 0:
projected_kpi = kpi_achieved / (spend / budget) # scale up
projected_revenue = projected_kpi × unit_price
projected_cost = budget
projected_profit = projected_revenue - projected_cost
else:
projected_profit = expected_profit
6.3. Protection Rules
| Condition | Action |
|---|---|
| Projected profit < 0 | Block budget increase |
| Actual margin < Target margin - 10% | Warning alert |
| Actual margin < 0 | Critical alert + Recommendation to pause |
| CPA > Break-even CPA | Warning + Optimization suggestions |
6.4. Use Case
UC-PROFIT-01: Block budget increase khi lỗ
Actor: PM
Scenario: PM muốn tăng budget cho campaign đang chạy
Main Flow:
-
PM request tăng budget từ 200M → 250M
-
Hệ thống tính projected profit:
Current:
- Spend: 150M
- KPI achieved: 8,000 leads
- Actual CPA: 18,750 VND
Projected (if scale to 250M):
- Projected KPI: 8000 × (250M / 150M) = 13,333 leads
- Revenue: 13,333 × 20,000 = 266M
- Cost: 250M
- Profit: 266M - 250M = 16M (6.4% margin)
Expected margin: 25%
Projected margin: 6.4%
Gap: -18.6% -
Hệ thống check:
IF projected_margin \< scope.margin_target:
→ BLOCK with explanation -
Hệ thống hiển thị:
❌ Budget Increase Request BLOCKED
Reason: Projected profit margin (6.4%) is below target (25%)
Current Performance:
- Actual CPA: 18,750 VND
- Break-even CPA: 16,000 VND
- Target CPA: 14,000 VND
The campaign is currently ABOVE break-even CPA.
Increasing budget will result in higher loss.
RECOMMENDATION:
1. Optimize campaign to reduce CPA first
2. Target CPA: \< 15,000 VND
3. Once CPA improved, request budget increase again
OR get Director approval to override. -
PM có 2 options:
- Optimize campaign để giảm CPA, sau đó request lại
- Escalate to Director để override (nếu có lý do đặc biệt)
Postcondition:
- Budget không được tăng
- PM biết rõ lý do
- System bảo vệ margin
7. Campaign Performance Dashboard
7.1. Overview Metrics
CAMPAIGN: Kewpie-KWP2026-FB01-FB-Lead-Office-P1
Status: Active | Phase: P1 | Platform: Facebook
─────────────────────────────────────────────────
📊 BUDGET
Budget: 200,000,000 VND
Spend: 150,000,000 VND (75%)
Remaining: 50,000,000 VND
Daily cap: 2,222,222 VND
🎯 KPI
Target: 12,500 leads
Achieved: 10,000 leads (80%)
Remaining: 2,500 leads
Pace: ON TRACK ✓
💰 COST
Target CPA: 14,000 VND
Actual CPA: 15,000 VND
Break-even CPA: 16,000 VND
Status: PROFITABLE ✓
📈 PROFIT
Revenue: 200,000,000 VND (10k × 20k)
Cost: 150,000,000 VND
Profit: 50,000,000 VND
Margin: 25% ✓ (target: 25%)
⏱ TIMELINE
Start: 2026-01-01
End: 2026-03-31
Elapsed: 45 days (50%)
Remaining: 45 days
🚦 STATUS: HEALTHY
All metrics within acceptable range.
7.2. Trend Charts
- Budget utilization over time
- KPI achievement over time
- CPA trend
- Daily spend trend
7.3. Alerts Section
⚠ ACTIVE ALERTS (2)
─────────────────────
[WARNING] Budget at 75% with 50% time remaining
Action: Monitor daily spend
[INFO] KPI pace slightly ahead (+2%)
Keep up the good work!
8. Batch Operations
8.1. Bulk Pause Campaigns
Use Case: Pause tất cả campaign của một scope
Main Flow:
- PM select scope
- Click "Pause All Campaigns"
- Hệ thống confirm:
Pause 4 campaigns in scope FB01?
- Kewpie-...-Office-P1
- Kewpie-...-Housewife-P1
- Kewpie-...-Student-P1
- Kewpie-...-Retarget-P1
This will pause campaigns on Meta platform. - PM confirm
- Hệ thống call API pause từng campaign
- Update status in database
8.2. Bulk Budget Adjustment
Use Case: Điều chỉnh budget theo % cho nhiều campaign
Main Flow:
- PM select multiple campaigns
- Enter adjustment: +10% hoặc -15%
- Hệ thống preview:
Campaign 1: 200M → 220M (+20M)
Campaign 2: 150M → 165M (+15M)
Total: 350M → 385M (+35M)
Scope budget: 800M
After adjustment: 385M / 800M (48%) - PM confirm
- Hệ thống update budgets
- Sync to Meta if integrated
9. Integration với Ads Platform
9.1. Meta Ads API
Daily Budget Sync
// Set daily budget cap khi tạo campaign
const campaignData = {
name: campaign_code,
objective: "LEAD_GENERATION",
status: "ACTIVE",
daily_budget: daily_budget_cap * 100, // in cents
lifetime_budget: budget_allocated * 100
};
await fb.api(`/act_{ad_account_id}/campaigns`, 'POST', campaignData);
Auto-pause khi hết budget
if (spend \>= budget) {
await fb.api(`/{campaign_id}`, 'POST', {
status: 'PAUSED'
});
}
9.2. TikTok Ads API
Similar integration cho TikTok
9.3. Google Ads API
Similar integration cho Google
10. Reporting
10.1. Campaign Performance Report
- Export PDF/Excel
- Filters: Date range, Scope, Status
- Metrics: Budget, Spend, KPI, CPA, Profit
- Visualizations: Charts & graphs
10.2. Budget Utilization Report
- By scope
- By campaign
- By time period
- Budget vs Spend comparison
10.3. Profit & Loss Report
- Expected vs Actual
- Margin analysis
- Top performers
- Bottom performers
11. Best Practices
11.1. Budget Allocation
- Allocate 80% budget initially
- Keep 20% reserve for scale-up top performers
- Review performance after 25% budget spent
- Reallocate if needed
11.2. Naming Convention
- Always follow standard format
- Use meaningful segment names
- Keep phase numbering consistent
- Document naming choices
11.3. Monitoring
- Check dashboard daily
- Review alerts immediately
- Weekly performance review
- Monthly optimization review