How to Automate Data Analytics AI Agent: Automatic Business Insights from GA4, HubSpot, and Sheets with n8n

Every Sunday night, someone on your team opens five browser tabs — GA4, HubSpot, a couple of Google Sheets — copies numbers into a slide, and calls it the "weekly business review." By Monday morning t

How to Automate Data Analytics AI Agent: Automatic Business Insights from GA4, HubSpot, and Sheets with n8n

Every Sunday night, someone on your team opens five browser tabs — GA4, HubSpot, a couple of Google Sheets — copies numbers into a slide, and calls it the "weekly business review." By Monday morning the numbers are already stale, nobody remembers why sessions dropped 12%, and the report took two hours to build. That manual ritual is the single biggest reason most founders fly blind: the data exists, but the synthesis never happens consistently.

This article shows you how to replace that ritual with a fully automated Data Analytics AI Agent built in n8n. Every Sunday it pulls your GA4, HubSpot, and Google Sheets data, detects the changes that actually matter, writes a plain-English executive summary with an LLM, and delivers it to your inbox and Slack before you wake up. No dashboards to check. The insight comes to you.

The problem: you have data, not insight

The bottleneck is never data collection — it's interpretation at a regular cadence. Three failure modes show up in every ops team:

  • Fragmentation. Traffic lives in GA4, pipeline lives in HubSpot, and the numbers your finance person actually trusts live in a Sheet. Nobody joins them.
  • No baseline. "Sessions were 4,200 this week" means nothing without last week's 4,900. Humans forget to compute deltas; they eyeball trends and miss inflection points.
  • Inconsistency. The review happens when someone has time, which is never. A workflow that runs at 06:00 every Sunday regardless of workload beats a smart analyst who reports "when things calm down."

The fix is not another BI dashboard — dashboards are pull, and busy people don't pull. The fix is a scheduled agent that pushes a decision-ready narrative.

The solution: an event-driven reporting agent

The workflow is a linear pipeline with a fan-out for data collection and a fan-in for synthesis. At a high level:

  1. A Schedule Trigger fires every Sunday at 06:00.
  2. Three collector branches run in parallel: GA4, HubSpot, and Google Sheets.
  3. A Code node normalizes each source into a common shape and computes week-over-week deltas.
  4. An AI Agent / LLM node turns the deltas into an executive narrative, flagging only significant changes.
  5. Two delivery branches send the same report to Gmail/SMTP and Slack.

Because collection is parallelized and synthesis is centralized, the report is internally consistent — the email and the Slack message are byte-for-byte the same, generated once.

Step-by-step setup in n8n

1. Schedule Trigger. Add a Schedule Trigger node. Set the interval to Weeks, trigger on Sunday, at hour 6. Set your workflow timezone under Settings → Timezone so 06:00 means your local Sunday, not UTC.

