Skip to content

Weekly

Track visits from AI assistants to your website

Every week you get an email showing how many visitors came from AI assistants such as ChatGPT, Claude, Perplexity and Gemini, and which pages they landed on.

Runs
Weekly
Apps
Gmail, Google Analytics
AI
Optional
Access
GA4 Viewer; gmail.send

Send this to your assistant

Create a ClickRuntime automation: every Monday, report how many GA4 sessions came from AI assistants like ChatGPT, Claude, Perplexity and Gemini last week, compared with the week before, with the top landing pages, and email it to me.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A software company noticed sign-ups mentioning they found the product through an AI assistant. In GA4 these visits are scattered across referral sources with odd names, so nobody could say how much traffic they bring or which pages the assistants recommend.

A weekly report on just this traffic shows whether it is growing and which pages AI assistants send people to, which guides what content to improve.

What you get out of it

  • See a new source of visitors

    Visits from AI assistants are grouped together instead of hidden among other referrals.

  • Know which pages get recommended

    The landing pages show what AI assistants link to, so you can keep those pages accurate and current.

  • Watch the trend

    Week-on-week figures show whether this traffic is growing for your site.

  • No custom reports to build

    The filter for assistant sources is built in, so there is nothing to set up in GA4.

How it works

What happens, step by step

  1. Every Monday, ClickRuntime asks Google Analytics for last week's and the previous week's sessions from AI assistant websites.

  2. It groups them by assistant and lists the top landing pages.

  3. If AI is available, it adds a short commentary on the trend.

  4. The report is emailed to you from your Gmail.

Before it runs live

  • Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
  • Connect Google Analytics

What you get

RunsWeekly
Track visits from AI assistants to your websitetoday, 9:00Succeeded
Email · AI assistant trafficchatgpt.com (last week): 312 sessions · perplexity.ai: 96 · claude.ai: 74. Top landing page: /docs/getting-started

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other Gmail and Google Analytics steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
weekly_ai_assistant_llm_referral_traffic_report.pyexample
import base64
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, http, credentials, ai

def api(name, version):
    return build(name, version, credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)

def send_gmail(to, subject, text):
    raw = base64.urlsafe_b64encode(f"To: {to}\r\nSubject: {subject}\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n{text}".encode()).decode()
    api("gmail", "v1").users().messages().send(userId="me", body={"raw": raw}).execute()

PROPERTY = "123456789"

def ga(body):
    url = f"https://analyticsdata.googleapis.com/v1beta/properties/{PROPERTY}:runReport"
    return http.post(url, headers={"Authorization": f"Bearer {credentials.connection('google', 'work')}"}, json=body).json().get("rows", [])

WEEKS = [{"startDate": "7daysAgo", "endDate": "yesterday"}, {"startDate": "14daysAgo", "endDate": "8daysAgo"}]

AI_SOURCES = "chatgpt|openai|claude|anthropic|perplexity|gemini|copilot|you\\.com"
FILTER = {"filter": {"fieldName": "sessionSource", "stringFilter": {"matchType": "FULL_REGEXP", "value": f".*({AI_SOURCES}).*"}}}

@on_trigger
def run(event):
    by_source = ga({"dateRanges": WEEKS, "dimensions": [{"name": "sessionSource"}], "metrics": [{"name": "sessions"}], "dimensionFilter": FILTER})
    pages = ga({"dateRanges": WEEKS[:1], "dimensions": [{"name": "landingPage"}], "metrics": [{"name": "sessions"}], "dimensionFilter": FILTER,
                "orderBys": [{"metric": {"metricName": "sessions"}, "desc": True}], "limit": 10})
    lines = [f"{r['dimensionValues'][0]['value']} ({'last week' if r['dimensionValues'][1]['value'] == 'date_range_0' else 'week before'}): "
             f"{r['metricValues'][0]['value']} sessions" for r in by_source]
    report = "\n".join(lines + ["", "Top landing pages:"] + [f"{p['dimensionValues'][0]['value']}: {p['metricValues'][0]['value']}" for p in pages])
    try:
        report = ai.generate(report, system="Summarise the trend in AI assistant referrals in 2 sentences.", max_output_tokens=120).text + "\n\n" + report
    except ai.AIError:
        pass
    send_gmail("you@example.com", "Visits from AI assistants last week", report)
    return {"sources": len(by_source)}

FAQ

Common questions

Which AI assistants does it count?
ChatGPT, Claude, Perplexity, Gemini, Copilot and similar, recognised by the referring site. You can add others to the list.
Are all AI visits counted?
Only those where the assistant passes on a referrer. Some visits arrive without one and show as direct traffic.
Does it need AI to run?
No. The numbers are counted without AI; with AI on, the email also gets a short commentary.
What permissions does it need?
GA4 Viewer; gmail.send. Nothing else in your accounts is used.
Does it need AI?
No, but you can ask for an AI step (for example a summary). It then uses ClickRuntime's built-in AI allowance.
How many runs does it use?
One run each time it runs (weekly). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Track visits from AI assistants to your website” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.