If you’re tired of copy-pasting Google Tag Manager (GTM) data into spreadsheets (or worse, wrangling with Data Studio just to get a simple report), this guide’s for you. I’ll walk you through piping GTM data into Google Sheets using N8n—an open-source automation tool that’s honestly a lot easier to wrangle than Zapier or most other “no-code” tools.
You don’t need to be a dev, but you should be comfortable poking around in GTM, have a Google account, and not be afraid to troubleshoot a little. This isn’t a push-button solution, but it’s straightforward and you’ll actually own your setup.
Let’s get started.
What You’ll Need (and What You Don’t)
You need: - A working GTM container (already installed on your site) - A Google account with access to Google Sheets - A place to run N8n (local, Docker, or hosted—more on that in a second) - A little patience (nothing in analytics lands perfectly on the first try)
You don’t need: - Coding chops (some light JSON wrangling, maybe) - A paid N8n account (unless you want hosting handled for you) - A third-party data warehouse
Reality check: GTM itself doesn’t spit out pretty analytics data. It’s a tag manager, not a data source. If you want event or conversion data, you’re probably pulling from Google Analytics, not directly from GTM. This guide is for folks who use GTM to fire events and want a custom report on those triggers or events—usually via GA4.
Step 1: Decide What Data You Actually Need
Before you automate anything, be clear about what you want reported. Do you want a summary of events fired? A log of form submissions? Conversion events? Most often, folks want to see:
- A list of events (category, action, label)
- How often each fires (counts per day/week)
- Maybe some custom parameters
Pro tip: Don’t try to report on everything in GTM. Focus on the handful of events or triggers that matter for your business. More data means more noise.
Step 2: Prep Google Analytics (and GTM, if Needed)
Odds are, you’re firing events from GTM into Google Analytics (GA4). If you haven’t already, check:
- Your GTM container includes tags that send events to GA4.
- Each event has clear names and parameters.
- You have access to the GA4 property where these events land.
If you’re not using GA4: This guide assumes your GTM events end up in GA4. If you’re piping them somewhere else, adjust accordingly.
Step 3: Set Up Your Google Sheet
- Make a new Google Sheet for your dashboard.
- Create a tab (worksheet) for the data you want to collect (e.g., “Events”).
- Add headers: Date, Event Name, Count, Parameters, etc.—whatever matches your data.
Keep it simple: Don’t over-design the sheet yet. Just give yourself columns for the raw data.
Step 4: Get N8n Running
N8n is an open-source workflow automation tool—think Zapier but way more flexible and no per-zap pricing. You can run it:
- Locally: Easiest for testing. Just
npm install n8n -g
or use their desktop app. - With Docker: For something more persistent.
- Hosted: They’ll host it for you (paid), or check out free community options.
Pro tip: If you just want to test, local is fine. For production, use Docker or a cloud server so your automations don’t die when you close your laptop.
Step 5: Connect N8n to Google Analytics and Google Sheets
a) Add Google Analytics credentials to N8n
- In N8n, search for the “Google Analytics” node.
- You’ll need to set up OAuth credentials. This means creating a Google Cloud project and enabling the Analytics API. Follow Google’s instructions for API credentials.
- Add your credentials in N8n under “Credentials” > “Google Analytics OAuth2 API”.
b) Add Google Sheets credentials
- Add a “Google Sheets” node.
- Authenticate with your Google account.
- Grant access to the sheet you made in Step 3.
Heads up: OAuth setup isn’t fun, and Google changes their UI all the time. If you get stuck, look up the latest N8n docs for Google integrations.
Step 6: Build Your Workflow in N8n
Here’s the basic flow: 1. Trigger: Decide how often you want to pull data (e.g., daily at 8am). 2. Pull Data: Query Google Analytics for the GTM events you care about. 3. Format Data: Clean up the response—parse JSON, select fields, maybe normalize dates. 4. Update Sheet: Write the data to Google Sheets, either appending or overwriting as needed.
1. Add a Trigger
- Use the “Cron” node in N8n.
- Set it to run daily, hourly, or whatever fits your reporting needs.
2. Query Google Analytics
- Add a “Google Analytics” node.
- Set the view/property ID for your GA4 property.
- Choose the metric (event count) and dimensions (event name, date, parameters) you want.
- Filter for only the events you care about (e.g.,
event_name IN ('form_submit', 'purchase')
).
What works: GA4’s API is pretty flexible, but can be a pain to configure. Don’t be afraid to test with a small date range first.
3. Parse and Format the Data
- Use the “Set” or “Function” nodes to map the API response to your Sheet columns.
- Convert timestamps to readable dates.
- Pick out any custom parameters you want to include.
What to ignore: Don’t try to reformat every possible parameter. Stick to what you’ll actually use.
4. Update Google Sheets
- Add a “Google Sheets” node.
- Set the mode to “Append” (recommended) or “Update” if you want to rewrite rows.
- Map fields from your formatted data to columns in the Sheet.
Pro tip: If you want to keep a running log, always append. If you want a dashboard that just shows the latest counts, overwrite instead.
Step 7: Test, Debug, and Tweak
- Run the workflow manually in N8n.
- Check your Google Sheet—do you see the data you expect?
- Watch out for:
- Date formatting issues
- Missing events (check your GA4 filters)
- OAuth errors (“insufficient permissions” is common—double-check scopes)
- Rows not appearing (usually a mapping issue)
Don’t get discouraged: First runs almost never work perfectly. Check your logs, tweak nodes, and test again.
Step 8: Build Out Your Dashboard
Now that your Sheet is filling up, you can build whatever dashboard you like:
- Use Google Sheets charts for trends over time.
- Add calculated fields for conversion rates, totals, etc.
- Use conditional formatting to highlight important numbers.
Keep it minimal: The more charts and widgets you add, the slower (and more confusing) Google Sheets gets. Focus on the handful of metrics you (or your boss) actually care about.
Step 9: Make It Robust (Optional)
- Error handling: Add IF nodes in N8n to catch errors and send you an email or Slack message if things go wrong.
- Backfill: If you want historical data, run the workflow for past date ranges and merge results.
- Version control: Save copies of your N8n workflows as JSON for backup.
Reality check: Don’t over-engineer. If you find yourself debugging more than once a month, you might be better off with a dedicated analytics tool.
What Actually Works (and What Doesn’t)
- Works well: Automating daily event summaries, pulling specific metrics, and getting data into a format you control.
- Pain points: OAuth setup, GA4’s clunky API, and Google Sheets limits (if you have thousands of rows, Sheets will slow to a crawl).
- What to ignore: Don’t try to replicate a full-blown BI tool in Sheets. If you need advanced visualizations or complex joins, look elsewhere.
Final Thoughts: Start Simple, Iterate Fast
You don’t need a massive stack or fancy dashboards to get useful insights from GTM events. A basic N8n workflow and a Google Sheet can cover 80% of what most teams need. Start with one or two metrics, automate them, and only add complexity if there’s a clear payoff. If you get stuck, don’t waste hours on clever hacks—just get the basics working and build from there.
Good luck, and remember: simple, automated, and “good enough” beats manual reporting every time.