Major

Automate HubSpot GA4 Campaign Anomaly Briefs

Connect HubSpot campaign context to GA4 reporting, then turn meaningful traffic and conversion changes into a reviewable daily brief instead of another manual report.

Ritvij Gautam
Marketing operations manager reviewing campaign performance analytics on a laptop

TL;DR: what you'll build. Marketing operations teams run campaigns in HubSpot but only catch a traffic or conversion swing when someone remembers to pull a GA4 report days later. This article shows how to build a Major app that pulls daily Google Analytics 4 Data API reports for each HubSpot campaign's UTM parameters, has an agent compare the numbers against rolling baselines, and routes a drafted anomaly brief to the campaign owner for same-day review. The result: a HubSpot GA4 integration that surfaces changes while they're still actionable, not at month-end.

The marketing problem and who owns it

A demand generation or marketing operations manager usually owns this gap. They run campaigns through HubSpot, tagging landing pages and emails with UTM parameters, and report on performance using Google Analytics 4. The two systems don't talk to each other automatically.

So the workflow today looks like this: someone logs into GA4 once a week, pulls a report filtered by campaign source and medium, and eyeballs it against what they remember from last week. If a landing page's conversion rate drops 40% on a Tuesday, nobody notices until the weekly or monthly readout, by which point ad spend has kept flowing into a page that stopped converting.

This is a volume and timing problem, not a tooling gap. A team running a dozen active campaigns can't reasonably eyeball GA4 for all of them every day. The reporting pass that would catch an anomaly quickly is exactly the kind of repeatable, rule-based check that doesn't need a person doing it manually, and doesn't need fresh AI reasoning either, once the comparison logic is set.

This is a marketing-operations use case, rolling up under Major's AI agents for marketing hub, and because it touches a CRM-adjacent system it also fits Major's broader AI agents for business coverage. If your team already runs agents for other HubSpot workflows, this reuses the same connector setup described in AI agents for HubSpot.

Major's fit here is straightforward: a managed app holds the campaign-to-UTM mapping and daily measurement history, so the deterministic parts (pulling the report, computing a rolling average, checking a threshold) run as code every day without burning a model call. The agent only gets pulled in when a number crosses a threshold, and its job is to interpret the exception, not re-derive the pipeline each morning.

What the systems can actually tell you

Before building anything, separate what each tool is actually built for. HubSpot and GA4 serve different jobs here, and conflating them is the most common mistake teams make when searching for a "HubSpot GA4 integration."

HubSpot: campaign context, not traffic data

HubSpot's Campaigns API exposes campaign metadata: a campaign's name, UTM parameters, associated assets (emails, landing pages, ads), and summary performance metrics HubSpot tracks. The read endpoint is GET /marketing/v3/campaigns/{campaignGuid}, and the list endpoint is GET /marketing/v3/campaigns/, supporting name filtering and pagination via limit and after. Reading campaigns requires the marketing.campaigns.read scope.

Authentication is OAuth 2.0 for multi-account apps, or a static Bearer token from a Private App for a single account. HubSpot's Webhooks (journal) API covers object, association, and app lifecycle events, but campaign-level webhooks aren't the primary path here since this workflow runs on a schedule, not in reaction to campaign edits. Rate limits scale by tier: Free and Starter accounts get 100 requests per 10 seconds and 250,000 per day; Professional and Enterprise get 190 requests per 10 seconds and up to 1,000,000 per day.

One honest gotcha: HubSpot's native "Integrate with Google Analytics 4" setting, documented at Integrate Google Analytics with HubSpot content, does not import GA4 reports into HubSpot. It does the opposite: it adds a GA4 measurement ID or tracking snippet to HubSpot-hosted pages so Google Analytics can collect visitor data there. If you're searching for a way to see GA4 numbers inside HubSpot, this setting alone won't get you there.

Google Analytics 4: aggregate reporting, not individual sessions

GA4's Data API is a pull-based reporting API, not a webhook source. The core endpoint for this build is POST https://analyticsdata.googleapis.com/v1beta/{property}:runReport, documented at the runReport reference. A request specifies dateRanges, dimensions (session source, medium, campaign), and metrics (sessions, conversions). There's also a runRealtimeReport endpoint, documented at runRealtimeReport, useful for spot-checking current activity but not the source for the daily baseline, since realtime data lacks the same dimensional depth and historical consistency.

