auditmyvisitorsv0.3.1auditmyvisitors.casoon.de

How it works

What happens during a login and a report run, what runs on your machine and what Google sees.

auditmyvisitors is one binary on your machine. It has no server of its own: everything it knows comes from the Google APIs, read with your own login, and everything it keeps stays in your config directory (see Data and privacy).

Login

auditmyvisitors auth login uses the OAuth authorization code flow with PKCE, the flow Google recommends for installed apps. The CLI opens Google’s consent page in your browser and waits for the answer on a local listener at 127.0.0.1:9004. A random state value guards the redirect; if it does not match, the login is aborted.

Focus
auditmyvisitors auth login
auditmyvisitors auth loginThe CLI creates a PKCE verifier and a random state, opens Google's consent page in the browser and waits on 127.0.0.1:9004. Google redirects back with a code; the CLI checks the state, exchanges code and verifier for tokens and stores them in tokens.json, readable by the owner only.1. auditmyvisitors → Browser: open consent URL with challenge and stateopen consent URL withchallenge and state2. Browser → Google sign-in: you allow two read-only scopesyou allow two read-onlyscopes3. Google sign-in → Listener: redirect with code and stateredirect with code andstate4. Listener → auditmyvisitors: query stringquery string5. auditmyvisitors → Google sign-in: code and verifier for tokenscode and verifier for tokens6. Google sign-in → auditmyvisitors: access and refresh tokenaccess and refresh token7. auditmyvisitors → tokens.json: save, mode 0600save, mode 0600auditmyvisitors – PKCE verifier, stateauditmyvisitorsPKCE verifier, stateBrowserBrowserGoogle sign-inGoogle sign-inListener – 127.0.0.1:9004Listener127.0.0.1:9004tokens.jsontokens.json

Source: src/auth/pkce.rs, src/auth/server.rs, src/storage/mod.rs

Show chart data
Data for auditmyvisitors auth login
No.FromToMessageKind
1auditmyvisitorsBrowseropen consent URL with challenge and statecall
2BrowserGoogle sign-inyou allow two read-only scopescall
3Google sign-inListenerredirect with code and statecall
4Listenerauditmyvisitorsquery stringreply
5auditmyvisitorsGoogle sign-incode and verifier for tokenscall
6Google sign-inauditmyvisitorsaccess and refresh tokenreply
7auditmyvisitorstokens.jsonsave, mode 0600call
Focus
auditmyvisitors auth login
auditmyvisitors auth loginThe CLI creates a PKCE verifier and a random state, opens Google's consent page in the browser and waits on 127.0.0.1:9004. Google redirects back with a code; the CLI checks the state, exchanges code and verifier for tokens and stores them in tokens.json, readable by the owner only.1. auditmyvisitors → Browser: open consent URL with challenge and stateopen consent URL withchallenge and state2. Browser → Google sign-in: you allow two read-only scopesyou allow two read-onlyscopes3. Google sign-in → Listener: redirect with code and stateredirect with code andstate4. Listener → auditmyvisitors: query stringquery string5. auditmyvisitors → Google sign-in: code and verifier for tokenscode and verifier for tokens6. Google sign-in → auditmyvisitors: access and refresh tokenaccess and refresh token7. auditmyvisitors → tokens.json: save, mode 0600save, mode 0600auditmyvisitors – PKCE verifier, stateauditmyvisitorsPKCE verifier, stateBrowserBrowserGoogle sign-inGoogle sign-inListener – 127.0.0.1:9004Listener127.0.0.1:9004tokens.jsontokens.json

Source: src/auth/pkce.rs, src/auth/server.rs, src/storage/mod.rs

Show chart data
Data for auditmyvisitors auth login
No.FromToMessageKind
1auditmyvisitorsBrowseropen consent URL with challenge and statecall
2BrowserGoogle sign-inyou allow two read-only scopescall
3Google sign-inListenerredirect with code and statecall
4Listenerauditmyvisitorsquery stringreply
5auditmyvisitorsGoogle sign-incode and verifier for tokenscall
6Google sign-inauditmyvisitorsaccess and refresh tokenreply
7auditmyvisitorstokens.jsonsave, mode 0600call

The access token is refreshed automatically with the stored refresh token when it has expired. auditmyvisitors auth logout deletes tokens.json.

A report run

Every report and every export goes through the same steps. Nothing is cached between runs: each run fetches live data, so the numbers match what GA4 and Search Console show at that moment.

