Weekly Metrics Report Cron Job
Every Monday at 9am, pull last week's analytics and email yourself a summary — no dashboard required.
0 9 * * 1
At 09:00 AM, every Monday
What this schedule does
The expression 0 9 * * 1 fires once a week — at 9:00 AM every Monday. 1 in the day-of-week field means Monday (0=Sunday, 6=Saturday). It's the canonical "start-of-week review" schedule, giving you a fresh summary before your week begins.
What to include in the report
A weekly metrics report script queries your key data sources and formats the results. Common data points:
- Pageviews, unique visitors, and top pages (Google Analytics, Plausible, Vercel Analytics)
- Revenue and MRR (Stripe API)
- New signups or activations
- GitHub stars, npm downloads, or other vanity metrics you track
- Error rate and uptime from your monitoring tool
- Week-over-week comparison for each metric
Python script example
import os, json, smtplib
from datetime import datetime, timedelta
from email.mime.text import MIMEText
import requests
# Date range: last 7 days
end = datetime.now()
start = end - timedelta(days=7)
# Pull from Plausible Analytics API
resp = requests.get(
"https://plausible.io/api/v1/stats/aggregate",
headers={"Authorization": f"Bearer {os.environ['PLAUSIBLE_TOKEN']}"},
params={
"site_id": "yoshi.tools",
"period": "7d",
"metrics": "visitors,pageviews,bounce_rate"
}
)
stats = resp.json()["results"]
# Format and send email
body = f"""
Weekly Report — {start.strftime('%b %d')} to {end.strftime('%b %d')}
Visitors: {stats['visitors']['value']:,}
Pageviews: {stats['pageviews']['value']:,}
Bounce rate: {stats['bounce_rate']['value']}%
"""
msg = MIMEText(body)
msg["Subject"] = f"Weekly Report – {end.strftime('%b %d, %Y')}"
msg["From"] = os.environ["FROM_EMAIL"]
msg["To"] = os.environ["TO_EMAIL"]
with smtplib.SMTP_SSL("smtp.gmail.com", 465) as server:
server.login(os.environ["SMTP_USER"], os.environ["SMTP_PASS"])
server.send_message(msg)
Platform snippets
Standard crontab
0 9 * * 1 /usr/local/bin/weekly-report.py >> /var/log/weekly-report.log 2>&1
GitHub Actions
on:
schedule:
- cron: '0 9 * * 1' # UTC
jobs:
weekly-report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install requests
- run: python scripts/weekly_report.py
env:
PLAUSIBLE_TOKEN: ${{ secrets.PLAUSIBLE_TOKEN }}
SMTP_USER: ${{ secrets.SMTP_USER }}
SMTP_PASS: ${{ secrets.SMTP_PASS }}
TO_EMAIL: you@example.com
AWS EventBridge
cron(0 9 ? * MON *)
Kubernetes CronJob
apiVersion: batch/v1
kind: CronJob
metadata:
name: weekly-report
spec:
schedule: "0 9 * * 1"
jobTemplate:
spec:
template:
spec:
containers:
- name: reporter
image: your-image:latest
command: ["python", "weekly_report.py"]
restartPolicy: OnFailure