Back to Integrations
integrationGoogle Analytics node
integrationOpenAI node

Google Analytics and OpenAI integration

Save yourself the work of writing custom integrations for Google Analytics and OpenAI and use n8n instead. Build adaptable and scalable Analytics, AI, and Langchain workflows that work with your technology stack. All within a building experience you will love.

How to connect Google Analytics and OpenAI

  • Step 1: Create a new workflow
  • Step 2: Add and configure nodes
  • Step 3: Connect
  • Step 4: Customize and extend your integration
  • Step 5: Test and activate your workflow

Step 1: Create a new workflow and add the first step

In n8n, click the "Add workflow" button in the Workflows tab to create a new workflow. Add the starting point – a trigger on when your workflow should run: an app event, a schedule, a webhook call, another workflow, an AI chat, or a manual trigger. Sometimes, the HTTP Request node might already serve as your starting point.

Google Analytics and OpenAI integration: Create a new workflow and add the first step

Step 2: Add and configure Google Analytics and OpenAI nodes

You can find Google Analytics and OpenAI in the nodes panel. Drag them onto your workflow canvas, selecting their actions. Click each node, choose a credential, and authenticate to grant n8n access. Configure Google Analytics and OpenAI nodes one by one: input data on the left, parameters in the middle, and output data on the right.

Google Analytics and OpenAI integration: Add and configure Google Analytics and OpenAI nodes

Step 3: Connect Google Analytics and OpenAI

A connection establishes a link between Google Analytics and OpenAI (or vice versa) to route data through the workflow. Data flows from the output of one node to the input of another. You can have single or multiple connections for each node.

Google Analytics and OpenAI integration: Connect Google Analytics and OpenAI

Step 4: Customize and extend your Google Analytics and OpenAI integration

Use n8n's core nodes such as If, Split Out, Merge, and others to transform and manipulate data. Write custom JavaScript or Python in the Code node and run it as a step in your workflow. Connect Google Analytics and OpenAI with any of n8n’s 1000+ integrations, and incorporate advanced AI logic into your workflows.

Google Analytics and OpenAI integration: Customize and extend your Google Analytics and OpenAI integration

Step 5: Test and activate your Google Analytics and OpenAI workflow

Save and run the workflow to see if everything works as expected. Based on your configuration, data should flow from Google Analytics to OpenAI or vice versa. Easily debug your workflow: you can check past executions to isolate and fix the mistake. Once you've tested everything, make sure to save your workflow and activate it.

Google Analytics and OpenAI integration: Test and activate your Google Analytics and OpenAI workflow

AI marketing report (Google Analytics & Ads, Meta Ads), sent via email/Telegram

What this workflow does
This workflow retrieves Online Marketing data (Google Analytics for several domains, Google Ads, Meta Ads) from the last 7 days and the same period in the previous year. The data is then prepared by AI as a table, analyzed and provided with a small summary.
The summary is then sent by email to a desired address and, shortened and summarized again, sent to a Telegram account.

This workflow has the following sequence:

time trigger (e.g. every Monday at 7 a.m.)
retrieval of Online Marketing data from the last 7 days (via sub workflows)
assignment and summary of the data
retrieval of Online Marketing data from the same time period of the previous year
allocation and summary of the data
preparation in tabular form and brief analysis by AI.
sending the report as an email
preparation in short form by AI for Telegram (optional)
sending as Telegram message.

Requirements
The following accesses are required for the workflow:
Google Analytics (via Google Analytics API): Documentation
Google Ads (via HTTP Request -> Google Ads API):Documentation
Meta Ads (via Facebook Graph API): Documentation
AI API access (e.g. via OpenAI, Anthropic, Google or Ollama)
SMTP access data (for sending the mail)
Telegram access data (optional for sending as Telegram message): Documentation

You must set up the individual sub-workflows as separate workflows. Then set the “Execute workflow trigger” here. Then select the corresponding sub-workflow in the AI Agent Tools.
You can select the number of domains yourself. If the data queries are not required, simply delete the corresponding tool (e.g. “Analytics_Domain_5).

Feel free to contact me via LinkedIn, if you have any questions!

Nodes used in this workflow

Popular Google Analytics and OpenAI workflows

+6

AI marketing report (Google Analytics & Ads, Meta Ads), sent via email/Telegram