Authentication uses OAuth 2.0, usually service-account credentials for a server-side scheduled job, with the analytics.readonly or analytics scope. Responses default to 10,000 rows and allow up to 250,000 per request, with offset and limit for pagination. GA4 enforces property- and project-level quotas rather than a flat request-rate limit; set returnPropertyQuota on a request to check usage before hitting a ceiling.

A webhook is a doorbell: a tool rings you when something changes, so you don't keep checking the door. GA4 has no doorbell for this use case; there's no event that fires when a conversion rate drops, so the only option is to check on a schedule and compare what you find each time.

The matching problem: UTMs are not a join key you get for free

Neither API will tell you that GA4 session source=linkedin, medium=cpc, campaign=q4-webinar is the same thing as HubSpot campaign ID 48291, named Q4 Webinar Push. You have to build and store that crosswalk yourself, because UTM values get typed by hand or by different tools, and a stray dash or capitalization change silently breaks a naive string match.

A privacy note worth naming

This workflow deals with aggregate traffic and conversion counts, not individual contact records, so HIPAA- or financial-record-style rules don't apply directly. What does apply is consent governance under frameworks like the EU's GDPR Articles 6 and 7 and the California Consumer Privacy Act / CPRA. The practical requirement: if HubSpot's consent settings block tracking for unconsented visitors, GA4 numbers reflect that smaller population. Don't read a drop as a campaign failure when it might be a consent-banner change; the agent should flag this as a possible cause, not assume causality.

Architecture: app, agent, workflow

Split the build into three pieces, each doing one job.

The workflow is the scheduled, deterministic backbone. It runs once a day at a fixed property-local time, fetches the active campaign list from HubSpot, pulls the prior day's GA4 report for each campaign's UTM combination, writes the raw numbers to the app's tables, computes rolling 7-day and 28-day baselines, and checks each campaign against a configured minimum-volume and percent-change threshold. None of this needs a model; it's arithmetic and API calls that should run the same way every day.

The agent only gets invoked for campaigns that cross the threshold. Its job is narrow: given a flagged observation and its baseline history, draft a short brief naming what changed, a likely cause (traffic source shift, device mix, landing page change, seasonality), a confidence level, and what a human should check before acting. The agent never delivers a brief on its own and never claims a cause is proven. This is the one step that benefits from judgment rather than a fixed rule, because "why did this change" doesn't reduce to a formula.

The app is the system of record and the human's screen. It holds the campaign-to-UTM crosswalk, the daily observation table, the baseline computation, and a review queue where the marketer sees each drafted brief, edits it if needed, and approves or dismisses it. The app is also what makes this workflow stateful: without it, every run would re-derive the baseline from scratch, which is wasteful and inconsistent.

Architecture diagram showing HubSpot and GA4 connectors feeding a Major app with campaign mapping and baseline tables, an agent drafting anomaly briefs, and a decision gate before delivery

HubSpot GA4 campaign anomaly brief architecture: workflow, app, and agent

Putting the threshold check in the workflow and the interpretation in the agent is deliberate. The smartest version of this pipeline uses the least AI it can: a fixed percent-change-against-baseline rule runs for free every day and never drifts. The agent's reasoning is reserved for the step that needs it: explaining a number, not computing one.

Build a HubSpot GA4 anomaly brief on Major

Here's the concrete sequence to build this, in the order you'd actually do it.

  1. Connect the HubSpot and Google Analytics 4 connectors once, as IT. Add the HubSpot connector with a Private App token scoped to marketing.campaigns.read (and crm.objects.notes.write if briefs attach to a supported HubSpot record), and a custom connector for the GA4 Data API using a Google Cloud service account scoped to analytics.readonly. Both credentials live in Major's central credential store, governed by IT, never in agent prompts or app code. You should see both connectors listed as resources any app or agent in the org can reference.
  2. Build the app that holds state. Create a Campaign Watch app with three managed tables: campaignmap (HubSpot campaign ID, campaign name, normalized UTM source/medium/campaign, GA4 property ID, owner), dailyobservations (campaignmap ID, report date, sessions, conversions, device breakdown), and baselines (campaignmap ID, rolling 7-day average, rolling 28-day average, last computed date). Add a review screen listing flagged observations with their drafted brief and an approve/edit/dismiss action. You should see a table of mapped campaigns and an empty review queue once the app deploys.

