Acme Marketing Architecture

Marketing Data Ingestion Architecture — Simplicity Grade

Marketing Data Ingestion Architecture — Simplicity Grade

Target Architecture Proposal for Acme Marketing Group

Author: Kiril Iliev, Enterprise Architect
Version: 2.0 (simplified; replaces v1.0 and v1.1)
Status: Draft for review. The decisions in 02-Architectural-Rationales.md are Proposed until the architect confirms them.
Deliverable Mapping: Addresses the case scenario "Marketing Data Ingestion Architecture for Acme Marketing Group" (a fictional company)
Audience: A marketing company with a small team. The goal is the least architecture that is still reliable and privacy-aware. The Enterprise grade is the opposite end of the scale.


1. Summary

Acme wants Salesforce, HubSpot and Google Ads data in one place for reporting, campaign attribution and alerts.

The design has four moving parts and no server to babysit:

  1. Cloud Scheduler triggers three schedules.
  2. Cloud Run jobs run one container image: adapters pull the data, a transform job cleans it.
  3. Cloud Storage holds the raw files and the Silver/Gold tables.
  4. BigQuery serves the Gold tables to Looker Studio or Power BI.

There is no orchestration server, no message queue, no webhook endpoint and no separate network layer. Indicative cost is about $5–25 per month (section 7), mostly inside Google Cloud's free tiers.

1.1 Decisions at a glance

Question Decision Record
Cloud Google Cloud (recommended default for a marketing agency; hosting options in section 12) ADR-S01
Compute Cloud Run jobs, scale to zero ADR-S01
Orchestration Cloud Scheduler triggers jobs; no orchestration server. Dagster is the upgrade path ADR-S02
Code Python DataFrames, notebook-friendly modules, pytest ADR-S03
Storage Cloud Storage; Silver/Gold as Delta tables written with delta-rs; no Spark ADR-S03
Sources One thin adapter class per source ADR-S04
Privacy Keyed HMAC pseudonyms, no names in Silver, 21-day raw retention, erasure script ADR-S05
Serving Gold loaded into BigQuery; Looker Studio (free) or Power BI ADR-S06

2. Architecture

The simple picture

flowchart LR
    S["<b>Your tools</b><br/>Salesforce, HubSpot,<br/>Google Ads"] -->|"every 30 min"| J["<b>Small scheduled job</b><br/>Cloud Run"]
    J --> D[("<b>Data store</b><br/>Cloud Storage")]
    D --> B[("<b>Reports database</b><br/>BigQuery")]
    B --> R["<b>Dashboards</b><br/>Looker Studio or Power BI"]
    J -. "if something fails" .-> A["<b>Alert</b><br/>e-mail or Slack"]

The same thing in more detail

Three storage zones: Landing (raw JSONL, deleted after 21 days), Silver (conformed, pseudonymised) and Gold (star schema, loaded into BigQuery for reporting).

flowchart TD
    subgraph Sources["Source platforms"]
        SF["Salesforce"]
        HS["HubSpot"]
        GA["Google Ads"]
        NEW["Future sources"]
    end

    SCH["Cloud Scheduler<br/>3 schedules"]

    subgraph Run["Cloud Run jobs (one image)"]
        SYNC["sync job<br/>source adapters"]
        BUILD["build job<br/>Silver and Gold"]
    end

    subgraph GCS["Cloud Storage"]
        LAND["Landing<br/>raw JSONL, 21-day lifecycle"]
        LAKE["Silver and Gold<br/>Delta tables"]
    end

    SM["Secret Manager<br/>API tokens, pseudonym key"]
    BQ["BigQuery<br/>Gold tables"]
    BI["Looker Studio or Power BI"]
    MON["Cloud Monitoring<br/>failure alert to email or Slack"]

    SCH --> SYNC
    SCH --> BUILD
    SF --> SYNC
    HS --> SYNC
    GA --> SYNC
    NEW --> SYNC
    SYNC --> LAND
    LAND --> BUILD
    BUILD --> LAKE
    BUILD --> BQ
    BQ --> BI
    SM --> SYNC
    SM --> BUILD
    SYNC --> MON
    BUILD --> MON

3. Ingestion Strategy per Source

