Chuyển tới nội dung chính

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​

  1. Top-down: Từ Contract → Scope → Campaign
  2. Sum constraint: Σ campaign_budget <= scope_budget
  3. KPI alignment: Σ campaign_kpi >= scope_kpi_target
  4. 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:

  1. PM download template Excel:

    | contract_code | scope_code | campaign_code | platform | objective | segment | budget | kpi_target | start_date | end_date |
  2. PM điền thông tin cho từng campaign

  3. PM upload file

  4. 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ệ
  5. Hệ thống validate tổng thể:

    SUM(campaign.budget) \<= scope.budget
    SUM(campaign.kpi) \>= scope.kpi_target
  6. 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
  7. Hệ thống check margin:

    IF expected_margin \< scope.margin_target
    → WARNING (có thể override)
  8. Hệ thống tạo các Campaign Plan

  9. 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:

  1. PM chọn scope và click "Add Campaign"
  2. PM nhập thông tin:
    • Campaign details
    • Budget & KPI
    • Timeline
  3. Hệ thống auto-generate campaign_code theo naming convention
  4. Hệ thống validate (same as UC-BDG-01)
  5. 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​

\&lt;Client\&gt;-\&lt;Contract\&gt;-\&lt;Scope\&gt;-\&lt;Channel\&gt;-\&lt;Objective\&gt;-\&lt;Segment\&gt;-\&lt;Phase\&gt;

Ví dụ​

Kewpie-KWP2026-FB01-FB-Lead-Office-P1

Parse thành tokens​

TokenValueMeaning
0KewpieClient name
1KWP2026Contract code
2FB01Scope code
3FBPlatform/Channel
4LeadObjective
5OfficeSegment/Audience
6P1Phase

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 LevelActionNotification
< 80%NormalNone
80-89%WarningEmail to PM
90-94%AlertEmail + Slack
95-99%CriticalEmail + Slack + SMS
>= 100%Auto PauseAll channels + Director

4.3. Use Cases​

UC-GUARD-01: Warning Alert (80%)​

Trigger: Spend >= 80% budget

Main Flow:

  1. Hệ thống detect spend >= 80%
  2. Hệ thống tính:
    days_remaining = end_date - today
    daily_pace_needed = (budget - spend) / days_remaining
    current_daily_pace = spend / days_elapsed
  3. 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.
  4. Email to PM

UC-GUARD-02: Critical Alert (95%)​

Trigger: Spend >= 95% budget

Main Flow:

  1. Hệ thống detect spend >= 95%
  2. 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
  3. 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
  4. Email + Slack + SMS to PM
  5. 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:

  1. Hệ thống detect spend >= 100%

  2. Nếu có Meta Ads API integration:

    • Hệ thống get campaign ID từ mapping table
    • Call Meta API: PATCH /{campaign-id} với status: "PAUSED"
    • Log API response
  3. Hệ thống update campaign_plan.status = "paused"

  4. 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"
    }
  5. 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
  6. 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 GapStatusAction
>= +10%AheadGreat job notification
-5% to +10%On TrackNone
-10% to -5%Slightly BehindWarning email
< -10%BehindAlert + Action required

5.4. Use Case​

UC-KPI-01: KPI Behind Alert​

Trigger: Pace gap < -10%

Main Flow:

  1. 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%
  2. 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
  3. 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​

ConditionAction
Projected profit < 0Block budget increase
Actual margin < Target margin - 10%Warning alert
Actual margin < 0Critical alert + Recommendation to pause
CPA > Break-even CPAWarning + 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:

  1. PM request tăng budget từ 200M → 250M

  2. 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%
  3. Hệ thống check:

    IF projected_margin \< scope.margin_target:
    → BLOCK with explanation
  4. 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.
  5. 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:

  1. PM select scope
  2. Click "Pause All Campaigns"
  3. 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.
  4. PM confirm
  5. Hệ thống call API pause từng campaign
  6. Update status in database

8.2. Bulk Budget Adjustment​

Use Case: Điều chỉnh budget theo % cho nhiều campaign

Main Flow:

  1. PM select multiple campaigns
  2. Enter adjustment: +10% hoặc -15%
  3. 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%)
  4. PM confirm
  5. Hệ thống update budgets
  6. 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