A prompt to build this app on Major:

"Build an app called Campaign Watch with three tables: campaignmap (hubspotcampaignid, campaignname, utmsource, utmmedium, utmcampaign, ga4propertyid, owneremail), dailyobservations (campaignmapid, reportdate, sessions, conversions, devicecategory), and baselines (campaignmapid, avg7day, avg28day, lastcomputedat). Add a review screen that lists dailyobservations where a threshold check flagged an anomaly, shows the agent's drafted brief text, and lets the owner approve, edit, or dismiss before delivery."
  1. Add the agent that interprets flagged exceptions. Give it read access to daily_observations and baselines, scoped to flagged records, with instructions limited to drafting the brief, never deciding delivery. You should see the agent return a structured draft (what changed, likely cause, confidence, checks needed) when tested against a sample flagged row.

A prompt to configure this agent:

"You review one flagged campaign observation at a time from the Campaign Watch app. Given the day's sessions and conversions, the 7-day average, and the 28-day average, write a short brief with four parts: what changed (one sentence with numbers), a likely cause chosen from traffic source shift, device mix shift, landing page change, seasonality, or unknown, a confidence level (low, medium, high), and one or two checks a marketer should make before acting. Never state a cause as certain. Never mark a brief as delivered; write it to the review queue only."
  1. Set the workflow trigger. Configure a daily schedule, for example 07:00 in the GA4 property's reporting timezone, that lists active campaigns from campaignmap, calls GA4's `runReport` for each UTM combination for the prior day, writes results to dailyobservations, recomputes baselines, and runs the threshold check (minimum volume plus percent-change) as a workflow step, not an agent call. Only flagged observations trigger the agent. You should see a scheduled run in the workflow's history each morning, with counts of campaigns checked and flagged.
  2. Test it against a known case. Seed a daily_observations row with sessions 40% below its 28-day average, then trigger the threshold-check step. You should see that row flagged, the agent invoked, and a drafted brief appear in the review queue.
  3. Roll out with scoped permissions. Grant the marketing operations role access to the review screen and approve/dismiss actions; keep campaign_map edits restricted to an admin role. You should see the review queue open to marketing while the mapping table stays locked to admins, confirmed with a non-admin test account.

Delivery has an honest limitation worth naming: HubSpot's CRM Notes API supports creating a note (POST /crm/v3/objects/notes) and associating it with contacts, companies, deals, tickets, and custom objects, but its documentation does not establish that a note can attach directly to a Marketing Campaign object. Rather than inventing an unverified association, route the approved brief to a supported HubSpot record (the deal or contact tied to the campaign) or to a Slack channel the owner watches, and confirm the exact association capability against HubSpot's current docs first.

Governance and IT control

Every connector here is set up once by IT and reused by the app, agent, and workflow, never re-entered per build. The HubSpot Private App token and GA4 service account credentials sit in Major's credential proxy, scoped narrowly: read-only on both sides, with write access only where a delivery path, such as a CRM note, is explicitly built and tested.

Access to the Campaign Watch app is role-based. The marketing operations team sees the review queue and can approve or dismiss briefs; only an admin role can edit the campaign_map table that controls which campaigns get pulled and where briefs route. A mis-mapped UTM crosswalk silently produces wrong comparisons, so changing it should be a deliberate, logged action, not something anyone can edit on a whim.

Every workflow run, every agent-drafted brief, and every human approval or dismissal is logged with a timestamp and actor. That audit trail answers two questions later: why a brief was sent, and why an anomaly wasn't caught sooner. SSO governs who can open the app, and the deploy of the app, agent, and workflow is versioned, so a change to the threshold logic or the agent's instructions traces back to a specific release rather than a silent edit. The credential proxy is the one place scoped secrets live, so an agent or workflow step never sees a raw API key, only a reference it's allowed to use within its granted scope.

