-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreadme.txt
More file actions
208 lines (149 loc) · 8.94 KB
/
readme.txt
File metadata and controls
208 lines (149 loc) · 8.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
=== CloudScale Site Analytics ===
Contributors: andrewbaker
Tags: page views, analytics, statistics, view counter, free analytics
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 2.9.263
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Accurate page view tracking for WordPress sites behind Cloudflare and other CDNs. Counts every view even when HTML is served from cache.
== Description ==
CloudScale Site Analytics solves the fundamental problem with page view tracking on cached WordPress sites. When Cloudflare, Fastly, or any CDN serves a cached HTML page, WordPress never executes. Server side counters like Jetpack Stats miss the view entirely, resulting in severe undercounting — typically 5 to 10 times lower than actual traffic.
CloudScale uses a lightweight JavaScript beacon that fires after the cached page loads, recording every view through a REST API endpoint that bypasses the CDN cache. The result is accurate view counts regardless of cache status.
= Key Features =
* Accurate counting behind Cloudflare and other CDNs
* Session based deduplication (no double counting on refresh)
* IP throttle protection against view inflation attacks
* Jetpack Stats one click migration tool
* Dashboard widget with hourly, daily, monthly, and 6 month charts
* Top Posts and Recent Posts sidebar widgets with pagination
* Configurable view counter badge on posts (badge, pill, or minimal style)
* Five colour options for the view counter (blue, pink, red, purple, grey)
* Admin column showing views on the Posts list
* Full statistics page with period comparison and top posts
* REST API endpoints for custom integrations
* Privacy focused: IP addresses are hashed with wp_salt, never stored raw
= How It Works =
1. Cloudflare serves the cached HTML page at full speed
2. The browser loads the page and executes the beacon script
3. The beacon fires a lightweight POST to a WordPress REST endpoint
4. That endpoint bypasses CDN caching via headers and Cloudflare Cache Rules
5. WordPress records the view in the database and increments the counter
6. The page counter updates live without a reload
= Requirements =
* WordPress 6.0 or higher
* PHP 7.4 or higher
* A Cloudflare account with Cache Rules (free tier is sufficient)
== Installation ==
1. Upload the `cloudscale-wordpress-free-analytics` folder to `/wp-content/plugins/`
2. Activate the plugin in Plugins > Installed Plugins
3. The database table is created automatically on activation
4. Add the Cloudflare Cache Rule (see FAQ)
5. Configure display settings in Tools > CloudScale Site Analytics > Display tab
== Frequently Asked Questions ==
= What Cloudflare Cache Rule do I need? =
In the Cloudflare dashboard go to Caching > Cache Rules > Create Rule:
* Field: URI Path
* Operator: contains
* Value: /wp-json/cloudscale-wordpress-free-analytics/
* Action: Cache Status: Bypass
The plugin also sends no cache headers on every REST response, but the Cache Rule is the primary protection.
= How do I migrate from Jetpack Stats? =
Go to Tools > CloudScale Site Analytics > Migrate Jetpack tab. Click the migration button to import all Jetpack lifetime view counts into CloudScale. The migration preserves your historical totals as a starting point and the plugin blends them with new beacon data during a 28 day transition period.
= Does it work without Cloudflare? =
Yes. The beacon approach works on any WordPress site. The Cloudflare Cache Rule is only needed if you use Cloudflare caching. Without Cloudflare, the REST endpoint is already accessible and the plugin works out of the box.
= Does refreshing the page count as another view? =
No. The beacon uses sessionStorage to deduplicate views. Each browser session records only one view per post. A new tab or new session counts as a new view.
= How is visitor privacy protected? =
IP addresses are hashed using SHA256 combined with your site wp_salt before storage. Raw IP addresses are never written to the database. The IP hash is used only for throttle protection.
== Changelog ==
= 2.9.218 =
* Remove Jetpack migration tab and all transition blending logic
* All Time Views now sources from beacon log (cspv_views_v2) only, not post meta
* Stat cards always show actual tracked views; post_meta fallback removed
= 2.9.94 =
* Unique visitors tracking with SHA-256 hashed IPs (never stored raw)
* Date range swap fix on Statistics page
* Geography map robustness improvements
* WordPress.org submission hardening: all assets bundled locally, inline style/script tags replaced with wp_enqueue APIs, uninstall.php added
= 2.9.12 =
* Site Health v2: complete rewrite — four time windows (1 Day, 7 Days, 28 Days, 90 Days) each with RAG indicator and prior-period comparison
* Insufficient Data gating: buckets without enough history show waiting state instead of misleading percentages
* Site Health results cached in wp_options for 1 hour
= 2.9.11 =
* Site Health panel on dashboard widget and Statistics page with red/amber/green indicators
* Traffic Growth and Hot Pages metrics across 7d, 30d, 90d windows
= 2.9.10 =
* Post History tab on Statistics page: search any post and see full diagnostics including log count, Jetpack imported count, and 90-day chart
= 2.9.9 =
* View Diagnostics debug panel on singular posts (admin only) with resync button
= 2.9.0 =
* Flattened plugin structure — all files in plugin root for reliable FTP/cPanel upgrades
* Deactivation hook cleans stale subdirectories from pre-2.9.0 installs
= 2.8.7 =
* Dedup toggle persistence fix: switched to yes/no string storage
= 2.8.5 =
* View Deduplication settings UI with configurable window (1h–48h)
= 2.8.4 =
* Dashboard widget referrers now has Sites/Pages toggle
= 2.8.3 =
* Statistics page referrers Sites/Pages toggle with clickable full URLs
= 2.8.2 =
* Dashboard widget shows top 3 pages and top 3 referrers in side-by-side columns
= 2.8.1 =
* Referrer tracking fixed: REST API now captures document.referrer from beacon body
= 2.8.0 =
* Client-side dedup switched to localStorage with 24h TTL
* Server-side dedup: IP hash + post ID within configurable window
= 2.7.0 =
* Fixed trending count exceeding lifetime total display bug
= 2.6.9 =
* Both widgets now have configurable date/view count colours with colour picker
= 2.6.2 =
* Fail2Ban second-tier protection: permanently blocks IPs exceeding configurable page limit
= 2.4.0 =
* All Time banner on Statistics page with lifetime totals
* All Time Top Posts panel
= 2.3.0 =
* Tracking filter: configurable post type filter for beacon recording
* Recent Posts widget (CloudScale: Recent Posts)
= 2.2.0 =
* Auto-display of view counter on single posts with no theme editing required
* Display settings: position, post type, icon, suffix, style
= 2.1.0 =
* Top Posts sidebar widget (CloudScale: Top Posts) with pagination and thumbnail support
= 1.1.0 =
* Live Statistics dashboard under Tools > Page Views
* SHA-256 + wp_salt IP hashing for privacy
* Cache-bypass headers on REST endpoint
= 1.0.0 =
* Initial release: JavaScript beacon, post meta view counter, REST endpoint, admin column
= 2.5.4 =
* Stats page shows all recorded data regardless of tracking filter
* REST endpoint enforces post type tracking filter
* Badge colour options: blue, pink, red, purple, grey
* Two layer view deduplication: client side (localStorage, 24h TTL) and server side (IP + post, 24h window)
* View counter positioned above post title
* Display settings moved into main Tools page as Display tab
* Database auto upgrade for missing columns
* Admin bypass for IP throttle during testing
* Two column grid layout for Top Posts widget on desktop
* Dashboard widget colours changed from pink to green
* Transition period logic for Jetpack migration blending
* Jetpack Stats one click migration tool
== Third Party Services ==
This plugin optionally connects to the following external services:
= DB-IP Lite (optional, geolocation only) =
When you click "Download DB-IP Lite" in the plugin's statistics page, the plugin fetches the free DB-IP City Lite database directly from DB-IP's servers:
* Service URL: https://download.db-ip.com/
* This request is only made when you explicitly trigger it from the admin panel.
* DB-IP Privacy Policy: https://db-ip.com/db/privacy-policy.html
* DB-IP Terms of Use: https://db-ip.com/db/terms.html
* The database is stored locally on your server after download; no data is sent to DB-IP.
No data is transmitted to any external service during normal page view tracking. The JavaScript beacon only communicates with your own site's REST API endpoint.
== License ==
This plugin is free software released under the GPLv2 or later license.
Copyright (C) 2026 Andrew Baker (https://andrewbaker.ninja)
You may copy, distribute and modify the software as long as you track changes/dates in source files. Any modifications to or software including (via compiler) GPL licensed code must also be made available under the GPL along with build and install instructions.
Full license text is included in LICENSE.txt and available at https://www.gnu.org/licenses/gpl-2.0.html