n8n

How to Automate Google Analytics Campaign Tracking?

Turn campaign links into trackable assets and get clear email summaries on a schedule. Marketers enter a website and UTM details once, then the system saves the link, makes a QR code, and later reports results from Google Analytics. This is helpful for teams that run ads, print pieces, events, or partner promos.

On a manual run, inputs flow through a set step and a code step that build a clean UTM URL. The link is upserted into an Airtable table for easy logging, and a QR image is created through a simple HTTP call. A schedule trigger then queries GA4 for sessions by sourceMedium using your property. An AI agent powered by OpenAI turns the dataset into a short executive summary, and Gmail delivers it to your marketing lead.

Set up an Airtable base with a URL field, connect your Google Analytics property, and choose the recipient email. Expect faster launch of campaigns, fewer tagging mistakes, and clear feedback on what channels drive visits. This setup works well for flyers, events, billboards, and any campaign that needs a QR code and proof of traffic. Many teams see link build time drop from minutes to seconds and save about an hour each reporting cycle.

What are the key features?

  • Manual start collects website and UTM values through a set step
  • Code step builds a standard UTM URL from your inputs
  • Airtable upsert stores the final link for a clean audit trail
  • HTTP request generates a QR code for the UTM link via QuickChart
  • Schedule trigger runs GA4 queries on a set interval
  • Google Analytics node tracks sessions by sourceMedium for your property
  • OpenAI agent turns raw numbers into an executive summary
  • Gmail sends the summary to your marketing lead

What are the benefits?

  • Reduce manual work from 30 minutes per link to 2 minutes
  • Automate weekly reporting and save about 1 hour per week
  • Improve UTM data quality by 90 percent with a standard format
  • Handle up to 10 times more campaign links without extra staff
  • Connect Airtable, Google Analytics, OpenAI, and Gmail in one flow

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Google Analytics, Airtable, Gmail and OpenAI. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, open the OpenAI credential. If it does not exist, double click the OpenAI node, choose Create new credential, and follow the on screen steps to add your API key. Name it clearly, for example OpenAI Prod.
  4. In the credentials manager, set up Google Analytics. If unsure, double click the Google Analytics node, choose Create new credential, and complete the OAuth flow with the Google account that has access to your GA4 property.
  5. In the credentials manager, set up Gmail. Double click the Gmail node, choose Create new credential, and finish the OAuth flow. Use the account you want to send reports from.
  6. In the credentials manager, add Airtable. Double click the Airtable node, choose Create new credential, and paste a Personal Access Token from your Airtable account. Give it a clear name such as Airtable PAT Prod.
  7. In Airtable, create a base and a table with a field named URL as a single line text field. Copy the base and table IDs if needed.
  8. Open the Set UTM Parameters For Link node in n8n and enter default values for website_url, campaign_source, campaign_medium, campaign_name, and campaign_term. You can update these before each manual run.
  9. Open the Create UTM Link With Parameters node to confirm the UTM format. Run a manual test and check that the utmUrl field looks correct.
  10. Run the manual trigger. Confirm a new record appears in Airtable with the URL value. Open the HTTP request node output and test the QR image to ensure it scans to the same UTM link.
  11. Open the Google Analytics node and set your property ID. Keep the Sessions metric and sourceMedium dimension or adjust as needed. Test the node and verify rows are returned.
  12. Open the Google Analytics Data Analysis Agent node, make sure the OpenAI credential is selected, and run a test. Then open the Gmail node and send a test message to confirm delivery.
  13. Set the schedule interval in the Schedule Google Analytics Report node. Save and activate the workflow. Check your time zone to ensure reports arrive when expected.
  14. If something fails, check permissions on the GA4 property, confirm the Airtable table and field names match, verify the Gmail account can send messages, and ensure your OpenAI key has quota.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Airtable

Sign up

Free (1,000 API calls / mo)

Gmail

Sign up

No cost: Personal Gmail (Gmail API has no usage-based pricing; quotas apply)

Google Analytics

Sign up

Free (GA4 standard): $0; API access included and subject to quotas

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.