Failure handling and edge cases

Approval path diagram showing deterministic threshold checks, agent-drafted briefs, and a required marketer approval before delivery to HubSpot or Slack

What runs straight through vs. what a person reviews

GA4's Data API will occasionally return a quota error or a transient 5xx. The workflow should retry with exponential backoff, capped at a few attempts, and if a campaign's report still fails after retries, log it as a missed day rather than silently skip it or guess a value. A missed day should also suppress the baseline calculation for that gap, not treat a zero as a real number, since that would falsely trigger an anomaly once data resumes.

Duplicate runs are a real risk with any scheduled job: if the workflow is manually re-triggered for a day it already processed, the dailyobservations write should be idempotent, keyed on campaignmap ID plus report date, so a rerun updates the existing row instead of creating a second one that skews the baseline average.

UTM mismatches are the quiet failure mode. If a campaign's UTM values change in HubSpot without the campaignmap table being updated, the GA4 query will silently return zero or wildly different traffic, and the agent will dutifully draft a brief about a "massive drop" that's actually a mapping error. Build a weekly consistency check that flags campaignmap entries where GA4 returns zero sessions for several consecutive days, and route that to the admin role, since it's a data-quality issue, not a performance one.

The agent must never auto-deliver a brief, auto-edit the campaign_map table, or state a cause as confirmed. Its output is always a draft sitting in the review queue until a person acts. If GA4 access is revoked or a property ID is deleted, the workflow should fail loudly, logging an error and alerting the admin role, rather than silently stop running.

A worked example with numbers

For example, say a demand generation team runs 12 active campaigns through HubSpot, each tagged with its own UTM combination, reporting against a single GA4 property. Each morning at 07:00 property-local time, the workflow reads the 12 rows from campaignmap, requests the prior day's sessions and conversions from GA4's `runReport`, and writes 12 new rows to dailyobservations.

Campaign ID 48291 ("Q4 Webinar Push," source linkedin, medium cpc) shows 340 sessions and 9 conversions for the day, against a stored 28-day average of 610 sessions and 31 conversions. The threshold check, configured here as a minimum volume of 100 sessions and a 30% change trigger, flags this one: sessions down 44%, conversions down 71%.

The agent receives the flagged row with its 7-day and 28-day history and drafts: "Sessions dropped 44% and conversions dropped 71% versus the 28-day average for Q4 Webinar Push (LinkedIn/CPC). Likely cause: traffic source shift, since LinkedIn-sourced sessions account for most of the drop while other source/medium combinations on the same page are flat. Confidence: medium. Checks needed: confirm the LinkedIn ad is still active and the daily budget wasn't exhausted; confirm no landing page or form change went live yesterday."

The marketer opens the review queue, checks the LinkedIn ads account, finds the daily budget was exhausted by 11 a.m. the prior day, and approves the brief with that note added. It routes to the campaign owner's Slack channel. Previously this surfaced only during a weekly manual GA4 pull; now it's visible the next morning.

Scaled across 12 campaigns checked daily, the manual weekly scan took roughly 20 minutes a week per person doing it. The automated version replaces that with a few minutes reviewing the queue on days something is flagged, illustratively twice a week across those 12 campaigns: one 20-minute block becomes two 3-minute reviews, and the Tuesday drop surfaces Wednesday morning instead of the following Monday.

What to measure

Once this is running, a handful of process metrics tell you whether it's doing its job:

  • Time to detection: days between an actual performance change and the brief reaching the campaign owner, aiming for next-day rather than next-reporting-cycle.
  • Exceptions flagged vs. approved: how many drafted briefs the marketer approves as-is, edits, or dismisses as noise. A high dismiss rate usually means the threshold is too sensitive.
  • Missed-day rate: how often a campaign's GA4 pull fails or returns no data, signaling either an API issue or a mapping problem worth fixing.
  • Manual touches per week: how often someone still manually opens GA4 outside this workflow, a proxy for whether the team trusts the automated check.
  • Mapping drift: how often the admin role corrects a campaign_map entry, a sign of whether UTM discipline is holding up upstream in HubSpot.

Frequently asked questions