Aspect Salesforce HubSpot Google Ads
Access REST query (follows nextRecordsUrl); Bulk API 2.0 for the first load CRM Search API v3 GAQL via googleAds:searchStream
Approach Incremental on SystemModstamp, no LIMIT Keyset paging: modified-date window plus hs_object_id > last_id, 200 per page Trailing 30-day pull by segments.date
Why SystemModstamp also catches system updates. A LIMIT would end the result set and truncate the window. Search is capped at 10,000 results per query; keyset paging never reaches it. Metrics restate after the fact; re-pulling overwrites old values.
Push or poll Poll Poll (webhooks are an optional later accelerator) Poll only
Deletes queryAll returns IsDeleted rows archived objects status = REMOVED
Modified-date field SystemModstamp Contacts: lastmodifieddate; others: hs_lastmodifieddate segments.date

All adapters share retry with full-jitter backoff, a token-bucket rate limiter, one automatic token refresh on HTTP 401, and an exception (not a silent partial result) if a source reports more data without a cursor.

📝 Possible simplification to evaluate: Google Cloud's BigQuery Data Transfer Service has a Google Ads connector. If it covers the needed reports, it could replace the Google Ads adapter entirely. Check its report coverage and cost before building the adapter.


4. Schedules

Three Cloud Scheduler triggers, which fits the free tier of three jobs.

Schedule Cadence What runs Business need
CRM sync every 30 minutes Salesforce and HubSpot incremental sync, then Silver Sales sees new leads and deals within about 30 minutes
Ads sync hourly Google Ads trailing window, then Silver; pacing check Budget pacing; intraday numbers are preliminary
Daily build 06:00 UTC Closed-day ads numbers, Gold build, load into BigQuery, reconciliation Finalised numbers for ROI and attribution

A weekly run of the daily job also re-pulls a 90-day ad window to catch late attribution and checks source ids for hard deletes.

📝 Assumption: 30 minutes is a target to validate with Acme's sales team. Hourly is simpler and cheaper if it is enough.


5. Reliability, Recovery, Idempotency & Reconcile


6. Historical Backfill vs. Incremental Sync

  1. Backfill: run the sync in 30-day chunks over the history (Salesforce Bulk API 2.0 for large objects), then build Silver and set the watermark. It is a manual run of the same job with a date range.
  2. Incremental: each scheduled run extracts from the watermark to now minus 5 minutes.

7. Cost

⚠️ To validate: planning estimates from public Google Cloud list prices and the assumed run profile. Confirm with the Google Cloud Pricing Calculator for the chosen region before quoting them.

Component Basis Estimate (USD / month)
Cloud Run jobs About 5,300 vCPU-seconds per day for syncs plus a 30-minute daily build; mostly inside the monthly free grant 0 – 5
Cloud Scheduler 3 jobs (3 are free per billing account) 0 – 1
Cloud Storage About 100 GB landing and Delta, plus operations 2 – 6
BigQuery Small Gold tables; storage and queries inside the free tier 0 – 5
Secret Manager A handful of secrets 0 – 1
Logging and monitoring Normally inside the free allotment 0 – 5
Artifact Registry One image < 1
Looker Studio / Power BI Free / existing licences 0
Total about 5 – 25

For comparison, the smallest realistic Microsoft Fabric capacity (F2) lists at about $263 per month (pay-as-you-go, US region). The saving is an order of magnitude on infrastructure.

What the saving costs: an engineer builds and owns the pipeline. If Acme has nobody for that, buying a managed connector service is the cheaper total (section 12, option E).


8. Source Limits

The base adapter handles these once.


9. Privacy and GDPR

📝 Position: keyed pseudonymisation reduces risk but does not make data anonymous. Pseudonymised data stays personal data under GDPR (Recital 26). The design minimises what is kept and makes erasure reliable; it does not claim exemption.

9.1 What reaches Silver

Field class Examples Landing (21 days) Silver / Gold
Identifier used for joins e-mail, phone verbatim keyed HMAC pseudonym only
Identifier not needed names, address, job title verbatim dropped
Free text notes, descriptions verbatim dropped
IP address verbatim dropped or country only
Marketing attributes lifecycle stage, source, campaign, first-touch URL verbatim kept

⚠️ Requires stakeholder input: Acme's data protection contact confirms this classification, the lawful basis and the maximum erasure time (assumed one month).

9.2 Pseudonymisation

pseudo_id = HMAC-SHA256(key, normalised value). The key is a Secret Manager secret; if it is missing the job fails, there is no default. The key is not rotated routinely because every pseudonym would change and joins would break; on a compromise, issue a new key version and reload from the sources. Only the job's service account can read the key.

