@ainyc/canonry 4.23.0 → 4.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,8 +30,14 @@ Two tables, populated from server-log adapters:
30
30
  | `raw_event_samples` | Bounded forensic samples (≤100 per sync) for spot-checking |
31
31
 
32
32
  Each `traffic_sources` row is one server-log integration for a project.
33
- Today's only adapter is `cloud-run`; future adapters slot in by
34
- implementing the same contract.
33
+ Adapters today:
34
+
35
+ | Adapter | Source | Best for |
36
+ |---|---|---|
37
+ | `cloud-run` | GCP Cloud Run request logs via Logging API | Any service running on Cloud Run |
38
+ | `wordpress` | The Canonry Traffic Logger WP plugin's REST endpoint | WordPress sites where you control wp-admin |
39
+
40
+ Future adapters slot in by implementing the same contract.
35
41
 
36
42
  ## Connecting a Cloud Run source
37
43
 
@@ -56,6 +62,48 @@ Credentials are stored in `~/.canonry/config.yaml` (not the DB). The
56
62
  canonical key lives only on the host that runs `canonry serve`. The
57
63
  sync flow does NOT echo the private key back in any response.
58
64
 
65
+ ## Connecting a WordPress source
66
+
67
+ The WordPress adapter pulls events from the **Canonry Traffic Logger**
68
+ WordPress plugin, which captures every non-admin GET page-load and
69
+ exposes a paginated REST endpoint protected by an Application Password.
70
+
71
+ ```bash
72
+ # 1. Install the plugin. Download the latest release zip from the
73
+ # canonry-traffic-logger plugin's GitHub release (the repo CI workflow
74
+ # publishes a zip on every plugin-file change), then in wp-admin:
75
+ # Plugins → Add New → Upload Plugin → upload + activate.
76
+
77
+ # 2. In wp-admin, create an Application Password for the operator user:
78
+ # Users → Profile → Application Passwords. Copy the generated password.
79
+
80
+ # 3. (Optional) Adjust the retention window:
81
+ # Settings → Canonry Traffic Logger. The retention input clamps to
82
+ # 7–365 days; default is 90. The page also shows the current event
83
+ # count and the oldest event timestamp.
84
+
85
+ # 4. Connect from canonry CLI:
86
+ canonry traffic connect wordpress <project> \
87
+ --url https://example.com \
88
+ --username admin \
89
+ --app-password "xxxx xxxx xxxx xxxx xxxx xxxx"
90
+ ```
91
+
92
+ What the events table looks like (mirrors the TS
93
+ `WordpressTrafficEventPayload`):
94
+
95
+ | Column | Meaning |
96
+ |---|---|
97
+ | `observed_at` | ISO 8601 UTC timestamp with millisecond precision |
98
+ | `method`, `host`, `path`, `query_string` | Split `REQUEST_URI` parts |
99
+ | `status` | HTTP response status code |
100
+ | `user_agent`, `referer` | Headers as captured at request time |
101
+ | `remote_ip_hash` | First 12 hex chars of `sha256(ip + per-site-salt)` |
102
+
103
+ The plugin auto-prunes events older than the retention window (default
104
+ 90 days) once per day via WP-Cron. Operators who want a different
105
+ window change it in `Settings → Canonry Traffic Logger`.
106
+
59
107
  ## Syncing data
60
108
 
61
109
  ```bash
@@ -160,8 +208,7 @@ domains, or PII are surfaced.
160
208
  rDNS-verified hits. Unverified bots claim a known UA but couldn't be
161
209
  cross-confirmed via reverse-DNS — they may be the real bot or an
162
210
  imitator. Don't promote unverified counts in client-facing copy.
163
- - **Cloud Run only in v1.** WordPress plugin and other adapters are
164
- planned. The doctor checks and the report renderer are already
165
- adapter-agnostic — adding a new adapter is just a new entry in
166
- `traffic_sources.source_type` and a `TrafficSourceValidator`
167
- registration.
211
+ - **Two adapters shipped (Cloud Run + WordPress); more planned.** The
212
+ doctor checks and the report renderer are adapter-agnostic — adding
213
+ a new adapter is just a new entry in `traffic_sources.source_type`
214
+ and a `TrafficSourceValidator` registration.