What this workflow does This workflow retrieves Online Marketing data (Google Analytics for several domains, Google Ads, Meta Ads) from the last 7 days and the same period in the previous year. The data is then prepared by AI as a table, analyzed and provided with a small summary. The summary is then sent by email to a desired address and, shortened and summarized again, sent to a Telegram account. This workflow has the following sequence: time trigger (e.g. every Monday at 7 a.m.) retrieval of Online Marketing data from the last 7 days (via sub workflows) assignment and summary of the data retrieval of Online Marketing data from the same time period of the previous year allocation and summary of the data preparation in tabular form and brief analysis by AI. sending the report as an email preparation in short form by AI for Telegram (optional) sending as Telegram message. Requirements The following accesses are required for the workflow: Google Analytics (via Google Analytics API): Documentation Google Ads (via HTTP Request -> Google Ads API):Documentation Meta Ads (via Facebook Graph API): Documentation AI API access (e.g. via OpenAI, Anthropic, Google or Ollama) SMTP access data (for sending the mail) Telegram access data (optional for sending as Telegram message): Documentation You must set up the individual sub-workflows as separate workflows. Then set the “Execute workflow trigger” here. Then select the corresponding sub-workflow in the AI Agent Tools. You can select the number of domains yourself. If the data queries are not required, simply delete the corresponding tool (e.g. “Analytics_Domain_5). Feel free to contact me via LinkedIn, if you have any questions!

Create a Google Analytics Data Report with AI and sent it to E-Mail and Telegram

What this workflow does This workflow retrieves Google Analytics data from the last 7 days and the same period in the previous year. The data is then prepared by AI as a table, analyzed and provided with a small summary. The summary is then sent by email to a desired address and, shortened and summarized again, sent to a Telegram account. This workflow has the following sequence: time trigger (e.g. every Monday at 7 a.m.) retrieval of Google Analytics data from the last 7 days assignment and summary of the data retrieval of Google Analytics data from the last 7 days of the previous year allocation and summary of the data preparation in tabular form and brief analysis by AI. sending the report as an email preparation in short form by AI for Telegram (optional) sending as Telegram message. Requirements The following accesses are required for the workflow: Google Analytics (via Google Analytics API): Documentation AI API access (e.g. via OpenAI, Anthropic, Google or Ollama) SMTP access data (for sending the mail) Telegram access data (optional for sending as Telegram message): Documentation Feel free to contact me via LinkedIn, if you have any questions!

Weekly Google Analytics Report with GPT-4o Analysis & Email Delivery

Overview The workflow automatically gathers weekly user and page view metrics. It then uses AI to analyze, compare, and compile a summary report. Finally, it sends the report to the manager's email. How it works Get Data from GA Automatically retrieve data from Google Analytics (GA) for the two most recent weeks. Compare the data and calculate the variances between the two weeks. Generate Report Automatically analyze the data and generate reports using Artificial Intelligence (AI). Generate charts to visualize the data. Export the report to PDF. Send Report Send the report via email to the manager. Set up steps Google cloud account Create the credentials and replace them in the workflow. Please enable the following APIs: Gmail API Google Analytics Admin API Google Analytics Data API HTML to PDF account You need to install node HTML to PDF. Get API key and replace in the workflow.

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.

Build your own Google Analytics and OpenAI integration

Create custom Google Analytics and OpenAI workflows by choosing triggers and actions. Nodes come with global operations and settings, as well as app-specific parameters that can be configured. You can also use the HTTP Request node to query data from any app or service with a REST API.

Google Analytics supported actions

Get
Return the analytics data
Search
Return user activity data

OpenAI supported actions

Message a Model
Generate a model response with GPT 3, 4, 5, etc. using Responses API
Classify Text for Violations
Check whether content complies with usage policies
Analyze Image
Take in images and answer questions about them
Generate an Image
Creates an image from a text prompt
Edit Image
Edit an image
Generate Audio
Creates audio from a text prompt
Transcribe a Recording
Transcribes audio into text
Translate a Recording
Translates audio into text in English
Delete a File
Delete a file from the server
List Files
Returns a list of files that belong to the user's organization
Upload a File
Upload a file that can be used across various endpoints
Create
Create a conversation
Get
Get a conversation
Remove
Remove a conversation
Update
Update a conversation
Generate
Creates a video from a text prompt

Google Analytics and OpenAI integration details

FAQs

  • Can Google Analytics connect with OpenAI?

  • Can I use Google Analytics’s API with n8n?

  • Can I use OpenAI’s API with n8n?

  • Is n8n secure for integrating Google Analytics and OpenAI?

  • How to get started with Google Analytics and OpenAI integration in n8n.io?

Need help setting up your Google Analytics and OpenAI integration?

Discover our latest community's recommendations and join the discussions about Google Analytics and OpenAI integration.
Artem
sérgio eduardo floresta filho
Andrew adawdad
PinkFloyd
Steve Warburton

Looking to integrate Google Analytics and OpenAI in your company?

Over 3000 companies switch to n8n every single week

Why use n8n to integrate Google Analytics with OpenAI

Build complex workflows, really fast

Build complex workflows, really fast

Handle branching, merging and iteration easily.
Pause your workflow to wait for external events.

Code when you need it, UI when you don't

Simple debugging

Your data is displayed alongside your settings, making edge cases easy to track down.

Use templates to get started fast

Use 1000+ workflow templates available from our core team and our community.

Reuse your work

Copy and paste, easily import and export workflows.

Implement complex processes faster with n8n

red iconyellow iconred iconyellow icon