Skip to content

Daily

Get an email when your website traffic changes sharply

When yesterday's traffic, conversions or a key source moves sharply from normal, you get an email explaining what changed and what to do.

Runs
Daily
Apps
Gmail, Google Analytics
AI
Yes, uses the built-in AI allowance
Access
GA4 Viewer; gmail.send

Send this to your assistant

Create a ClickRuntime automation: every morning, compare yesterday's GA4 sessions, conversions and traffic by source with the previous 4 weeks' average. If anything moved by more than 30%, email me what changed, the likely cause and a suggested action.

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

An online shop's checkout broke after a plugin update on a Friday night. Nobody noticed until Monday, when the week's orders were already lost. Another week, a blog post took off on social media and nobody followed up while the traffic was there.

A daily check that only emails when something unusual happens catches both the problems and the opportunities while there is still time to act.

What you get out of it

  • Problems are caught in a day

    A sudden drop in conversions or traffic arrives in your inbox the next morning, not at the end of the month.

  • Opportunities too

    A spike from a new source or page is flagged while it is still happening, so you can build on it.

  • Only when it matters

    Quiet days send nothing, so the alerts that arrive are worth reading.

  • Explained in plain words

    AI says what changed, the likely reason and a sensible next step.

How it works

What happens, step by step

  1. Every morning, ClickRuntime gets yesterday's sessions and conversions by traffic source from Google Analytics.

  2. It compares them with the average of the same weekday over the past four weeks.

  3. If nothing moved by more than your threshold, it stops there and sends nothing.

  4. If something did, AI writes up what changed, the likely cause and a suggested action, and the email is sent 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

RunsDaily
Get an email when your website traffic changes sharplytoday, 9:00Succeeded
Email · Traffic alertTraffic alert: google / cpc fell to 41 sessions vs 260 usual (−84%). Likely cause: the Acme spring campaign paused when its budget ran out. Check the campaign budget.

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.
ai_anomaly_and_opportunity_alerts.pyexample
import base64
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from datetime import date, timedelta
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", [])

@on_trigger
def run(event):
    ranges = [{"startDate": (d := (date.today() - timedelta(days=n)).isoformat()), "endDate": d} for n in (1, 8, 15, 22)]
    rows = ga({"dateRanges": ranges, "dimensions": [{"name": "sessionSource"}], "metrics": [{"name": "sessions"}, {"name": "conversions"}]})
    data, changes = {}, []
    for r in rows:
        src, rng = r["dimensionValues"][0]["value"], int(r["dimensionValues"][1]["value"].split("_")[-1])
        data.setdefault(src, [0] * 4)[rng] = float(r["metricValues"][0]["value"])
    for src, v in data.items():
        if (avg := sum(v[1:]) / 3) >= 20 and abs(v[0] - avg) / avg > 0.3:
            changes.append(f"{src}: {v[0]:.0f} sessions yesterday vs {avg:.0f} usual ({(v[0] - avg) / avg * 100:+.0f}%)")
    if not changes:
        return {"alerts": 0}
    note = ai.generate("\n".join(changes), system="Explain these website traffic changes in plain words: the likely cause and one suggested action each.", max_output_tokens=400).text
    send_gmail("you@example.com", f"Traffic alert: {len(changes)} unusual changes", f"{note}\n\n" + "\n".join(changes))
    return {"alerts": len(changes)}

FAQ

Common questions

What counts as a sharp change?
A move of more than 30% from the average of the same weekday over the past four weeks, by default. You can set your own threshold.
Will it alert on weekends and holidays?
Comparing with the same weekday avoids most false alarms from normal weekly patterns. Holidays can still cause alerts, which are easy to ignore.
Which numbers does it watch?
Sessions, conversions and traffic per source by default. Add revenue or specific pages in the prompt.
What permissions does it need?
GA4 Viewer; gmail.send. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly AI allowance.
How many runs does it use?
One run each time it runs (daily). 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 “Get an email when your website traffic changes sharply” from your assistant

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