Focus
One report run
One report runA report reads the selected property from config.toml and an access token from tokens.json, refreshing it at Google sign-in when it has expired. It then asks the GA4 Data API and, if a Search Console property is selected, the Search Console API, matches both per page, applies the insight rules and prints the result or writes an export. report overview also stores a snapshot of the day's key metrics.Your machineGoogle, read-onlyreport or export → config.tomlconfig.toml → Token expired?Token expired? → Google sign-in: yesToken expired? → GA4 Data API: noGoogle sign-in → GA4 Data APIGA4 Data API → Search Console API: if selectedGA4 Data API → Match per page: GA4 onlySearch Console API → Match per pageMatch per page → Insights, scoresInsights, scores → TerminalInsights, scores → PDF, CSV, JSON: exportInsights, scores → Snapshot: overviewyesnoif selectedGA4 onlyexportoverviewreport or export – subcommand or menureport or exportsubcommand or menuconfig.toml – property, defaultsconfig.tomlproperty, defaultsToken expired? – tokens.jsonToken expired?tokens.jsonGoogle sign-in – token refreshGoogle sign-intoken refreshGA4 Data API – runReportGA4 Data APIrunReportSearch Console API – search analyticsSearch Console APIsearch analyticsMatch per page – GA4 path, Search Console URLMatch per pageGA4 path, Search Console URLInsights, scores – explicit rulesInsights, scoresexplicit rulesTerminalTerminalPDF, CSV, JSONPDF, CSV, JSONSnapshot – report overviewSnapshotreport overview

Source: src/main.rs, src/auth/refresh.rs, src/google/, src/helpers/mod.rs, src/insights/, src/snapshots/, src/export/

Show chart data
Data for One report run
StepKindLaneLeads to
report or exportstartYour machineconfig.toml
config.tomldata storeYour machineToken expired?
Token expired?decisionYour machineGoogle sign-in (yes), GA4 Data API (no)
Google sign-inexternalGoogle, read-onlyGA4 Data API
GA4 Data APIexternalGoogle, read-onlySearch Console API (if selected), Match per page (GA4 only)
Search Console APIexternalGoogle, read-onlyMatch per page
Match per pagestepYour machineInsights, scores
Insights, scoresstepYour machineTerminal, PDF, CSV, JSON (export), Snapshot (overview)
TerminalendYour machine
PDF, CSV, JSONendYour machine
Snapshotdata storeYour machine
Focus
One report run
One report runA report reads the selected property from config.toml and an access token from tokens.json, refreshing it at Google sign-in when it has expired. It then asks the GA4 Data API and, if a Search Console property is selected, the Search Console API, matches both per page, applies the insight rules and prints the result or writes an export. report overview also stores a snapshot of the day's key metrics.Your machineGoogle, read-onlyreport or export → config.tomlconfig.toml → Token expired?Token expired? → Google sign-in: yesToken expired? → GA4 Data API: noGoogle sign-in → GA4 Data APIGA4 Data API → Search Console API: if selectedGA4 Data API → Match per page: GA4 onlySearch Console API → Match per pageMatch per page → Insights, scoresInsights, scores → TerminalInsights, scores → PDF, CSV, JSON: exportInsights, scores → Snapshot: overviewyesnoif selectedGA4 onlyexportoverviewreport or export – subcommand or menureport or exportsubcommand or menuconfig.toml – property, defaultsconfig.tomlproperty, defaultsToken expired? – tokens.jsonToken expired?tokens.jsonGoogle sign-in – token refreshGoogle sign-intoken refreshGA4 Data API – runReportGA4 Data APIrunReportSearch Console API – search analyticsSearch Console APIsearch analyticsMatch per page – GA4 path, Search Console URLMatch per pageGA4 path, Search Console URLInsights, scores – explicit rulesInsights, scoresexplicit rulesTerminalTerminalPDF, CSV, JSONPDF, CSV, JSONSnapshot – report overviewSnapshotreport overview

Source: src/main.rs, src/auth/refresh.rs, src/google/, src/helpers/mod.rs, src/insights/, src/snapshots/, src/export/

Show chart data
Data for One report run
StepKindLaneLeads to
report or exportstartYour machineconfig.toml
config.tomldata storeYour machineToken expired?
Token expired?decisionYour machineGoogle sign-in (yes), GA4 Data API (no)
Google sign-inexternalGoogle, read-onlyGA4 Data API
GA4 Data APIexternalGoogle, read-onlySearch Console API (if selected), Match per page (GA4 only)
Search Console APIexternalGoogle, read-onlyMatch per page
Match per pagestepYour machineInsights, scores
Insights, scoresstepYour machineTerminal, PDF, CSV, JSON (export), Snapshot (overview)
TerminalendYour machine
PDF, CSV, JSONendYour machine
Snapshotdata storeYour machine
  • Two sources, one view. GA4 reports page paths, Search Console full URLs. Where a report uses both, they are matched per page path, so sessions and engagement sit next to clicks, impressions, CTR and position. Which reports need Search Console is listed under Reports.
  • Rules, not a language model. Insights, the management summary and the opportunity score come from explicit rules in the code. The limits the insight rules use are settings in config.toml, not constants.
  • Snapshots. report overview stores the day’s key metrics, so a run on a later day can show the change since then.
  • Retries. Each Google request is tried up to three times on rate limits and server errors and times out after 30 seconds.

The Google APIs it reads

API Used for Scope
Google Analytics Admin API listing the GA4 properties you can read analytics.readonly
Google Analytics Data API traffic, engagement, channels, devices, countries analytics.readonly
Search Console API clicks, impressions, CTR, position; sitemaps and URL inspection for the PDF webmasters.readonly

Both scopes are read-only: auditmyvisitors cannot change anything in GA4 or Search Console.

Edit this page on GitHub · Docs for v0.3.1