Skip to content

On a schedule

Log daily website KPIs and get alerted when one drops

Every day yesterday's key numbers go into a sheet, and you are alerted in Slack and by email if any falls well below its recent average.

Runs
On a schedule
Apps
Google Analytics, Google Sheets
AI
Optional
Access
GA4 Viewer; Sheets write

Send this to your assistant

Create a ClickRuntime automation: every morning, add yesterday's GA4 sessions, conversions and revenue to my KPI sheet. If any is more than 25% below its 7-day average, post an alert to #marketing and email 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

An online shop watches three numbers: visits, orders and revenue. When one falls, the team wants to know the next morning, not when the month-end report comes out. Checking GA4 every day is a chore that gets dropped during busy weeks.

Logging the numbers daily and alerting only on a real drop gives the team a reliable history and a fast warning, without anyone checking a dashboard.

What you get out of it

  • Problems caught the next morning

    A sharp fall in orders or revenue is flagged within a day.

  • A daily log for charts

    One row per day makes it easy to chart the numbers and spot patterns.

  • Quiet on normal days

    Alerts only go out when a number really drops, so they are taken seriously.

  • Optional explanation

    With AI on, the alert includes a likely reason, such as a traffic source that fell away.

How it works

What happens, step by step

  1. Every morning, ClickRuntime asks Google Analytics for yesterday's sessions, conversions and revenue.

  2. It adds them as a new row in your KPI sheet.

  3. It compares each number with the average of the previous seven days in the sheet.

  4. If any is more than 25% lower, an alert goes to your #marketing Slack channel and your email, with a short AI explanation if available.

Before it runs live

  • Connect Google Analytics
  • Connect your Google Sheets account and pick the spreadsheets it may use

What you get

RunsOn a schedule
Log daily website KPIs and get alerted when one dropstoday, 9:00Succeeded
Slack · #marketing📉 KPI drop yesterday conversions: 18 vs 7-day average 41 (−56%). Sessions were normal, so the checkout is worth checking.

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 Google Analytics and Google Sheets 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.
daily_ga4_kpi_check_with_alerts.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from datetime import date, timedelta
from clickruntime import on_trigger, http, credentials, ai, notify

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

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", [])

SHEET_ID = "your-spreadsheet-id"
METRICS = ["sessions", "conversions", "purchaseRevenue"]

@on_trigger
def run(event):
    r = ga({"dateRanges": [{"startDate": "yesterday", "endDate": "yesterday"}], "metrics": [{"name": m} for m in METRICS]})
    today, drops = [float(v["value"]) for v in r[0]["metricValues"]] if r else [0.0] * 3, []
    sheet = api("sheets", "v4").spreadsheets().values()
    past = sheet.get(spreadsheetId=SHEET_ID, range="KPIs!A2:D").execute().get("values", [])[-7:]
    sheet.append(spreadsheetId=SHEET_ID, range="KPIs!A:D", valueInputOption="RAW", body={"values": [[(date.today() - timedelta(days=1)).isoformat()] + today]}).execute()
    for i, name in enumerate(METRICS):
        if (avg := sum(float(row[i + 1]) for row in past) / len(past) if past else 0) and today[i] < avg * 0.75:
            drops.append(f"{name}: {today[i]:,.0f} vs 7-day average {avg:,.0f} ({(today[i] - avg) / avg * 100:.0f}%)")
    if not drops:
        return {"alerts": 0}
    text = "\n".join(drops)
    try: text += "\n\n" + ai.generate(text, system="Give the most likely reason for these drops in 2 sentences.", max_output_tokens=120).text
    except ai.AIError: pass
    notify.slack(f"📉 KPI drop yesterday\n{text}", channel="#marketing")
    notify.email_me("KPI drop yesterday", text)
    return {"alerts": len(drops)}

FAQ

Common questions

Why compare with the 7-day average?
It smooths out day-to-day noise while still reacting quickly. You can choose a longer window or compare with the same weekday instead.
Where do alerts go?
To the Slack channel you choose and to your email.
Can it alert on rises too?
Yes. Ask for alerts on big jumps as well, which is useful for spotting a post that is taking off.
What permissions does it need?
GA4 Viewer; Sheets write. 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 (on a schedule). 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 “Log daily website KPIs and get alerted when one drops” from your assistant

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