Introduction
SEO reporting takes 1-2 hours per client per month. With 10 clients, that’s 10-20 hours of report writing. Automated SEO reports pull data from Google Search Console, Analytics, and rank trackers, then generate a professional PDF — in seconds.
This post builds a complete SEO reporting automation system.
What to include in an SEO report
Key metrics (must-have)
- Organic traffic (sessions, users, page views)
- Keyword rankings (position changes)
- Click-through rate (CTR)
- Impressions
- Top-performing pages
Secondary metrics (nice-to-have)
- Backlinks gained/lost
- Technical SEO issues
- Core Web Vitals
- Indexed pages
- Crawl errors
Actionable insights (most important)
- What improved and why
- What declined and why
- Recommendations for next month
Step 1: Fetch data from Google Search Console
from googleapiclient.discovery import build
from google.oauth2 import service_account
from datetime import datetime, timedelta
creds = service_account.Credentials.from_service_account_file(
"service_account.json",
scopes=["https://www.googleapis.com/auth/webmasters.readonly"],
)
service = build("searchconsole", "v1", credentials=creds)
def get_gsc_data(site_url, days=30):
"""Fetch search analytics from Google Search Console."""
end_date = datetime.now().date()
start_date = end_date - timedelta(days=days)
request = {
"startDate": str(start_date),
"endDate": str(end_date),
"dimensions": ["query"],
"rowLimit": 25,
"dimensionFilterGroups": [],
}
response = service.searchanalytics().query(siteUrl=site_url, body=request).execute()
rows = response.get("rows", [])
keywords = []
for row in rows:
keywords.append({
"query": row["keys"][0],
"clicks": row["clicks"],
"impressions": row["impressions"],
"ctr": round(row["ctr"] * 100, 2),
"position": round(row["position"], 1),
})
return keywords
# Usage
keywords = get_gsc_data("https://techwithgalvan.in")
for k in keywords[:5]:
print(f"{k['query']}: pos {k['position']}, {k['clicks']} clicks, {k['impressions']} impressions")
Step 2: Fetch data from Google Analytics 4
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from google.analytics.data_v1beta.types import RunReportRequest, DateRange, Metric, Dimension
def get_ga4_data(property_id, days=30):
"""Fetch traffic data from Google Analytics 4."""
client = BetaAnalyticsDataClient()
end_date = datetime.now().date()
start_date = end_date - timedelta(days=days)
request = RunReportRequest(
property=f"properties/{property_id}",
date_ranges=[DateRange(start_date=str(start_date), end_date=str(end_date))],
metrics=[
Metric(name="sessions"),
Metric(name="totalUsers"),
Metric(name="screenPageViews"),
Metric(name="organicGoogleSearchClicks"),
],
)
response = client.run_report(request)
metrics = {}
for row in response.rows:
metrics = {
"sessions": int(row.metric_values[0].value),
"users": int(row.metric_values[1].value),
"page_views": int(row.metric_values[2].value),
"organic_clicks": int(row.metric_values[3].value),
}
return metrics
Step 3: Generate the report (PDF)
from fpdf import FPDF
def generate_seo_report(client_name, site_url, gsc_data, ga4_data, month, year):
pdf = FPDF()
pdf.add_page()
# Header
pdf.set_font("Arial", "B", 16)
pdf.cell(0, 10, f"SEO Report — {client_name}", ln=True, align="C")
pdf.set_font("Arial", "", 12)
pdf.cell(0, 8, f"{month} {year} | {site_url}", ln=True, align="C")
pdf.ln(5)
# Traffic overview
pdf.set_font("Arial", "B", 14)
pdf.cell(0, 10, "Traffic Overview", ln=True)
pdf.set_font("Arial", "", 11)
pdf.cell(0, 7, f"Sessions: {ga4_data['sessions']:,}", ln=True)
pdf.cell(0, 7, f"Users: {ga4_data['users']:,}", ln=True)
pdf.cell(0, 7, f"Page Views: {ga4_data['page_views']:,}", ln=True)
pdf.cell(0, 7, f"Organic Clicks (GSC): {ga4_data['organic_clicks']:,}", ln=True)
pdf.ln(5)
# Top keywords
pdf.set_font("Arial", "B", 14)
pdf.cell(0, 10, "Top Keywords", ln=True)
pdf.set_font("Arial", "B", 9)
pdf.cell(80, 7, "Keyword", border=1)
pdf.cell(25, 7, "Position", border=1)
pdf.cell(30, 7, "Clicks", border=1)
pdf.cell(35, 7, "Impressions", border=1)
pdf.cell(20, 7, "CTR", border=1, ln=True)
pdf.set_font("Arial", "", 9)
for kw in gsc_data[:15]:
pdf.cell(80, 7, kw["query"][:40], border=1)
pdf.cell(25, 7, str(kw["position"]), border=1)
pdf.cell(30, 7, str(kw["clicks"]), border=1)
pdf.cell(35, 7, str(kw["impressions"]), border=1)
pdf.cell(20, 7, f"{kw['ctr']}%", border=1, ln=True)
pdf.ln(5)
# Recommendations
pdf.set_font("Arial", "B", 14)
pdf.cell(0, 10, "Recommendations", ln=True)
pdf.set_font("Arial", "", 11)
recommendations = generate_recommendations(gsc_data, ga4_data)
for rec in recommendations:
pdf.cell(0, 7, f"• {rec}", ln=True)
pdf.ln(5)
pdf.set_font("Arial", "I", 9)
pdf.cell(0, 6, "Generated automatically. Questions? Reply to this email.", ln=True)
filename = f"seo_report_{client_name.replace(' ', '_')}_{month}_{year}.pdf"
pdf.output(filename)
return filename
def generate_recommendations(gsc_data, ga4_data):
"""Generate actionable recommendations based on data."""
recs = []
# Check for keywords on page 2
page2 = [k for k in gsc_data if 11 <= k["position"] <= 20]
if page2:
recs.append(f"Push {len(page2)} keywords from page 2 to page 1 (positions 11-20)")
# Check for high impressions, low CTR
low_ctr = [k for k in gsc_data if k["impressions"] > 100 and k["ctr"] < 2]
if low_ctr:
recs.append(f"Improve title tags/meta descriptions for {len(low_ctr)} high-impression, low-CTR keywords")
# Check organic traffic trend
if ga4_data.get("organic_clicks", 0) > 0:
recs.append("Organic traffic is growing — continue current SEO strategy")
if not recs:
recs.append("Maintain current SEO efforts. No major issues detected.")
return recs
Step 4: Send via email
import resend, os, base64
resend.api_key = os.environ["RESEND_API_KEY"]
def send_report(client_name, client_email, filename, month, year):
with open(filename, "rb") as f:
pdf_data = base64.b64encode(f.read()).decode()
resend.Emails.send({
"from": "SEO Reports <[email protected]>",
"to": [client_email],
"subject": f"SEO Report — {client_name} — {month} {year}",
"html": f"""
<p>Hi {client_name},</p>
<p>Please find attached your monthly SEO report for {month} {year}.</p>
<p>Key highlights:</p>
<ul>
<li>Organic traffic: [X] sessions</li>
<li>Top keyword: [keyword] (position [X])</li>
<li>New backlinks: [X]</li>
</ul>
<p>Let me know if you have any questions!</p>
""",
"attachments": [{"filename": filename, "content": pdf_data}],
})
print(f"Report sent to {client_name}")
Step 5: Automate with cron
# Run on the 1st of every month at 9 AM
0 9 1 * * cd /path/to/project && python generate_seo_reports.py
Or GitHub Actions:
name: Monthly SEO Reports
on:
schedule:
- cron: '0 9 1 * *'
jobs:
reports:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install fpdf google-api-python-client google-analytics-data
- run: python generate_seo_reports.py
Common mistakes
- No recommendations — data without insights is useless. Always include 2-3 actionable recommendations.
- Too long — 2-3 pages max. Clients skim.
- Late delivery — send on the 1st or 2nd of the month.
- Generic template — customize for each client’s KPIs.
- No visual — include at least one chart (traffic trend).
- Not tracking month-over-month — show changes, not just current numbers.
Key Concepts
- Google Search Console (GSC) = free tool for search performance data
- Google Analytics 4 (GA4) = website analytics platform
- Organic traffic = visitors from search engines
- Keyword ranking = position in search results
- CTR = click-through rate (clicks / impressions)
- Backlinks = links from other websites to yours
What to Try Next
- Automate monthly reports for all clients
- Track Google rankings automatically
- Build an SEO dashboard in Streamlit
- Organise client projects with a system
FAQ
How much does SEO reporting automation cost?
Google Search Console and Analytics are free. The script runs on GitHub Actions (free). Total cost: $0. The only cost is your time to set it up (2-3 hours).
Can I use this for multiple clients?
Yes — create a config file with each client’s site URL, property ID, and email. The script loops through all clients and generates/sends reports for each.
What if the client doesn’t have Google Search Console set up?
Set it up for them: search.google.com/search-console → Add property → Verify ownership (HTML file, DNS, or Google Analytics). It takes 5 minutes and provides invaluable data.
How do I handle clients who want custom metrics?
Add custom sections to the report template. Common custom metrics: social media followers, email subscribers, lead count, revenue attributed to organic search. See Auto-Send Monthly Reports.