Lifecycle · Draft
Onboarding Provisioning Spec
Purpose
Operational spec for what gets created during onboarding, how plan/SKU drives limits, and which sub-items run per platform — including pixels, catalogs, events by business type, and client-consent social linking.
API method names: onboarding-api-cross-check.md. Process flow: onboarding.md.
1. Plan / SKU entitlements (drive all limits)
Each client contract maps to a plan_id (SKU). The onboarding orchestrator reads plan_entitlements before creating any platform object. Limits are stored on tenant_registry and enforced by guardrails + Cost Guard — not honor-system.
Illustrative plan matrix (tune before launch)
| Entitlement | Starter | Standard | Ecommerce | Ecommerce+Social |
|---|---|---|---|---|
| Channels | Google, Meta | Google, Meta, GA4, CRM | + Merchant, catalog Meta/Google | + TikTok |
| Ad accounts | 1 Google + 1 Meta | Same | + MCA sub-account | + 1 TikTok advertiser |
| Monthly media cap (client-approved) | ₺30k | ₺150k | ₺300k | ₺500k |
| Credit sub-limit (agency pool) | ₺35k | ₺175k | ₺350k | ₺550k |
| Meta ad account spend cap | = sub-limit | = sub-limit | = sub-limit | = sub-limit |
| Optimization cycles / mo | 8 | 24 | 24 | 36 |
| Catalogs | — | — | Google MC + Meta catalog | + TikTok catalog |
| DV360 | — | — | — | Optional add-on |
| Special Ad Category | From onboarding business type → eligibility flag | From onboarding business type → eligibility flag | From onboarding business type → eligibility flag | From onboarding business type → eligibility flag |
# Illustrative — tenant_registry.provisioning
tenant_id: uuid
plan_id: standard_v1
vertical: health
entitlements:
monthly_media_cap_try: 150000
credit_sub_limit_try: 175000
channels: [google_ads, meta, ga4, crm]
catalogs: []
meta_spend_cap_try: 175000
optimization_cycles_per_month: 24
Upgrade path: plan change → orchestrator updates caps (Meta spend_cap, internal guardrails, entitlement row) — does not recreate ad accounts unless channel added.
2. Agency credit line & account limits
Agency master (Kobico ops — once per platform)
Clients never enter payment details. Kobico finance configures agency billing before any tenant onboarding. New ad accounts inherit the master profile. Clients receive Kobico monthly invoices only (ERP).
| Platform | Master instrument | Ops action |
|---|---|---|
| Google Ads | MCC monthly invoicing + Kobico entity identity verify | Pre-configured; shells inherit; MCC Verification Hub bulk — PRE-1, PRE-7 |
| Meta | Extended credit + Kobico entity business verify on BM | Finance + Meta UI — one-time — PRE-2, PRE-8 |
| TikTok | BC prepaid + Kobico entity business verify | BC admin — one-time — PRE-3, PRE-9 |
| DV360 | GMP invoicing | Sales contract — PRE-6 |
Per-tenant (automated from plan_id + billing source)
| Control | Where enforced | API / system |
|---|---|---|
| Credit sub-limit | tenant_registry |
Internal; reconcile vs platform spend nightly. If prepay: set from parent billing internal API balance (ADR 0004); else finance-owned source TBD |
| Meta ad account spend cap | Ad account | POST /act_{id} spend_cap (minor units) |
| Google monthly guardrail | Optimization + QC | Internal qc.spend vs plan — no account-level Google cap API |
| TikTok advertiser budget | BC / advertiser | Advertiser update APIs where available + internal guardrail |
| Block spend over cap | Orchestrator | Pause campaigns + HITL A3 if breach attempted |
Budget lifecycle (programmatic — not billing warnings)
| When | Action | Billing warning? |
|---|---|---|
| Account create | spend_cap (Meta) + tenant_registry caps |
No — inherits agency payer |
| Plan approved | Apply channel/campaign budgets via platform APIs | No — amounts from plan_version |
| Optimization / revise | Mutate budgets within guardrails + qc.spend |
No |
| Client invoice | Kobico ERP monthly | No — separate from platform APIs |
ONB-11: tenant provisioned without credit_sub_limit or monthly_media_cap → block client.onboarding.completed (per-tenant config bug — not agency billing).
Never ONB for: MCC monthly invoicing, Meta credit, TikTok BC funding, Kobico-entity business verification — those are PRE-* one-time (cross-check).
Agency business verification (Kobico entity)
| Platform | Default | Submit path | Per-client ONB? |
|---|---|---|---|
| Google Ads | Kobico entity on MCC | MCC Verification Hub (bulk) + API status poll | No — PRE-7 |
| Meta | Kobico entity on BM | Business Settings (one-time) | No — PRE-8 |
| TikTok | Kobico entity on BC | TikTok for Business UI (one-time) | No — PRE-9 |
Shell accounts inherit verified agency masters. Domain verification (client website DNS) is a separate, optional per-tenant step — not business entity docs.
3. End-to-end provisioning flow
4. Vertical templates — pixels, events, catalogs
Onboarding Agent applies provisioning_template.{vertical} — not one-size-fits-all.
Event sets by business type
| Vertical | GA4 key events | Google Ads conversions | Meta Pixel + CAPI | TikTok Events API | Catalog |
|---|---|---|---|---|---|
| Health | book_appointment, generate_lead, contact |
Import from GA4 + call/lead actions | Lead, Schedule, Contact |
SubmitForm, Contact |
— |
| School | sign_up, generate_lead |
Lead + signup | Lead, CompleteRegistration (Special Ad Category: NONE by default — schools are not a special category; apply HOUSING only for student housing, EMPLOYMENT only for jobs/training-to-employment) |
SubmitForm |
— |
| Tourism | generate_lead, purchase, contact |
Lead + purchase | Lead, Purchase, InitiateCheckout |
CompletePayment |
Optional destination catalog |
| Ecommerce | purchase, begin_checkout, add_to_cart |
Purchase ROAS + MC feed | Purchase, AddToCart + catalog |
CompletePayment, AddToCart + catalog |
Required Google MC + Meta |
Sub-items created per template (checklist)
| Sub-item | Health | School | Tourism | Ecommerce |
|---|---|---|---|---|
| Google conversion actions | ✅ | ✅ | ✅ | ✅ + MC link |
| Meta Pixel | ✅ | ✅ | ✅ | ✅ |
Meta browser event template in implementation_pack |
✅ | ✅ | ✅ | ✅ |
| Meta CAPI relay endpoint | — v2 | — v2 | — v2 | — v2 |
Kobico Relay (tracking_relay) |
— v2a | — v2a | — v2a | — v2a |
| Meta catalog | — | — | ⚠️ | ✅ |
| Meta offline event set | — v2 CRM | — v2 | — v2 v2 | — v2 |
| TikTok pixel | if SKU | if SKU | if SKU | if SKU |
| Merchant data source | — | — | — | ✅ |
| Special Ad Category flags | only if ad concerns finance/employment | only if ad concerns housing/employment/finance¹ | only if applicable | only if applicable |
¹ Special Ad Categories are only HOUSING, EMPLOYMENT, FINANCIAL_PRODUCTS_SERVICES (replaced CREDIT Jan 2025), ISSUES_ELECTIONS_POLITICS. No vertical defaults to a category — the flag is set per-ad only when the creative/offer actually concerns one of those topics. Health and schools default to NONE. See meta-ads — Compliance notes.
Templates versioned in playbook.provisioning.{vertical}; changes require ops publish + audit.
5. Meta + Instagram linking (client consent, minimal friction)
Goal: Client links owned Facebook Page + Instagram Professional account to Kobico BM without manual Business Manager email ping-pong where possible.
Client portal flow (“Connect Meta & Instagram”)
- Client already accepted ToS + data-sharing + Meta asset access (records
consent_id, scopes, timestamp). - Client clicks Connect → Facebook Login for Business (or Meta Business Login) with Kobico app.
- Requested permissions (minimize):
pages_show_list,pages_read_engagement,pages_manage_metadata,business_management,instagram_basic,instagram_manage_insights(exact set TBD at app review). - Client selects Page + linked Instagram account in OAuth UI (Meta-hosted — user consent).
- Backend receives short-lived token → exchanges → calls Marketing API:
| Step | API | Auto |
|---|---|---|
| List client Pages | GET /me/accounts or Business Asset API |
✅ |
| Verify Page admin | GET /{page-id}?fields=perms |
✅ |
| Share Page with Kobico BM | POST /{page-id}/agencies or partner share |
⚠️ |
| Link IG to ad account | POST /act_{ad-account-id}/instagram_accounts |
✅ |
| Page for ads | shared_page_id on owned_businesses → verify GET /{child_bm}/client_pages |
✅ |
Store asset IDs on onboarding_record |
Internal registry | ✅ |
Not required: client admin on Kobico BM; client never receives ad account ownership.
Instagram-only or Page-less clients
| Case | Path |
|---|---|
| Client has Page + IG | Preferred flow above |
| Page only, no IG | Meta ads without IG placement until IG linked |
| IG only | ⚠️ Must connect via Meta Business Suite; may need human |
| Kobico-managed Page (rare) | Skip client link; ops creates Page under agency |
5b. Meta 2-Tier child BM provisioning
Decision: ADR 0003 — child BM per client for all tenants (2-Tier BM).
Sources: 2-Tier overview · Setup child BM · Onboard at scale · owned_businesses
Why client OAuth is required for child BM
Creating a child BM uses the client’s user access token from Facebook Login — not the parent BM system user token.
| Step | Token | API |
|---|---|---|
| Client Connect (§5) | User access token | Facebook Login for Business |
| Create child BM | Same user token | POST /{parent_bm_id}/owned_businesses with shared_page_id |
| Create system user in child BM | BM admin context | System users API |
| Ad account, pixel, ads, CAPI | Child BM system user | Marketing API on child_bm_id / act_* |
Provisioning sequence (automated after OAuth)
| Order | Sub-item | API | Auto |
|---|---|---|---|
| 1 | Client OAuth + Page (+ IG) pick | Facebook Login for Business | ⚠️ Client UI |
| 2 | Create child BM | POST /{parent_bm_id}/owned_businesses |
✅¹ |
| 3 | Share parent LOC + spend limit to child | Credit sharing APIs | ✅² |
| 4 | Create Admin system user in child BM | POST /{child_bm_id}/system_users |
✅ |
| 5 | Generate system user token | POST /{child_bm}/access_token — scope: ads_management,ads_read,business_management,catalog_management (fallback if App Review pending) |
✅ |
| 6 | Create ad account in child BM | POST /{child_bm_id}/adaccount |
✅ |
| 7 | Set spend_cap from plan | POST /act_{id} |
✅ |
| 8 | Pixel, CAPI, catalog, offline set | Marketing API (child token) | ✅ |
| 9 | Link Page + IG | Page via owned_businesses + shared_page_id → verify GET /{child_bm}/client_pages. IG: instagram_accounts if needed |
✅ |
Page linkage
| Step | Detail |
|---|---|
| Create | shared_page_id on owned_businesses → Page appears on GET /{child_bm}/client_pages with ADVERTISE task |
| Verify | client_pages contains OAuth Page ID |
| Campaigns | promoted_object.page_id from registry |
See dev runbook §1b.
¹ Requires PRE-10 (2-Tier API access via Meta rep). ² Requires PRE-2 extended credit on parent BM.
Development vs production
| Mode | Behavior |
|---|---|
| App Development mode | Test full 2-Tier flow; Meta typically allows ~2 child BMs until business_management app review — enough to validate OAuth → child BM → system user → ad account |
| Production | Child BM per client; confirm per-user / per-page limits with Meta rep at PRE-10 |
Store on tenant_registry: parent_bm_id, child_bm_id, child_system_user_id, shared_page_id, meta_catalog_id, meta_product_set_id (ecommerce SKU).
Dev verification (Jun 2026)
See ADR 0003 dev verification and meta-dev/README.md. Confirmed in Development mode:
- Child BM → child system user → ad account → pixel (child system user throughout).
- Billing (dev): card on child BM; ad account created without explicit
funding_id. Production: parent LOC share (owning_credit_allocation_configs) — PRE-2. - Catalog (ecommerce):
POST /{child_bm_id}/owned_product_catalogs(child token,catalog_management) +POST /{catalog_id}/product_sets+POST /{catalog_id}/product_feeds+POST /{feed_id}/uploads. Requires Catalog API App Review + PRE-8 on Kobico parent BM before automation. Registry:meta_catalog_feed_id,meta_catalog_feed_url. - Human BM UI: not required for automation; assign
business_usersADMIN via API if finance UI needed for ops/debug.
6. Platform provisioning packages
6.1 Google Ads package
| Order | Sub-item | From plan/vertical |
|---|---|---|
| 1 | create_customer_client under MCC |
Always |
| 2 | Currency / timezone from client intake | Always |
| 3 | Auto-tagging on | Always |
| 4 | Conversion actions from vertical template | Vertical |
| 5 | Enhanced conversions config | Health, ecommerce |
| 6 | Link GA4 property | Standard+ |
| 7 | Link Merchant Center | Ecommerce |
| 8 | Google Ads → Kobico BQ export | Always |
| 9 | Apply internal monthly_media_cap guardrail |
From plan |
6.2 Meta package
v1 publish (implementation pack spec) · CAPI + offline = v2
| Order | Sub-item | From plan/vertical | Phase |
|---|---|---|---|
| 1 | 2-Tier: child BM → child system user → ad account | Always | v1 |
| 2 | Set spend_cap from credit_sub_limit |
Plan | v1 |
| 3 | System user + assigned_users on ad account |
Always | v1 |
| 4 | Create Pixel + attach to account | Always | v1 |
| 5 | Verify Page on child BM (client_pages) + IG link |
Consent §5 | v1 |
| 6 | Catalog + feed + product set | Ecommerce | v1 |
| 7 | Auto-generate implementation_pack (pixel snippets + vertical events + UTM + domain verify) |
Vertical | v1 |
| 8 | Register CAPI relay + test event | Always | v2 |
| 9 | Offline event set | CRM SKU | v2 |
| 10 | Domain verification guide in pack (client executes) | If required | v1 doc / client |
6.3 TikTok package (if SKU)
| Order | Sub-item | From plan/vertical |
|---|---|---|
| 1 | Create advertiser in BC | SKU |
| 2 | Assign advertiser to Kobico Live app (pre-launch prerequisite) | SKU |
| 3 | OAuth advertiser authorization | SKU |
| 4 | Create pixel + Events API template events | Vertical |
| 5 | Catalog link | Ecommerce SKU |
| 6 | BC funding check | Ops |
6.4 GA4 package — ⏸ deferred (onboarding v1)
Not provisioned during onboarding v1. When enabled: property access, streams, key events, Ads link — see ga4-source-of-truth.md.
6.4b Implementation guide (Phase 1 — always)
Source of truth: Onboarding implementation pack — orchestrator buildImplementationPack(vertical); not hand-written per client.
| Order | Sub-item | Phase |
|---|---|---|
| 1 | Meta Pixel ID + vertical browser event snippets | v1 |
| 2 | UTM templates + click-ID capture for CRM | v1 |
| 3 | Domain verification steps (Meta owned domains) | v1 |
| 4 | Google conversion action IDs + enhanced conversion notes | v1 |
| 5 | TikTok Pixel + Events API (if SKU) | v1 |
| 6 | GTM container import JSON (client publishes) | v1 |
| 7 | CAPI relay URL + test events | v2 |
| 8 | Offline / CRM import mapping | v2 |
6.5 Merchant Center package (ecommerce)
| Order | Sub-item |
|---|---|
| 1 | MCA sub-account |
| 2 | Link Ads customer |
| 3 | Primary data source + test feed pull |
| 4 | Policy status check |
6.6 CRM package
| Order | Sub-item |
|---|---|
| 1 | Register webhook URL + signing secret |
| 2 | Map CRM event types → platform routes per vertical |
| 3 | Send test qualified_lead with gclid |
6.7 Cross-cutting sub-items
| Sub-item | When |
|---|---|
| UTM schema doc generated | Always |
onboarding_record.platform_ids populated |
Per platform |
| Tracking health probe (GA4 Data API + pixel test events) | Pre complete |
| Special Ad Category / compliance flags in registry | From business type at onboarding (ADR 0004) |
| Removed — no organic feed posting; paid dark-post / boost only (ADR 0004) |
7. Client consent surfaces (one portal, multiple gates)
| Consent | Captures | Unlocks |
|---|---|---|
| Kobico ToS | Legal | Any work |
| Data sharing / subprocessors | GDPR/KVKK scope | Tracking + CAPI |
| Media authorization | Spend within approved caps | Launch (later phase) |
| Connect Meta & Instagram | Page/IG asset access | Meta creative + social placements |
| Connect GA4 (if client-owned) | Editor invite acceptance | SoT reporting |
| DNS / domain (optional delegate) | Domain verification | Meta/Google optimization events |
All consents → consent_record with version, actor, timestamp; linked to onboarding_record.
8. Outputs (expanded onboarding_record)
{
"tenant_id": "uuid",
"plan_id": "standard_v1",
"vertical": "health",
"entitlements": { "monthly_media_cap_try": 150000, "credit_sub_limit_try": 175000 },
"platform_ids": {
"google_ads_customer_id": "1234567890",
"meta_ad_account_id": "act_...",
"meta_pixel_id": "...",
"meta_page_id": "...",
"meta_ig_id": "...",
"meta_catalog_id": null,
"meta_catalog_feed_url": null,
"ga4_property_id": "...",
"merchant_center_id": null
},
"implementation_pack": {
"schema_version": "1.0",
"artifact_uri": "gs://.../implementation_pack.json",
"generated_at": "2026-06-14T12:00:00Z"
},
"templates_applied": {
"provisioning": "health_v3",
"events": "health_v3"
},
"consents": ["tos_v2", "data_share_v1", "meta_assets_v1"],
"tracking_checklist": { "ga4": "pending", "meta_pixel_browser": "pending", "capi": "v2_deferred" },
"tracking_relay": {
"enabled": false,
"delivery_mode": "first_party",
"cname_host": null,
"loader_url": null,
"cmp_mode": "kobi_cmp",
"cmp_vendor": "kobi",
"cmp_partnership_id": null,
"consent_profile": "tr_kvkk",
"platform": null,
"enabled_modules": [],
"privacy_policy_url": null,
"banner_locales": ["tr", "en"],
"google_consent_mode": true
}
}
tracking_relay (Phase 2a+): Populated when client opts into Relay SKU. Defaults: cmp_mode = kobi_cmp, cmp_vendor = kobi, delivery_mode = first_party. Set cmp_mode = client_cmp + vendor when BYO CMP; kobi_bundled_cmp + cmp_partnership_id when leadership closes a global CMP partnership or interim portfolio bundle. See ADR 0005.
9. Agent vs client vs ops
| Action | Onboarding Agent | Client (portal) | Kobico ops |
|---|---|---|---|
| Create ad accounts | ✅ | — | — |
| Set spend cap from plan | ✅ | — | — |
| Create pixel / catalog / feed | ✅ | — | — |
| Generate implementation_pack (vertical) | ✅ | Installs snippets | — |
| Connect Meta + IG | API after | Consent + OAuth pick | Fallback partner invite |
| Agency credit line | — | — | ✅ Finance |
| Implementation guide | ✅ API generates | Client installs on site | — |
| GTM publish | ⏸ deferred | Client uses guide template later | — |
| Go-live | Recommend | — | Approve if configured |
10. Related documents
- Onboarding implementation pack — auto-generated client guide per vertical; v1/v2 split
- Onboarding client portal — client-facing screens and completion summary
- ADR 0005: k.js relay micro-modules & CMP
- Onboarding — SLA, process diagram
- Onboarding API cross-check — endpoint-level matrix
- Platform access & API readiness
- Meta Ads
- Data & tracking — UTM + event taxonomy
- Human-in-the-loop — A4 access approvals