claude-plugin-wordpress-manager 2.4.0 → 2.9.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.
Files changed (83) hide show
  1. package/.claude-plugin/plugin.json +10 -3
  2. package/CHANGELOG.md +103 -0
  3. package/agents/wp-content-strategist.md +104 -0
  4. package/agents/wp-monitoring-agent.md +44 -0
  5. package/agents/wp-site-manager.md +19 -0
  6. package/docs/GUIDE.md +183 -23
  7. package/docs/plans/2026-03-01-tier4-5-implementation.md +1783 -0
  8. package/docs/plans/2026-03-01-tier4-5-observability-automation-design.md +426 -0
  9. package/docs/plans/2026-03-01-wcop-reassessment-v2.6.0.md +403 -0
  10. package/hooks/hooks.json +9 -0
  11. package/package.json +19 -3
  12. package/servers/wp-rest-bridge/build/tools/comments.d.ts +6 -6
  13. package/servers/wp-rest-bridge/build/tools/cwv.d.ts +3 -0
  14. package/servers/wp-rest-bridge/build/tools/cwv.js +196 -0
  15. package/servers/wp-rest-bridge/build/tools/ga4.d.ts +3 -0
  16. package/servers/wp-rest-bridge/build/tools/ga4.js +323 -0
  17. package/servers/wp-rest-bridge/build/tools/gsc.d.ts +3 -0
  18. package/servers/wp-rest-bridge/build/tools/gsc.js +354 -0
  19. package/servers/wp-rest-bridge/build/tools/index.d.ts +38 -38
  20. package/servers/wp-rest-bridge/build/tools/index.js +18 -0
  21. package/servers/wp-rest-bridge/build/tools/media.d.ts +2 -2
  22. package/servers/wp-rest-bridge/build/tools/multisite-sites.d.ts +2 -2
  23. package/servers/wp-rest-bridge/build/tools/plausible.d.ts +3 -0
  24. package/servers/wp-rest-bridge/build/tools/plausible.js +207 -0
  25. package/servers/wp-rest-bridge/build/tools/plugin-repository.d.ts +1 -1
  26. package/servers/wp-rest-bridge/build/tools/search.d.ts +2 -2
  27. package/servers/wp-rest-bridge/build/tools/slack.d.ts +3 -0
  28. package/servers/wp-rest-bridge/build/tools/slack.js +129 -0
  29. package/servers/wp-rest-bridge/build/tools/unified-content.d.ts +8 -8
  30. package/servers/wp-rest-bridge/build/tools/unified-taxonomies.d.ts +4 -4
  31. package/servers/wp-rest-bridge/build/tools/users.d.ts +6 -6
  32. package/servers/wp-rest-bridge/build/tools/wc-coupons.d.ts +1 -1
  33. package/servers/wp-rest-bridge/build/tools/wc-customers.d.ts +3 -3
  34. package/servers/wp-rest-bridge/build/tools/wc-orders.d.ts +4 -4
  35. package/servers/wp-rest-bridge/build/tools/wc-products.d.ts +8 -8
  36. package/servers/wp-rest-bridge/build/tools/wc-webhooks.d.ts +4 -4
  37. package/servers/wp-rest-bridge/build/tools/wc-workflows.d.ts +3 -0
  38. package/servers/wp-rest-bridge/build/tools/wc-workflows.js +222 -0
  39. package/servers/wp-rest-bridge/build/wordpress.d.ts +23 -0
  40. package/servers/wp-rest-bridge/build/wordpress.js +178 -0
  41. package/servers/wp-rest-bridge/package.json +1 -0
  42. package/skills/wordpress-router/SKILL.md +1 -1
  43. package/skills/wordpress-router/references/decision-tree.md +12 -2
  44. package/skills/wp-alerting/SKILL.md +142 -0
  45. package/skills/wp-alerting/references/alert-thresholds.md +79 -0
  46. package/skills/wp-alerting/references/escalation-paths.md +92 -0
  47. package/skills/wp-alerting/references/report-scheduling.md +142 -0
  48. package/skills/wp-alerting/references/slack-integration.md +109 -0
  49. package/skills/wp-alerting/scripts/alerting_inspect.mjs +150 -0
  50. package/skills/wp-analytics/SKILL.md +158 -0
  51. package/skills/wp-analytics/references/analytics-dashboards.md +83 -0
  52. package/skills/wp-analytics/references/cwv-monitoring.md +101 -0
  53. package/skills/wp-analytics/references/ga4-integration.md +76 -0
  54. package/skills/wp-analytics/references/plausible-setup.md +92 -0
  55. package/skills/wp-analytics/references/traffic-attribution.md +92 -0
  56. package/skills/wp-analytics/scripts/analytics_inspect.mjs +153 -0
  57. package/skills/wp-content/SKILL.md +1 -0
  58. package/skills/wp-content-attribution/SKILL.md +3 -0
  59. package/skills/wp-content-optimization/SKILL.md +173 -0
  60. package/skills/wp-content-optimization/references/content-freshness.md +234 -0
  61. package/skills/wp-content-optimization/references/headline-optimization.md +171 -0
  62. package/skills/wp-content-optimization/references/meta-optimization.md +243 -0
  63. package/skills/wp-content-optimization/references/readability-analysis.md +201 -0
  64. package/skills/wp-content-optimization/references/seo-content-scoring.md +245 -0
  65. package/skills/wp-content-optimization/scripts/content_optimization_inspect.mjs +237 -0
  66. package/skills/wp-content-workflows/SKILL.md +142 -0
  67. package/skills/wp-content-workflows/references/content-lifecycle-hooks.md +131 -0
  68. package/skills/wp-content-workflows/references/multi-channel-actions.md +151 -0
  69. package/skills/wp-content-workflows/references/schedule-triggers.md +118 -0
  70. package/skills/wp-content-workflows/references/trigger-management.md +159 -0
  71. package/skills/wp-content-workflows/references/wp-action-hooks.md +114 -0
  72. package/skills/wp-content-workflows/scripts/workflow_inspect.mjs +202 -0
  73. package/skills/wp-monitoring/SKILL.md +3 -0
  74. package/skills/wp-programmatic-seo/SKILL.md +2 -0
  75. package/skills/wp-search-console/SKILL.md +122 -0
  76. package/skills/wp-search-console/references/competitor-gap-analysis.md +226 -0
  77. package/skills/wp-search-console/references/content-seo-feedback.md +181 -0
  78. package/skills/wp-search-console/references/gsc-setup.md +110 -0
  79. package/skills/wp-search-console/references/indexing-management.md +182 -0
  80. package/skills/wp-search-console/references/keyword-tracking.md +181 -0
  81. package/skills/wp-search-console/scripts/search_console_inspect.mjs +178 -0
  82. package/skills/wp-social-email/SKILL.md +1 -0
  83. package/skills/wp-webhooks/SKILL.md +1 -0
