Skip to content

Add GA4 usage collection and summary report - #66

Merged
Robbie1977 merged 1 commit into
masterfrom
feature/ga4-usage-reports
Sep 21, 2026
Merged

Robbie1977 merged 1 commit into
masterfrom
feature/ga4-usage-reports

Conversation

@Robbie1977

Copy link
Copy Markdown
Contributor

What changed
Two new scripts in src/. ga4_usage_collect.py pulls aggregate counts from the virtualflybrain.org GA4 property and writes them as TSV to VFB_reporting_results/analytics/ga4/. ga4_usage_summary.py builds usage_report.md from those files alone. requirements.txt gains google-auth.

Why
GA4 purges user- and event-level data at the end of its retention period, so long-term usage trends are lost unless the aggregate counts are copied out. Only summed counts are stored. No user ids are requested, GA4 never exposes IP addresses, and city rows are monthly with a floor of 5 users.

How to test
Set GA4_SERVICE_ACCOUNT_KEY_PATH to a key with Viewer access on property 375054915, then run python ga4_usage_collect.py followed by python ga4_usage_summary.py from src/. A default run pulls the last 4 days plus the current month. --start 2023-05-01 backfills and --tables limits the run.

Follow-ups
Event parameters are invisible until custom dimensions are registered on the property. The viewer sends no search event, so typed search terms are not captured.

GA4 purges user- and event-level data after its retention period, so
long-term usage trends are lost unless the aggregate counts are copied
out. ga4_usage_collect.py stores daily and monthly sums (traffic, hosts,
countries, cities, sources, pages, viewed terms, events, load times) as
TSV in VFB_reporting_results/analytics/ga4; ga4_usage_summary.py builds
usage_report.md from those files alone. Only summed counts are kept:
no user ids, and city rows need at least 5 users in a month.
@Robbie1977
Robbie1977 merged commit 201d245 into master Sep 21, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant