Skip to main content

UTM marketing attribution reports with Google Sheets, GPT-4o & Gmail

Workflow preview

Workflow preview
100%
UTM marketing attribution reports with Google Sheets, GPT-4o & Gmail preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Description Turn raw marketing data into actionable insights with this n8n Source/UTM Attribution and Reporting workflow! It automatically aggregates lead submissions, calculates Cost Per Lead (CPL...

Best for

  • Market Research automation workflows
  • AI Summarization automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.scheduletrigger, n8n-nodes-base.gmail, n8n-nodes-base.googlesheets, @n8n/n8n-nodes-langchain.chainllm, @n8n/n8n-nodes-langchain.lmchatazureopenai, n8n-nodes-base.code, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Rahul Joshi.

Original n8n.io source

1.1 Workflow description

Title
UTM marketing attribution reports with Google Sheets, GPT-4o & Gmail
Workflow name
UTM marketing attribution reports with Google Sheets, GPT-4o & Gmail

Description

Turn raw marketing data into actionable insights with this n8n Source/UTM Attribution and Reporting workflow! It automatically aggregates lead submissions, calculates Cost Per Lead (CPL) per channel, and generates AI-powered weekly attribution reportsโ€”delivered straight to your inbox in a professional HTML format.

What This Template Does

๐Ÿ“… Runs hourly to process new lead submissions ๐Ÿ“Š Aggregates leads by source (Instagram, LinkedIn, Google Ads, etc.) ๐Ÿ’ฐ Calculates key metrics like Cost Per Lead (CPL) ๐Ÿง  Uses AI to generate executive-ready HTML reports ๐Ÿ“ˆ Highlights top-performing sources and growth opportunities ๐Ÿ“ง Sends polished reports via Gmail automatically

Prerequisites

  • Google Sheets with lead submission data
  • Google Forms (or similar) as the data input source
  • n8n instance (self-hosted or cloud)
  • Azure OpenAI (GPT-4o-mini) API key for AI-powered reporting
  • Gmail API credentials for automated report delivery

Step-by-Step Setup

  • Trigger workflow hourly with n8n Scheduler.
  • Fetch new lead submissions from Google Sheets.
  • Aggregate and group data by Source/UTM parameters.
  • Calculate CPL using spend + lead count per channel.
  • Standardize column names for consistent reporting.
  • Send raw + aggregated data to Azure OpenAI for report generation.
  • Format into a professional HTML report (with insights & recommendations).
  • Send report via Gmail node to stakeholders.

Customization Ideas

  • Replace Gmail with Slack/Teams notifications for real-time sharing.
  • Add visual charts (Google Data Studio / Looker) for more analytics.
  • Use additional UTM fields (campaign, adgroup, creative) for deeper granularity.
  • Extend reporting to include ROI and ROAS calculations.

Key Benefits

โœ… Hands-free attribution tracking and analysis โœ… Accurate CPL metrics per channel โœ… AI-generated reports with actionable insights โœ… Saves time vs. manual data crunching โœ… Weekly reports ensure marketing strategy stays optimized

Perfect For

  • Marketing teams managing multi-channel campaigns
  • Agencies providing client attribution reports
  • Business owners optimizing ad spend efficiency
  • Growth teams tracking lead quality by source

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.1

Block 2 - Send Follow-up Email1

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 3 - Get row(s) in sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4

Block 4 - Basic LLM Chain

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.7

Block 5 - Azure OpenAI Chat Model1

Type / Role
@n8n/n8n-nodes-langchain.lmChatAzureOpenAi - lmChatAzureOpenAi
Config choices
Version 1

Block 6 - Code

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 7 - Code1

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow UTM marketing attribution reports with Google Sheets, GPT-4o & Gmail
Complexity intermediate
Nodes 14
Categories Market Research, AI Summarization
Author Rahul Joshi
Published 12 Sept 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/8513/8513.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does UTM marketing attribution reports with Google Sheets, GPT-4o & Gmail do?

Description Turn raw marketing data into actionable insights with this n8n Source/UTM Attribution and Reporting workflow! It automatically aggregates lead submissions, calculates Cost Per Lead (CPL...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Market Research, AI Summarization use case.