@@ -0,0 +1,150 @@
1
+ /**
2
+ * alerting_inspect.mjs — Detect alerting configuration readiness.
3
+ *
4
+ * Checks WP_SITES_CONFIG for Slack and SendGrid credentials.
5
+ * Scans for monitoring plugins and alerting infrastructure.
6
+ *
7
+ * Usage:
8
+ * node alerting_inspect.mjs [--cwd=/path/to/project]
9
+ *
10
+ * Exit codes:
11
+ * 0 — alerting configuration found
12
+ * 1 — no alerting configuration found
13
+ */
14
+
15
+ import { readFileSync, existsSync, readdirSync } from 'node:fs';
16
+ import { join, resolve } from 'node:path';
17
+ import { argv, stdout, exit } from 'node:process';
18
+
19
+ // ---------------------------------------------------------------------------
20
+ // Helpers
21
+ // ---------------------------------------------------------------------------
22
+
23
+ function readFileSafe(filePath) {
24
+ try { return readFileSync(filePath, 'utf-8'); } catch { return null; }
25
+ }
26
+
27
+ function existsSafe(filePath) {
28
+ try { return existsSync(filePath); } catch { return false; }
29
+ }
30
+
31
+ function globDir(dirPath) {
32
+ try { return readdirSync(dirPath); } catch { return []; }
33
+ }
34
+
35
+ // ---------------------------------------------------------------------------
36
+ // Detectors
37
+ // ---------------------------------------------------------------------------
38
+
39
+ function detectSlackConfig() {
40
+ const slack = { configured: false, indicators: [] };
41
+ const raw = process.env.WP_SITES_CONFIG;
42
+ if (!raw) return slack;
43
+
44
+ let sites;
45
+ try { sites = JSON.parse(raw); } catch { return slack; }
46
+ if (!Array.isArray(sites)) return slack;
47
+
48
+ for (const site of sites) {
49
+ const label = site.id || site.url || 'unknown';
50
+ if (site.slack_webhook_url) {
51
+ slack.configured = true;
52
+ slack.indicators.push(`slack_webhook_url configured for ${label}`);
53
+ }
54
+ if (site.slack_bot_token) {
55
+ slack.configured = true;
56
+ slack.indicators.push(`slack_bot_token configured for ${label}`);
57
+ }
58
+ if (site.slack_channel) {
59
+ slack.indicators.push(`slack_channel: ${site.slack_channel} for ${label}`);
60
+ }
61
+ }
62
+ return slack;
63
+ }
64
+
65
+ function detectSendGridConfig() {
66
+ const sg = { configured: false, indicators: [] };
67
+ const raw = process.env.WP_SITES_CONFIG;
68
+ if (!raw) return sg;
69
+
70
+ let sites;
71
+ try { sites = JSON.parse(raw); } catch { return sg; }
72
+ if (!Array.isArray(sites)) return sg;
73
+
74
+ for (const site of sites) {
75
+ const label = site.id || site.url || 'unknown';
76
+ if (site.sg_api_key) {
77
+ sg.configured = true;
78
+ sg.indicators.push(`sg_api_key configured for ${label}`);
79
+ }
80
+ if (site.sg_from_email) {
81
+ sg.indicators.push(`sg_from_email: ${site.sg_from_email} for ${label}`);
82
+ }
83
+ if (site.sg_from_name) {
84
+ sg.indicators.push(`sg_from_name: ${site.sg_from_name} for ${label}`);
85
+ }
86
+ }
87
+ return sg;
88
+ }
89
+
90
+ function detectMonitoringSetup(cwd) {
91
+ const monitoring = { plugins_found: false, cron_available: false, indicators: [] };
92
+
93
+ // Check for monitoring-related plugins
94
+ const pluginsDir = join(cwd, 'wp-content', 'plugins');
95
+ const plugins = globDir(pluginsDir);
96
+
97
+ const monitoringPlugins = [
98
+ 'query-monitor',
99
+ 'new-relic-reporting-for-wordpress',
100
+ 'jetpack',
101
+ 'developer',
102
+ 'wp-crontrol',
103
+ 'debug-bar',
104
+ 'health-check',
105
+ ];
106
+
107
+ for (const plugin of monitoringPlugins) {
108
+ if (plugins.includes(plugin)) {
109
+ monitoring.plugins_found = true;
110
+ monitoring.indicators.push(`plugin: ${plugin}`);
111
+ }
112
+ }
113
+
114
+ // Check for wp-cron.php availability
115
+ const cronPath = join(cwd, 'wp-cron.php');
116
+ if (existsSafe(cronPath)) {
117
+ monitoring.cron_available = true;
118
+ monitoring.indicators.push('wp-cron.php found');
119
+ }
120
+
121
+ return monitoring;
122
+ }
123
+
124
+ // ---------------------------------------------------------------------------
125
+ // Main
126
+ // ---------------------------------------------------------------------------
127
+
128
+ function main() {
129
+ const cwdArg = argv.find(a => a.startsWith('--cwd='));
130
+ const cwd = cwdArg ? resolve(cwdArg.split('=')[1]) : process.cwd();
131
+
132
+ const slack = detectSlackConfig();
133
+ const sendgrid = detectSendGridConfig();
134
+ const monitoring = detectMonitoringSetup(cwd);
135
+
136
+ const anyConfigured = slack.configured || sendgrid.configured || monitoring.plugins_found || monitoring.cron_available;
137
+
138
+ const report = {
139
+ alerting_configured: anyConfigured,
140
+ slack,
141
+ sendgrid,
142
+ monitoring,
143
+ cwd,
144
+ };
145
+
146
+ stdout.write(JSON.stringify(report, null, 2) + '\n');
147
+ exit(anyConfigured ? 0 : 1);
148
+ }
149
+
150
+ main();
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: wp-analytics
3
+ description: This skill should be used when the user asks about "analytics",
4
+ "GA4", "Google Analytics", "Plausible", "Core Web Vitals", "CWV",
5
+ "PageSpeed", "page speed", "LCP", "CLS", "INP", "TTFB", "FCP",
6
+ "traffic report", "traffic analysis", "site performance metrics",
7
+ "web vitals", "real user metrics", or mentions monitoring
8
+ WordPress site analytics and performance data.
9
+ version: 1.0.0
10
+ tags: [analytics, ga4, plausible, cwv, pagespeed, core-web-vitals]
11
+ ---
12
+
13
+ # WordPress Analytics Skill
14
+
15
+ ## Overview
16
+
17
+ Unified analytics covering 3 platforms (GA4, Plausible, Core Web Vitals) with 14 MCP tools. These tools enable traffic analysis, audience insights, performance monitoring, and cross-platform reporting directly from the WordPress management environment. By combining data from multiple analytics sources, you can build comprehensive performance dashboards, identify optimization opportunities, and track real user experience metrics.
18
+
19
+ ## When to Use
20
+
21
+ - User wants to check GA4 traffic data (sessions, pageviews, conversions)
22
+ - User needs Plausible analytics (privacy-friendly, lightweight metrics)
23
+ - User asks about Core Web Vitals scores (LCP, CLS, INP, FCP, TTFB)
24
+ - User wants PageSpeed Insights analysis for specific URLs
25
+ - User needs a combined traffic report across analytics platforms
26
+ - User asks about performance trends, audience segments, or traffic sources
27
+ - User wants to compare metrics between GA4 and Plausible
28
+ - User needs to monitor real user experience metrics from CrUX data
29
+
30
+ ## Decision Tree
31
+
32
+ 1. **What analytics platform?**
33
+ - "GA4" / "Google Analytics" / "sessions" / "conversions" → GA4 workflows (Section 1)
34
+ - "Plausible" / "privacy analytics" / "simple analytics" → Plausible workflows (Section 2)
35
+ - "Core Web Vitals" / "LCP" / "CLS" / "INP" / "PageSpeed" → CWV analysis (Section 3)
36
+ - "traffic report" / "dashboard" / "compare" → Cross-platform reporting (Sections 4-6)
37
+
38
+ 2. **Run detection first:**
39
+ ```bash
40
+ node skills/wp-analytics/scripts/analytics_inspect.mjs [--cwd=/path/to/project]
41
+ ```
42
+ This identifies configured analytics credentials and installed plugins.
43
+
44
+ ## Service Overview
45
+
46
+ | Service | Tools | Auth Type | Use Case |
47
+ |---------|-------|-----------|----------|
48
+ | Google Analytics 4 | 6 tools (`ga4_*`) | Service Account JSON | Traffic, audience, conversions |
49
+ | Plausible Analytics | 4 tools (`pl_*`) | API Key | Privacy-friendly traffic metrics |
50
+ | Core Web Vitals | 4 tools (`cwv_*`) | Google API Key | Performance and user experience |
51
+
52
+ ## Sections
53
+
54
+ ### Section 1: GA4 Setup & Configuration
55
+ See `references/ga4-integration.md`
56
+ - Service Account creation in Google Cloud Console
57
+ - GA4 Data API v1beta enablement
58
+ - WP_SITES_CONFIG setup with ga4_property_id and ga4_service_account_key
59
+ - Property ID format and account structure
60
+ - Common dimensions and metrics reference
61
+ - Quota limits and sampling considerations
62
+
63
+ ### Section 2: Plausible Setup & Configuration
64
+ See `references/plausible-setup.md`
65
+ - API key generation (cloud or self-hosted)
66
+ - WP_SITES_CONFIG setup with plausible_api_key and plausible_base_url
67
+ - Available metrics and properties
68
+ - Period and date range formats
69
+ - Filtering and breakdown options
70
+
71
+ ### Section 3: Core Web Vitals Analysis
72
+ See `references/cwv-monitoring.md`
73
+ - Metric definitions (LCP, FCP, CLS, INP, TTFB)
74
+ - Good / needs-improvement / poor thresholds
75
+ - PageSpeed Insights API usage
76
+ - CrUX API for real user data
77
+ - WP_SITES_CONFIG setup with google_api_key
78
+
79
+ ### Section 4: Traffic Report Generation
80
+ See `references/analytics-dashboards.md`
81
+ - Weekly and monthly report templates
82
+ - Key KPIs: sessions, pageviews, bounce rate, conversion rate
83
+ - Date range selection and comparison periods
84
+ - Combining data from multiple sources
85
+
86
+ ### Section 5: Performance Dashboard
87
+ See `references/analytics-dashboards.md`
88
+ - Building composite dashboards from GA4 + Plausible + CWV
89
+ - Trend analysis and alerting thresholds
90
+ - Top pages by traffic and performance score
91
+ - Audience segmentation patterns
92
+
93
+ ### Section 6: Cross-Platform Comparison
94
+ See `references/traffic-attribution.md`
95
+ - Comparing GA4 and Plausible traffic numbers
96
+ - UTM parameter tracking and source/medium mapping
97
+ - Combining analytics with WooCommerce conversion data
98
+ - Discrepancy analysis between platforms
99
+
100
+ ## Reference Files
101
+
102
+ | File | Content |
103
+ |------|---------|
104
+ | `references/ga4-integration.md` | GA4 Data API setup, service account, dimensions/metrics, quotas |
105
+ | `references/plausible-setup.md` | Plausible API key, self-hosted vs cloud, metrics, periods |
106
+ | `references/cwv-monitoring.md` | CWV metric definitions, thresholds, PageSpeed/CrUX APIs |
107
+ | `references/analytics-dashboards.md` | Dashboard patterns, report templates, KPIs, combined data |
108
+ | `references/traffic-attribution.md` | UTM params, source/medium, GA4 + WooCommerce conversions |
109
+
110
+ ## MCP Tools
111
+
112
+ | Tool | Description |
113
+ |------|-------------|
114
+ | `ga4_report` | Run a GA4 Data API report with custom dimensions and metrics |
115
+ | `ga4_realtime` | Get GA4 real-time active users and events |
116
+ | `ga4_top_pages` | Get top pages by pageviews, sessions, or engagement |
117
+ | `ga4_traffic_sources` | Get traffic source breakdown (source, medium, campaign) |
118
+ | `ga4_conversions` | Get conversion event data and goal completions |
119
+ | `ga4_audience` | Get audience demographics and technology breakdown |
120
+ | `pl_aggregate` | Get aggregate Plausible metrics for a time period |
121
+ | `pl_timeseries` | Get Plausible time-series data with configurable intervals |
122
+ | `pl_breakdown` | Get Plausible breakdown by property (page, source, country) |
123
+ | `pl_realtime` | Get Plausible real-time visitor count |
124
+ | `cwv_pagespeed` | Run PageSpeed Insights analysis on a URL |
125
+ | `cwv_crux_url` | Get CrUX real user metrics for a specific URL |
126
+ | `cwv_crux_origin` | Get CrUX real user metrics for an entire origin |
127
+ | `cwv_history` | Get CrUX historical Core Web Vitals data |
128
+
129
+ ## Recommended Agent
130
+
131
+ Use the **`wp-monitoring-agent`** for automated analytics reporting, performance alerting, and scheduled dashboard generation that combines data across all three platforms.
132
+
133
+ ## Related Skills
134
+
135
+ - **`wp-search-console`** — combine search analytics with traffic data for full SEO visibility
136
+ - **`wp-content-optimization`** — use analytics data to prioritize content optimization efforts
137
+ - **`wp-content-attribution`** — track content sources and attribute traffic to specific campaigns
138
+ - **`wp-monitoring`** — monitor site uptime and health alongside analytics performance
139
+
140
+ ## Cross-references
141
+
142
+ - GA4 setup pairs with `wp-search-console` for combined Google data workflows
143
+ - CWV monitoring feeds into `wp-performance` for technical optimization
144
+ - Traffic attribution connects to `wp-social-email` for campaign tracking
145
+ - Dashboard patterns support `wp-monitoring` alerting workflows
146
+
147
+ ## Troubleshooting
148
+
149
+ | Issue | Cause | Resolution |
150
+ |-------|-------|------------|
151
+ | GA4 returns empty data | Service account lacks Viewer role | Grant "Viewer" role on the GA4 property |
152
+ | GA4 quota exceeded | Too many API requests | Reduce request frequency; use date ranges instead of daily calls |
153
+ | Plausible 401 error | Invalid or expired API key | Regenerate API key in Plausible dashboard |
154
+ | Plausible returns no data | Site domain mismatch | Ensure site_id matches the domain registered in Plausible |
155
+ | CWV "API key not valid" | Google API key missing or restricted | Enable PageSpeed Insights API in Google Cloud Console |
156
+ | CWV no CrUX data | Low-traffic page | CrUX requires sufficient real user traffic; use lab data instead |
157
+ | Detection script exit 1 | No analytics config found | Add ga4_property_id, plausible_api_key, or google_api_key to WP_SITES_CONFIG |
158
+ | Plugin detected but no API data | Plugin handles tracking only | Plugins embed tracking code; API access requires separate credentials |
@@ -0,0 +1,83 @@
1
+ # Analytics Dashboard Patterns
2
+
3
+ ## Weekly Report Template
4
+
5
+ A weekly report should cover the most recent 7-day period compared to the previous 7 days.
6
+
7
+ ### Key Metrics Section
8
+ | KPI | This Week | Last Week | Change |
9
+ |-----|-----------|-----------|--------|
10
+ | Sessions (GA4) | — | — | +/-% |
11
+ | Unique Visitors (Plausible) | — | — | +/-% |
12
+ | Pageviews | — | — | +/-% |
13
+ | Bounce Rate | — | — | +/-pp |
14
+ | Avg. Session Duration | — | — | +/-s |
15
+ | Conversions | — | — | +/-% |
16
+ | LCP (p75) | — | — | +/-ms |
17
+ | CLS (p75) | — | — | +/- |
18
+ | INP (p75) | — | — | +/-ms |
19
+
20
+ ### Top Pages Section
21
+ List the top 10 pages by pageviews with:
22
+ - Page path and title
23
+ - Pageviews (GA4) and Visitors (Plausible)
24
+ - CWV scores if available
25
+ - Week-over-week change
26
+
27
+ ### Traffic Sources Section
28
+ Breakdown by source/medium with session counts and conversion rates.
29
+
30
+ ## Monthly Report Template
31
+
32
+ Extends the weekly report with:
33
+ - Month-over-month and year-over-year comparisons
34
+ - Audience trends (new vs returning, device split, geo distribution)
35
+ - Content performance (top 20 pages, worst performers, new content impact)
36
+ - CWV trend charts (4-week rolling averages)
37
+ - Conversion funnel analysis
38
+
39
+ ## Combining GA4 + Plausible Data
40
+
41
+ ### Why Use Both
42
+ - **GA4** provides deep behavioral data, conversion tracking, and audience segmentation
43
+ - **Plausible** provides privacy-compliant counts that may be more accurate (no adblocker filtering)
44
+ - Comparing both reveals tracking discrepancies and adblocker impact
45
+
46
+ ### Alignment Strategy
47
+ 1. Use the **same date range** for both platforms
48
+ 2. Map GA4 `sessions` to Plausible `visits` (closest equivalent)
49
+ 3. Map GA4 `activeUsers` to Plausible `visitors`
50
+ 4. Note: numbers will differ — Plausible typically shows fewer visits due to no cookie tracking
51
+ 5. Calculate the **tracking gap**: `(GA4 sessions - Plausible visits) / GA4 sessions * 100`
52
+
53
+ ### Recommended Dashboard Sections
54
+ 1. **Overview** — side-by-side GA4 and Plausible totals
55
+ 2. **Traffic Sources** — GA4 source/medium enriched with Plausible referrer data
56
+ 3. **Content Performance** — page-level metrics from both platforms
57
+ 4. **Core Web Vitals** — PageSpeed scores and CrUX field data
58
+ 5. **Conversions** — GA4 conversion events and goal completions
59
+ 6. **Trends** — time-series charts with 7-day and 30-day windows
60
+
61
+ ## Key KPIs Reference
62
+
63
+ | KPI | Source | Formula / Notes |
64
+ |-----|--------|-----------------|
65
+ | Sessions | GA4 | Total sessions in period |
66
+ | Unique Visitors | Plausible | Deduplicated visitor count |
67
+ | Pageviews | Both | Total page loads |
68
+ | Bounce Rate | GA4 | `1 - engagementRate` |
69
+ | Pages per Visit | Plausible | `pageviews / visits` |
70
+ | Avg. Duration | GA4 | `averageSessionDuration` in seconds |
71
+ | Conversion Rate | GA4 | `conversions / sessions * 100` |
72
+ | LCP (p75) | CWV | 75th percentile Largest Contentful Paint |
73
+ | CLS (p75) | CWV | 75th percentile Cumulative Layout Shift |
74
+ | INP (p75) | CWV | 75th percentile Interaction to Next Paint |
75
+ | Performance Score | PageSpeed | Lighthouse 0-100 score |
76
+
77
+ ## Report Format Guidelines
78
+
79
+ - Use **Markdown tables** for structured data
80
+ - Include **percentage changes** with directional indicators
81
+ - Flag metrics that cross CWV thresholds (good/needs-improvement/poor)
82
+ - Provide **actionable recommendations** for declining metrics
83
+ - Keep reports under 200 lines for readability
@@ -0,0 +1,101 @@
1
+ # Core Web Vitals Monitoring
2
+
3
+ ## Metric Definitions
4
+
5
+ ### LCP — Largest Contentful Paint
6
+ Measures **loading performance**. Time until the largest visible content element is rendered.
7
+ - Applies to: images, videos, block-level text elements
8
+ - Target: measures perceived load speed
9
+
10
+ ### FCP — First Contentful Paint
11
+ Measures **initial render**. Time until the first text or image is painted on screen.
12
+ - Applies to: any visible DOM content
13
+ - Target: measures time to first visual feedback
14
+
15
+ ### CLS — Cumulative Layout Shift
16
+ Measures **visual stability**. Sum of unexpected layout shift scores during the page lifecycle.
17
+ - Applies to: visible elements that move without user interaction
18
+ - Target: measures how much content jumps around
19
+
20
+ ### INP — Interaction to Next Paint
21
+ Measures **responsiveness**. Latency of user interactions (clicks, taps, key presses) throughout the page lifecycle.
22
+ - Replaced FID (First Input Delay) as a Core Web Vital in March 2024
23
+ - Target: measures overall page responsiveness
24
+
25
+ ### TTFB — Time to First Byte
26
+ Measures **server responsiveness**. Time from the request start until the first byte of the response is received.
27
+ - Includes DNS, connection, TLS, and server processing time
28
+ - Target: measures backend and network performance
29
+
30
+ ## Thresholds
31
+
32
+ | Metric | Good | Needs Improvement | Poor |
33
+ |--------|------|-------------------|------|
34
+ | LCP | <= 2.5s | 2.5s - 4.0s | > 4.0s |
35
+ | FCP | <= 1.8s | 1.8s - 3.0s | > 3.0s |
36
+ | CLS | <= 0.1 | 0.1 - 0.25 | > 0.25 |
37
+ | INP | <= 200ms | 200ms - 500ms | > 500ms |
38
+ | TTFB | <= 800ms | 800ms - 1800ms | > 1800ms |
39
+
40
+ The 75th percentile (p75) is used for assessment — meaning 75% of page loads must meet the threshold.
41
+
42
+ ## PageSpeed Insights API
43
+
44
+ ### Setup
45
+ 1. Enable **PageSpeed Insights API** in Google Cloud Console
46
+ 2. Create or use an existing API key
47
+ 3. Add `google_api_key` to WP_SITES_CONFIG
48
+
49
+ ### Request Format
50
+ ```
51
+ GET https://www.googleapis.com/pagespeedonline/v5/runPagespeed
52
+ ?url=https://example.com
53
+ &key=YOUR_API_KEY
54
+ &strategy=mobile # or "desktop"
55
+ &category=performance # also: accessibility, best-practices, seo
56
+ ```
57
+
58
+ ### Response Fields
59
+ - `lighthouseResult.categories.performance.score` — 0-100 score
60
+ - `lighthouseResult.audits['largest-contentful-paint']` — LCP details
61
+ - `lighthouseResult.audits['cumulative-layout-shift']` — CLS details
62
+ - `lighthouseResult.audits['interaction-to-next-paint']` — INP details
63
+ - `loadingExperience.metrics` — CrUX field data (if available)
64
+
65
+ ### Quota
66
+ - 25,000 queries per day (free tier)
67
+ - 400 queries per 100 seconds
68
+
69
+ ## CrUX API (Chrome UX Report)
70
+
71
+ ### Overview
72
+ CrUX provides **real user metrics** collected from Chrome users who opted into usage statistics. Unlike PageSpeed Insights (lab data), CrUX reflects actual user experience.
73
+
74
+ ### Request Format
75
+ ```
76
+ POST https://chromeuxreport.googleapis.com/v1/records:queryRecord
77
+ ?key=YOUR_API_KEY
78
+
79
+ Body:
80
+ {
81
+ "url": "https://example.com/page",
82
+ "formFactor": "PHONE", // optional: PHONE, DESKTOP, TABLET
83
+ "metrics": ["largest_contentful_paint", "cumulative_layout_shift"]
84
+ }
85
+ ```
86
+
87
+ For origin-level data, use `"origin"` instead of `"url"`.
88
+
89
+ ### Data Availability
90
+ - CrUX data requires **sufficient traffic** — low-traffic pages may have no data
91
+ - Data is aggregated over a 28-day rolling window
92
+ - Updated weekly (typically Monday)
93
+ - Historical data available via BigQuery dataset `chrome-ux-report`
94
+
95
+ ## WordPress-Specific Considerations
96
+
97
+ - **Caching plugins** (WP Super Cache, W3 Total Cache, LiteSpeed) significantly affect TTFB and LCP
98
+ - **Image optimization** plugins impact LCP for image-heavy pages
99
+ - **Theme and plugin JavaScript** is the primary cause of poor INP scores
100
+ - **Web fonts** can cause CLS if not using `font-display: swap`
101
+ - Test both **logged-in** and **logged-out** states — admin bar affects CLS
@@ -0,0 +1,76 @@
1
+ # GA4 Data API v1beta Integration
2
+
3
+ ## Service Account Setup
4
+
5
+ 1. Go to [Google Cloud Console](https://console.cloud.google.com/)
6
+ 2. Create or select a project
7
+ 3. Enable the **Google Analytics Data API** (v1beta)
8
+ 4. Navigate to **IAM & Admin > Service Accounts**
9
+ 5. Create a service account with a descriptive name (e.g., `wp-analytics-reader`)
10
+ 6. Download the JSON key file
11
+ 7. In GA4 Admin, grant the service account email **Viewer** role on the property
12
+
13
+ ## WP_SITES_CONFIG Configuration
14
+
15
+ ```json
16
+ {
17
+ "id": "my-site",
18
+ "url": "https://example.com",
19
+ "ga4_property_id": "properties/123456789",
20
+ "ga4_service_account_key": "/path/to/service-account-key.json"
21
+ }
22
+ ```
23
+
24
+ - `ga4_property_id` — format is `properties/NUMERIC_ID` (find in GA4 Admin > Property Settings)
25
+ - `ga4_service_account_key` — absolute path to the downloaded JSON key file
26
+
27
+ ## Property ID Format
28
+
29
+ - GA4 uses numeric property IDs prefixed with `properties/`
30
+ - Example: `properties/350123456`
31
+ - Find it in GA4 Admin > Property Settings > Property ID
32
+ - Do NOT use the Measurement ID (G-XXXXXXX) — that is for the tracking tag only
33
+
34
+ ## Common Dimensions
35
+
36
+ | Dimension | API Name | Description |
37
+ |-----------|----------|-------------|
38
+ | Date | `date` | Date in YYYYMMDD format |
39
+ | Page path | `pagePath` | URL path of the page |
40
+ | Page title | `pageTitle` | HTML title of the page |
41
+ | Source | `sessionSource` | Traffic source (google, facebook, etc.) |
42
+ | Medium | `sessionMedium` | Traffic medium (organic, cpc, referral) |
43
+ | Campaign | `sessionCampaignName` | UTM campaign name |
44
+ | Country | `country` | User country |
45
+ | Device category | `deviceCategory` | desktop, mobile, tablet |
46
+ | Landing page | `landingPage` | First page of the session |
47
+
48
+ ## Common Metrics
49
+
50
+ | Metric | API Name | Description |
51
+ |--------|----------|-------------|
52
+ | Sessions | `sessions` | Total sessions |
53
+ | Active users | `activeUsers` | Users with engaged sessions |
54
+ | Pageviews | `screenPageViews` | Total page views |
55
+ | Engagement rate | `engagementRate` | Percentage of engaged sessions |
56
+ | Avg. session duration | `averageSessionDuration` | Mean session length in seconds |
57
+ | Bounce rate | `bounceRate` | Percentage of non-engaged sessions |
58
+ | Conversions | `conversions` | Total conversion events |
59
+ | Event count | `eventCount` | Total events fired |
60
+
61
+ ## Quota Limits
62
+
63
+ | Quota | Limit | Notes |
64
+ |-------|-------|-------|
65
+ | Requests per day | 25,000 | Per project |
66
+ | Requests per minute | 1,200 | Per project |
67
+ | Concurrent requests | 10 | Per project |
68
+ | Tokens per query | 17,500 | Complexity-based; dimensions and metrics consume tokens |
69
+ | Response rows | 100,000 | Max rows per response; use pagination for larger datasets |
70
+
71
+ ## Sampling and Data Freshness
72
+
73
+ - GA4 Data API may return **sampled data** for large date ranges or complex queries
74
+ - Check `metadata.dataLossFromOtherRow` in responses for row aggregation
75
+ - Real-time data has a 24–48 hour processing delay for standard reports
76
+ - Use `keepEmptyRows: true` to include zero-value rows in reports
@@ -0,0 +1,92 @@
1
+ # Plausible Analytics Setup
2
+
3
+ ## Overview
4
+
5
+ Plausible is a privacy-friendly, lightweight analytics platform. It does not use cookies, fully complies with GDPR/CCPA, and provides a simple API for data retrieval.
6
+
7
+ ## Cloud vs Self-Hosted
8
+
9
+ | Aspect | Plausible Cloud | Self-Hosted |
10
+ |--------|----------------|-------------|
11
+ | URL | `https://plausible.io` | Your own domain (e.g., `https://analytics.example.com`) |
12
+ | API base | `https://plausible.io/api` | `https://analytics.example.com/api` |
13
+ | Hosting | Managed | You manage the server |
14
+ | Cost | Subscription-based | Free (server costs apply) |
15
+ | Data ownership | Plausible servers (EU) | Your infrastructure |
16
+
17
+ ## API Key Generation
18
+
19
+ 1. Log into your Plausible dashboard
20
+ 2. Go to **Settings > API Keys**
21
+ 3. Click **+ New API Key**
22
+ 4. Name it (e.g., `wp-analytics-read`) and copy the key
23
+ 5. Store the key securely — it is shown only once
24
+
25
+ ## WP_SITES_CONFIG Configuration
26
+
27
+ ```json
28
+ {
29
+ "id": "my-site",
30
+ "url": "https://example.com",
31
+ "plausible_api_key": "plausible-api-key-here",
32
+ "plausible_base_url": "https://plausible.io"
33
+ }
34
+ ```
35
+
36
+ - `plausible_api_key` — the API key generated above
37
+ - `plausible_base_url` — omit for cloud (defaults to `https://plausible.io`), set for self-hosted
38
+
39
+ ## Available Metrics
40
+
41
+ | Metric | Description |
42
+ |--------|-------------|
43
+ | `visitors` | Unique visitors |
44
+ | `visits` | Total visits (sessions) |
45
+ | `pageviews` | Total page views |
46
+ | `views_per_visit` | Average pages per visit |
47
+ | `bounce_rate` | Percentage of single-page visits |
48
+ | `visit_duration` | Average visit duration in seconds |
49
+ | `events` | Total custom events |
50
+
51
+ ## Available Properties (Breakdown Dimensions)
52
+
53
+ | Property | Description |
54
+ |----------|-------------|
55
+ | `event:page` | Page path |
56
+ | `visit:source` | Traffic source |
57
+ | `visit:referrer` | Full referrer URL |
58
+ | `visit:utm_source` | UTM source parameter |
59
+ | `visit:utm_medium` | UTM medium parameter |
60
+ | `visit:utm_campaign` | UTM campaign parameter |
61
+ | `visit:country` | Visitor country (ISO 3166-1 alpha-2) |
62
+ | `visit:device` | Device type (Desktop, Mobile, Tablet) |
63
+ | `visit:browser` | Browser name |
64
+ | `visit:os` | Operating system |
65
+
66
+ ## Period Formats
67
+
68
+ | Period | Format | Example |
69
+ |--------|--------|---------|
70
+ | Day | `day` | Current day |
71
+ | 7 days | `7d` | Last 7 days |
72
+ | 30 days | `30d` | Last 30 days |
73
+ | Month | `month` | Current month |
74
+ | 6 months | `6mo` | Last 6 months |
75
+ | 12 months | `12mo` | Last 12 months |
76
+ | Custom | `custom` | Requires `date` param: `2024-01-01,2024-01-31` |
77
+
78
+ ## Filtering
79
+
80
+ Filters use the format `property operator value`:
81
+ - `visit:source==Google` — exact match
82
+ - `event:page==/blog**` — wildcard match
83
+ - `visit:country!=US` — not equal
84
+ - Multiple filters: separate with `;` (AND logic)
85
+
86
+ Example: `visit:source==Google;visit:country==IT`
87
+
88
+ ## Rate Limits
89
+
90
+ - **600 requests per hour** per API key
91
+ - **10 requests per second** burst limit
92
+ - Responses include `X-RateLimit-Remaining` header