9.3 Erasure on request

  1. Run the erasure script with the person's e-mail. It writes the pseudonym to an erasure ledger (no plaintext) and deletes the person from Silver and Gold. The next Gold load removes them from BigQuery.
  2. The ledger makes sure that a replay from landing cannot bring them back.
  3. Landing files expire by lifecycle rule within 21 days; Delta file history is removed by VACUUM after 7 days. Worst case about 28 days, inside one month.
  4. Note the request, completion date and who ran it.

Source-side privacy deletions (HubSpot, Salesforce) arrive as is_deleted rows; for those the same script path also adds the ledger entry.


10. Serving Layer

⚠️ To validate: the BigQuery loader (google-cloud-bigquery, about 10 lines) is not part of the reference skeleton.


11. Data Model & Attribution

Table Grain Key
dim_campaign campaign per platform campaign_key = <channel>:<campaign_id>
dim_customer pseudonymised person email_pseudo_id
fact_daily_spend campaign × day campaign_key, metric_date
fact_lead lead or contact contact_id, source
fact_attribution lead × touch contact_id, campaign_key, touch_ts

Spend is joined to leads through the identifiers captured at the touch: gclid and UTM parameters stored with the HubSpot contact and the Salesforce lead, plus a mapping from UTM campaign values to campaign_key. Default rule: last non-direct touch within 30 days, with first touch kept alongside.

⚠️ Requires stakeholder input: marketing confirms the rule and that gclid/UTM capture is in place in both CRMs. Without it fact_attribution cannot be built. The skeleton implements dim_campaign and fact_daily_spend; fact_attribution is the next build item.


12. Hosting Options and Why Google Cloud

The pattern is the same everywhere: a scheduler, a container job, object storage, a secret store and a place to serve reports. Only the product names change.

Component Google Cloud (recommended) Azure AWS
Scheduler Cloud Scheduler Container Apps job schedule EventBridge Scheduler
Job runner Cloud Run jobs Container Apps jobs ECS Fargate scheduled task or Lambda
Object storage Cloud Storage ADLS Gen2 / Blob S3
Secrets Secret Manager Key Vault Secrets Manager
Serving BigQuery + Looker Studio Power BI Import or Synapse serverless Athena / Redshift + QuickSight
Alerts Cloud Monitoring Azure Monitor CloudWatch
Option Fits when Main drawback
A. Google Cloud (recommended) Acme is a marketing agency using Google Ads, GA4, Workspace or Looker Studio New ecosystem if the company is Microsoft-based
B. Azure Acme is a Microsoft 365 / Power BI company More configuration than Cloud Run, and BigQuery's built-in serving is missing
C. AWS Acme already runs on AWS and has staff for it Most services to wire together; serving is not built in
D. GitHub Actions on a schedule Very small volume, pilot or proof of concept Time limits, runner reliability, weaker secret and storage story
E. Buy a connector service (Fivetran, Airbyte Cloud, Supermetrics) plus BigQuery No engineer to own the pipeline Monthly fee that grows with volume; custom privacy handling is limited

Why Google Cloud is the recorded default. We do not yet know Acme's stack. A marketing agency very likely has Google Ads, probably GA4 or Workspace, and Looker Studio is free. BigQuery serves reports with plain SQL, so there is no extra serving component, and Cloud Run jobs plus Cloud Scheduler is the smallest runtime of the three clouds. The code is cloud-neutral (Python, containers, open table format), so changing cloud means replacing the storage sink, the secret client and the deploy script.

⚠️ Requires stakeholder input: ask Acme whether they run on Microsoft 365 / Azure or already have a cloud account. A Microsoft shop with Power BI points to option B; a team with no engineer points to option E.


13. Adding a New Source

  1. Write a subclass of BaseSourceAdapter that implements _fetch_records (one page) and, if tokens expire, _auth_headers and _refresh_credentials (1–2 days). Paging, retries, rate limiting, landing and provenance are inherited.
  2. Add it to the sync schedule (minutes).
  3. Map it into Silver and classify its fields (section 9.1) before data reaches Silver (about 1 day).
  4. Backfill (an hour plus run time).

14. Operations


15. Assumptions, Risks & Clarifications

Assumptions: volumes stay in the low millions of CRM rows and tens of millions of ad rows a year; reporting is by dashboard and alerts; Acme can name one person who owns the pipeline.

Risks and mitigations


16. Conclusion

Four moving parts (a scheduler, container jobs, a bucket and BigQuery) give Acme timely data, safe replays, privacy-aware storage and an easy way to add sources, for about $5–25 per month. Everything heavier in the Enterprise grade (orchestration server, event bus, private networking, formal governance) is deliberately left out and can be added later if Acme grows into it.