AutomationFlowsAI & RAG › Create a Weekly LLM Traffic Report Using Google Analytics, Gpt-5, and Gmail

Create a Weekly LLM Traffic Report Using Google Analytics, Gpt-5, and Gmail

ByRobin Geuens @robingeuens on n8n.io

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. The trigger runs…

Cron / scheduled trigger★★★★☆ complexityAI-powered13 nodesOpenAIGoogle AnalyticsGmail
AI & RAG Trigger: Cron / scheduled Nodes: 13 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #9081 — we link there as the canonical source.

This workflow follows the Gmail → OpenAI recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "EOcBeSjghx5s9AWj",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Create a weekly LLM traffic report using Google Analytics, AI, and Gmail",
  "tags": [],
  "nodes": [
    {
      "id": "d9633143-8490-4bdf-a74d-ef76b4bdd296",
      "name": "Create traffic report",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1072,
        0
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5",
          "cachedResultName": "GPT-5"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Please create a report of the following traffic\n\n {{ $json.data.toJsonString() }}"
            },
            {
              "role": "system",
              "content": "=You are a virtual assistant. Your job is to take the list of traffic numbers provided and generate a weekly report that will be sent by email. Use the following structure:\n\n<structure>\n## Top sources\nShow a table with top sources of traffic. The columns should be | # | Source / Medium | Sessions |\n</structure>\n\nAdhere to the following rules:\n- Only return the body text of the email.\n- Return the body text without any additional commentary or remarks\n- The report should be formatted to comply with HTML used in emails."
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "596de87f-3356-4e6b-87fb-d08ea6f28d1b",
      "name": "Every week...",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -80,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ]
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9d573408-4d0d-4534-a2c6-be09cb89460e",
      "name": "Get sessions by source & medium",
      "type": "n8n-nodes-base.googleAnalytics",
      "position": [
        224,
        0
      ],
      "parameters": {
        "returnAll": true,
        "metricsGA4": {
          "metricValues": [
            {
              "listName": "sessions"
            }
          ]
        },
        "propertyId": {
          "__rl": true,
          "mode": "id",
          "value": "=put id here"
        },
        "dimensionsGA4": {
          "dimensionValues": [
            {
              "listName": "sourceMedium"
            }
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "googleAnalyticsOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "610f9a66-61e3-47ce-baf4-d53432240b77",
      "name": "Filter known referral domains from AI companies",
      "type": "n8n-nodes-base.code",
      "position": [
        528,
        0
      ],
      "parameters": {
        "jsCode": "const regex = /^.openai.*|.*copilot.*|.*chatgpt.*|.*gemini.*|.*gpt.*|.*neeva.*|.*writesonic.*|.*nimble.*|.*outrider.*|.*perplexity.*|.*google.*bard.*|.*bard.*google.*|.*bard.*|.*edgeservices.*|.*astastic.*|.*copy.ai.*|.*bnngpt.*|.*gemini.*google.*$/i;\n\n// Filter items\nreturn items.filter(item => {\n  // Adjust the property you want to match against, e.g. `item.json.source`\n  const value = item.json.sourceMedium || \"\";\n  return regex.test(value);\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "d8c1d626-5a9e-4ee1-9d94-99d1cf33b1fd",
      "name": "Combine items",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        832,
        0
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "3f1f25d7-46c3-4af7-916d-b856bf1b8e05",
      "name": "Send report",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1424,
        0
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $json.message.content }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "=LLM traffic report for week {{ $now.minus(1,'week').format('W') }} - {{ $now.minus(1,'week').format('dd MMMM yyyy') }} to {{ $now.format('dd MMMM yyyy') }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "baa2f522-9202-4387-b3c2-7c8f59c1d7f7",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 704,
        "content": "## Scheduled trigger\nRun workflow every week"
      },
      "typeVersion": 1
    },
    {
      "id": "abd6b671-da94-40d6-8f16-f4255354b335",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 704,
        "content": "## Get sessions by source / medium\nGet last weeks sessions by source / medium\n\nAdd your Google analytics ID to the node to make it work. You can find it in the admin panel under `property -> property details`. In the top right you'll see your property ID"
      },
      "typeVersion": 1
    },
    {
      "id": "97f8d38d-5a3e-4420-9dc0-3619e4fa9a82",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 704,
        "content": "## Filter for LLM traffic\nIn this node we're filtering our traffic for known LLMs such as ChatGPT, Gemini, perplexity, etc\n\nFeel free to add your own to the list"
      },
      "typeVersion": 1
    },
    {
      "id": "890c7ab2-651d-425f-b029-712a0816a200",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 704,
        "content": "## Combine items\nHere we combine all items into one list so we can pass it on to the LLM"
      },
      "typeVersion": 1
    },
    {
      "id": "7b1c3630-7bc9-41e0-836e-df8b2051860d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 704,
        "content": "## Generate report\nHere we ask an LLM to generate a simple traffic report for us and style in using email-friendly HTML"
      },
      "typeVersion": 1
    },
    {
      "id": "66c8ed41-5330-4cc2-b137-0b8404ce6650",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 704,
        "content": "## Send report\nFinally, we send the report to an email address.\n\nWe use a function in n8n to get last weeks week number, the start date, and the end date"
      },
      "typeVersion": 1
    },
    {
      "id": "6d241bf3-1b46-4280-be37-4da55119bc49",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 704,
        "content": "## Overview\n\nGet a weekly report on website traffic driven by large language models (LLMs) like ChatGPT, Perplexity, and Gemini. This workflow helps you track how these tools bring visitors to your site. A weekly snapshot helps you make better content and marketing decisions.\n\n## How it works\n\n- Pull weekly sessions from Google Analytics by source/medium\n- Use regex to find traffic from LLMs\n- Combine the filtered sessions and generate a short report with AI\n- Email the report to you\n\n## Setup\n\n1. Connect your OpenAI API key, Google Analytics access, and email credentials (for example, Gmail via Google Cloud Console).\n2. Configure your Google Analytics and email nodes to read and send data.\n3. Update the code node to filter sessions based on LLM referral URLs."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4cdce158-749d-4fd1-acb4-cf45cdc7d403",
  "connections": {
    "Combine items": {
      "main": [
        [
          {
            "node": "Create traffic report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every week...": {
      "main": [
        [
          {
            "node": "Get sessions by source & medium",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create traffic report": {
      "main": [
        [
          {
            "node": "Send report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get sessions by source & medium": {
      "main": [
        [
          {
            "node": "Filter known referral domains from AI companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter known referral domains from AI companies": {
      "main": [
        [
          {
            "node": "Combine items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

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. The trigger runs…

Source: https://n8n.io/workflows/9081/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

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.

Gmail, Google Analytics, N8N Nodes Htmlcsstopdf +1
AI & RAG

Personalized Outreach & Follow-Up - Phase 2. Uses googleSheets, openAi, gmail, gmailTrigger. Scheduled trigger; 59 nodes.

Google Sheets, OpenAI, Gmail +2
AI & RAG

A scheduled process aggregates content from eight distinct data sources and standardizes all inputs into a unified format. AI models perform sentiment scoring, detect conspiracy or misinformation sign

HTTP Request, OpenAI, Postgres +2
AI & RAG

This workflow monitors filesystem sync and backup jobs by validating their execution logs, not by running or inspecting the jobs themselves.

Google Cloud Storage, Gmail, GitHub +2
AI & RAG

This advanced workflow automates brand monitoring and media coverage tracking for musicians, bands, and music labels. The system uses multiple search queries (dorky) to discover mentions across the we

Google Sheets, Gmail, @Brave/N8N Nodes Brave Search +1