Create a weekly LLM traffic report using Google Analytics, GPT-5, and Gmail
Overview
Get a weekly report on website traffic driven by large language models (LLMs) such as ChatGPT, Perplexity, and Gemini. This workflow helps you track how these tools bring visitors to your site. A weekly snapshot can guide better content and marketing decisions.
How it works
The trigger runs every Monday.
Pull the number of sessions on your website by source/medium from Google Analytics.
The code node uses the following regex to filter referral traffic from AI providers like ChatGPT, Perplexity, and Gemini:
/^.openai.|.copilot.|.chatgpt.|.gemini.|.gpt.|.neeva.|.writesonic.|.nimble.|.outrider.|.perplexity.|.google.bard.|.bard.google.|.bard.|.edgeservices.|.astastic.|.copy.ai.|.bnngpt.|.gemini.google.$/i;
Combine the filtered sessions into one list so they can be processed by an LLM.
Generate a short report using the filtered data.
Email the report to yourself.
Setup
Get or connect your OpenAI API key and set up your OpenAI credentials in n8n.
Enable Google Analytics and Gmail API access in the Google Cloud Console. (Read more here).
Set up your Google Analytics and Gmail credentials in n8n. If you're using the cloud version of n8n, you can log in with your Google account to connect them easily.
In the Google Analytics node, add your credentials and select the property for the website you’re working with. Alternatively, you can use your property ID, which can be found in the Google Analytics admin panel under Property > Property Details. The property ID is shown in the top-right corner. Add this to the property field.
Under Metrics, select the metric you want to measure. This workflow is configured to use sessions, but you can choose others. Leave the dimension as-is, since we need the source/medium dimension to filter LLMs.
(Optional) To expand the list of LLMs being filtered, adjust the regex in the code node. You can do this by copying and pasting one of the existing patterns and modifying it. Example: |.example.|
The LLM node creates a basic report. If you’d like a more detailed version, adjust the system prompt to specify the details or formatting you want.
Add your email address to the Gmail node so the report is delivered to your inbox.
Requirements
OpenAI API key for report generation
Google Analytics API enabled in Google Cloud Console
Gmail API enabled in Google Cloud Console
Customizing this workflow
The regex used to filter LLM referral traffic can be expanded to include specific websites.
The system prompt in the AI node can be customized to create a more detailed or styled report.
Related Templates
Use OpenRouter in n8n versions <1.78
What it is: In version 1.78, n8n introduced a dedicated node to use the OpenRouter service, which lets you to use a lot...
Task Deadline Reminders with Google Sheets, ChatGPT, and Gmail
Intro This template is for project managers, team leads, or anyone who wants to automatically remind teammates of tasks ...
🤖 Build Resilient AI Workflows with Automatic GPT and Gemini Failover Chain
This workflow contains community nodes that are only compatible with the self-hosted version of n8n. How it works This...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments