On a schedule
Write a monthly search traffic report to a sheet
Each month, organic search traffic by landing page is written to a sheet with the change from the month before, and you get an email listing the best opportunities.
- Runs
- On a schedule
- Apps
- Google Analytics, Google Sheets
- AI
- Yes, uses the built-in AI allowance
- Access
- GA4 Viewer; Sheets write
Send this to your assistant
Create a ClickRuntime automation: on the 1st of every month, write last month's organic search sessions and conversions per landing page from GA4 to a new tab in my SEO sheet, with the change from the previous month. Have AI list the top 5 opportunities and email them to me.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
An agency reports search performance to a dozen clients each month. Every report starts with the same GA4 exploration, exported and pasted into a sheet, before anyone can start on the analysis the client actually pays for.
Writing the month's landing page data straight into a sheet, with a first list of opportunities, means the team starts each report at the interesting part.
What you get out of it
The groundwork is done
Each month's data is in the sheet on the 1st, ready to analyse.
Month-on-month at a glance
Every page shows its change from the previous month, so winners and losers stand out.
Opportunities to start from
AI points out pages with traffic but few conversions, or pages that are slipping, as a first list to review.
A tab per month
Past months stay in their own tabs for comparison and client history.
How it works
What happens, step by step
On the 1st of each month, ClickRuntime asks Google Analytics for organic search sessions and conversions by landing page for the last two months.
It works out each page's change from the month before.
The table is written to a new tab in your SEO sheet.
AI reviews the table and picks out the top opportunities, which are emailed to you.
Before it runs live
- Connect Google Analytics
- Connect your Google Sheets account and pick the spreadsheets it may use
What you get
Build your own
Need it to work differently?
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
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from datetime import date
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"
ORGANIC = {"filter": {"fieldName": "sessionDefaultChannelGroup", "stringFilter": {"value": "Organic Search"}}}
@on_trigger
def run(event):
rows = ga({"dateRanges": [{"startDate": "30daysAgo", "endDate": "yesterday"}, {"startDate": "60daysAgo", "endDate": "31daysAgo"}],
"dimensions": [{"name": "landingPage"}], "metrics": [{"name": "sessions"}, {"name": "conversions"}], "dimensionFilter": ORGANIC, "limit": 1000})
pages = {}
for r in rows:
pages.setdefault(r["dimensionValues"][0]["value"], {})[r["dimensionValues"][1]["value"]] = [int(r["metricValues"][0]["value"]), float(r["metricValues"][1]["value"])]
table = [[p, *v.get("date_range_0", [0, 0]), v.get("date_range_0", [0])[0] - v.get("date_range_1", [0])[0]] for p, v in pages.items()]
table.sort(key=lambda x: -x[1])
tab = f"SEO {date.today():%Y-%m}"
sheets = api("sheets", "v4").spreadsheets()
sheets.batchUpdate(spreadsheetId=SHEET_ID, body={"requests": [{"addSheet": {"properties": {"title": tab}}}]}).execute()
sheets.values().update(spreadsheetId=SHEET_ID, range=f"{tab}!A1", valueInputOption="RAW",
body={"values": [["Landing page", "Sessions", "Conversions", "Change"]] + table}).execute()
ideas = ai.generate("\n".join(f"{r[0]} | {r[1]} | {r[2]} | {r[3]:+d}" for r in table[:150]), system="These are organic landing pages "
"(page | sessions | conversions | change). List the top 5 SEO opportunities with one action each.", max_output_tokens=500).text
notify.email_me(f"SEO report ready: {tab}", ideas)
return {"pages": len(table)}FAQ
Common questions
Does it include keywords?
Can it run for several clients?
What counts as an opportunity?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Log your weekly website numbers to a sheet
Every week your key GA4 numbers are added as a row in your reporting sheet, and you get an email summarising what changed.
See how it worksLog 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.
See how it worksLog daily GA4 traffic by source to Google Sheets
Each morning yesterday's GA4 sessions, users and key events per source / medium are appended to a Traffic tab.
See how it worksKeep exploring
Set up “Write a monthly search traffic report to a sheet” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.