Does HubSpot's native Google Analytics integration import GA4 reports into HubSpot?

No. HubSpot's built-in GA4 setting adds a measurement ID or tracking snippet to HubSpot-hosted pages so Google Analytics can collect data there. It does not pull GA4 reports into HubSpot's dashboards; that requires a separate integration like the one in this article.

How do you connect HubSpot campaigns to GA4 data?

Build a crosswalk table mapping each HubSpot campaign's UTM source, medium, and campaign values to the dimensions GA4 reports on, then query GA4's runReport endpoint filtered to those UTM values. This gives aggregate session and conversion data per campaign, not person-level identity matching between the two systems.

Can GA4 campaign reports be pulled automatically every day?

Yes, by scheduling a call to runReport once a day per campaign or property. Watch GA4's documented quotas, since the API enforces property- and project-level limits rather than a flat per-second rate, and build retry logic for transient errors.

Why do HubSpot and GA4 campaign numbers differ?

The usual causes are differing attribution models, consent settings limiting tracking for unconsented visitors, UTM values drifting between what's configured and what appears in a URL, timezone differences in how each system buckets a day, and reporting latency in GA4's pipeline.

How can marketing teams review GA4 anomalies without leaving their existing tools?

Route the agent's drafted brief to a supported destination your team already watches, such as a Slack channel or a HubSpot record the campaign ties to (a deal or contact, since direct note-to-campaign association isn't documented). A person always approves before anything is delivered.

Before you go live

  • [ ] HubSpot Private App token scoped to marketing.campaigns.read only (plus write scopes if a delivery path needs them), stored in Major's credential proxy
  • [ ] GA4 service account credentials scoped to analytics.readonly, stored in Major's credential proxy
  • [ ] Campaign-to-UTM crosswalk reviewed and confirmed accurate for all active campaigns
  • [ ] Threshold values (minimum volume, percent change) set and agreed with the marketing operations owner
  • [ ] Test run completed against a seeded anomaly and a normal day, both producing the expected outcome
  • [ ] Review queue permissions set: marketing ops can approve/dismiss, only admins can edit the campaign map
  • [ ] Retry and backoff logic confirmed for GA4 API errors, with missed days logged rather than treated as zero
  • [ ] Delivery destination (Slack or a supported HubSpot record) verified, with no unverified campaign-note association assumed

More marketing AI automation use cases

Start building on Major

Build the Campaign Watch app, the anomaly-drafting agent, and the daily scheduled workflow on Major, with HubSpot and GA4 credentials governed once in the credential proxy and reused everywhere.

Related articles

About the author

Ritvij Gautam is Head of Growth at Major.

Last reviewed November 16, 2026 by Ritvij Gautam.

Frequently asked questions

Does HubSpot's native Google Analytics integration import GA4 reports into HubSpot?
No. HubSpot's built-in GA4 setting adds a measurement ID or tracking snippet to HubSpot-hosted pages so Google Analytics can collect data there. It does not pull GA4 reports into HubSpot's dashboards; that requires a separate integration like the one in this article.
How do you connect HubSpot campaigns to GA4 data?
Build a crosswalk table mapping each HubSpot campaign's UTM source, medium, and campaign values to the dimensions GA4 reports on, then query GA4's runReport endpoint filtered to those UTM values. This gives aggregate session and conversion data per campaign, not person-level identity matching between the two systems.
Can GA4 campaign reports be pulled automatically every day?
Yes, by scheduling a call to runReport once a day per campaign or property. Watch GA4's documented quotas, since the API enforces property- and project-level limits rather than a flat per-second rate, and build retry logic for transient errors.
Why do HubSpot and GA4 campaign numbers differ?
The usual causes are differing attribution models, consent settings limiting tracking for unconsented visitors, UTM values drifting between what's configured and what appears in a URL, timezone differences in how each system buckets a day, and reporting latency in GA4's pipeline.
How can marketing teams review GA4 anomalies without leaving their existing tools?
Route the agent's drafted brief to a supported destination your team already watches, such as a Slack channel or a HubSpot record the campaign ties to (a deal or contact, since direct note-to-campaign association isn't documented). A person always approves before anything is delivered.