2. GA4 collector. Use the Google Analytics node with the Get Report operation. Authenticate with a Google service account that has Viewer access to the property (the same OAuth2/service-account credential pattern GA4's Data API expects). Request two date ranges in one call — 7daysAgo→yesterday and 14daysAgo→8daysAgo — with dimensions like date and metrics sessions, totalUsers, conversions, and engagementRate. Pulling both windows at once lets the delta math happen downstream without a second query.

3. HubSpot collector. Add the HubSpot node (or an HTTP Request node against the CRM Search API if you need custom filters). Authenticate with a Private App token. Pull deals created or closed in the last 7 days and the prior 7 days — grab dealstage, amount, and createdate. Aggregate to counts and pipeline value per week; you don't want raw deal records reaching the LLM.

4. Google Sheets collector. Use the Google Sheets node, Read Rows operation, pointed at your KPI tab (revenue, churn, whatever your team already tracks manually). Keep the header row so columns arrive as named fields.

5. Normalize and compute deltas. Add a Code node (JavaScript) after the collectors join. Its job: for every metric, output current, previous, absolute change, and percent change, plus a significant boolean. A simple threshold works well:

const pct = (cur, prev) => prev === 0 ? (cur > 0 ? 100 : 0) : ((cur - prev) / prev) * 100;
const rows = metrics.map(m => {
  const change = pct(m.current, m.previous);
  return { ...m, change: +change.toFixed(1), significant: Math.abs(change) >= 10 };
});
return [{ json: { rows, generatedAt: $now.toISO() } }];

The significant flag is what keeps the final report short — a 2% wobble in sessions is noise; a 30% drop in new deals is a headline.

6. The AI Agent node. Add an AI Agent (or Basic LLM Chain) node with an Anthropic Claude model — claude-opus-4-8 for the sharpest synthesis, or claude-haiku-4-5 if you want it fast and cheap. Feed the normalized JSON in as context and use a system prompt like:

"You are a business analyst. You receive weekly metrics with week-over-week deltas. Write a 150-word executive summary. Lead with the single most important change. Explain only metrics flagged significant. State the number, the delta, and one plausible hypothesis. No filler, no 'as an AI'. End with one recommended action."

Passing pre-computed deltas rather than raw rows means the model reasons about meaning, not arithmetic — LLMs are unreliable calculators but excellent narrators.

7. Deliver to email and Slack. Split the output into two branches. Use the Gmail node (or generic SMTP) with the subject Weekly Business Insights — {{$now.format('MMM d')}} and the agent's text as an HTML body. In parallel, use the Slack node, Send Message operation, posting to your #leadership channel. Wrap the text in Slack Block Kit sections for clean formatting. Because both branches read the same upstream node, there's zero drift between channels.

Benefits: what changes on Monday

  • Time back. A two-hour manual ritual becomes zero minutes. The workflow runs while you sleep.
  • Consistency. The report ships every week, forever, whether or not anyone "had time." Cadence is the whole point of a business review, and automation guarantees it.
  • Cross-source truth. Traffic, pipeline, and finance numbers land in one narrative, already joined and compared. No more reconciling three tabs.
  • Signal over noise. The significance threshold means the report highlights the 30% deal drop instead of burying it under twelve stable metrics.
  • Decision-ready. Because the LLM ends with a recommended action, the report drives a decision, not just awareness.

Common pitfalls (and how to avoid them)

Timezone drift. If you don't set the workflow timezone, the Schedule Trigger runs on UTC and your "Sunday 6am" report may arrive Saturday evening. Set it explicitly in workflow settings.

Sending raw rows to the LLM. Dumping hundreds of HubSpot deal records into the prompt blows your token budget and produces vague summaries. Aggregate and compute deltas in the Code node first; the model should receive a dozen clean metrics, not a database export.

Silent auth expiry. GA4 service-account keys and HubSpot Private App tokens can be revoked or expired without warning, and the workflow will quietly send an empty report. Add an IF node that checks whether each collector returned data, and route failures to a Slack alert instead of pretending zero sessions is real.

Division by zero in deltas. When last week's value is 0, a naive percent-change calculation returns Infinity or NaN and corrupts the whole report. Guard it as shown in the Code snippet above.

Trusting LLM math. Never ask the model to compute the deltas — it will confidently get them wrong. Compute every number in code and let the LLM only describe and prioritize what it's given.

Build these five guards in from day one and the workflow becomes genuinely set-and-forget: a reliable analyst that never takes a Sunday off, never forgets the baseline, and never pads the report with fluff.

Data Analytics AI Agent: Automatic Business Insights from GA4, HubSpot, and Sheets
PRONTO PARA USAR

Ja construimos isso pra voce

Nao comece do zero. O Data Analytics AI Agent: Automatic Business Insights from GA4, HubSpot, and Sheets e um workflow n8n pronto para instalar — conecta suas ferramentas em minutos, sem codigo.

Instalar por $79.0 →