Skip to content

Daily

Get a Slack alert when a page loses traffic

Each morning, Slack lists the pages whose traffic fell most compared with the previous 28 days, with a likely reason and a suggested fix.

Runs
Daily
Apps
Google Analytics, Slack
AI
Yes, uses the built-in AI allowance
Access
GA4 read; chat:write

Send this to your assistant

Create a ClickRuntime automation: every morning, compare each page's GA4 sessions over the last 7 days with the 28 days before. Post the pages that dropped by more than 30% to #seo with an AI note on the likely cause and what to check.

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 publisher with hundreds of articles relies on a few dozen for most of its traffic. When one of them slips in search, or a link from a partner site disappears, nobody notices for weeks because overall traffic barely moves.

Checking every page daily and flagging the ones that are slipping lets the team fix a problem while it is still small.

What you get out of it

  • Slipping pages are caught early

    A page losing traffic is flagged within days, not discovered in a quarterly review.

  • Hidden by the totals

    Overall traffic can look fine while important pages fall; page-level checks find them.

  • A starting point for the fix

    AI suggests what to check, such as a lost ranking, a broken link or an out-of-date page.

  • Only pages that matter

    Pages with very little traffic are ignored, so the list stays short.

How it works

What happens, step by step

  1. Every morning, ClickRuntime asks Google Analytics for sessions per page over the last 7 days and the 28 days before.

  2. It compares each page's daily average across the two periods and skips low-traffic pages.

  3. If no page dropped by more than 30%, nothing is posted.

  4. Otherwise AI suggests a likely cause and what to check, and the list is posted to your #seo Slack channel.

Before it runs live

  • Connect Google Analytics
  • Connect Slack, then invite the app to the channel (type /invite @ClickRuntime there)

What you get

RunsDaily
Get a Slack alert when a page loses traffictoday, 9:00Succeeded
Slack · #seo📉 Pages losing traffic /guides/warehouse-layout: 38/day vs 112/day (−66%). Likely a lost search ranking; check the page title and whether a newer Acme guide now outranks it.

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 Google Sheets
  • Combine it with other Google Analytics and Slack 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_traffic_drop_opportunity_alerts.pyexample
from clickruntime import on_trigger, http, credentials, ai, notify

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):
    rows = ga({"dateRanges": [{"startDate": "7daysAgo", "endDate": "yesterday"}, {"startDate": "35daysAgo", "endDate": "8daysAgo"}],
               "dimensions": [{"name": "pagePath"}], "metrics": [{"name": "sessions"}], "limit": 2000})
    pages = {}
    for r in rows:
        p = pages.setdefault(r["dimensionValues"][0]["value"], [0, 0])
        p[0 if r["dimensionValues"][1]["value"] == "date_range_0" else 1] = int(r["metricValues"][0]["value"])
    drops = []
    for page, (recent, before) in pages.items():
        recent_avg, before_avg = recent / 7, before / 28
        if before >= 50 and recent_avg < before_avg * 0.7:
            drops.append(f"{page}: {recent_avg:.0f}/day vs {before_avg:.0f}/day ({(recent_avg - before_avg) / before_avg * 100:.0f}%)")
    if not drops:
        return {"drops": 0}
    note = ai.generate("\n".join(drops[:20]), system="For these pages losing traffic, give the most likely cause and what to check, one line each.",
                       max_output_tokens=500).text
    notify.slack(f"📉 Pages losing traffic\n{note}", channel="#seo")
    return {"drops": len(drops)}

FAQ

Common questions

Why compare 7 days with the previous 28?
It smooths out daily noise and weekend dips while still reacting within a week.
Which pages are ignored?
Pages with fewer than 50 sessions in the earlier period, by default. You can change that threshold.
Does it post every day?
Only on days when at least one page dropped past the threshold.
What permissions does it need?
GA4 read; chat:write. 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 a Slack alert when a page loses traffic” from your assistant

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