=== EcoPigs Carbon Badge ===
Contributors: ecopigs
Tags: carbon, sustainability, co2, green, emissions, web carbon, esg
Requires at least: 5.0
Tested up to: 6.7
Requires PHP: 7.2
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Measure and display your website's real carbon footprint. One-click install of the EcoPigs badge — measures actual visitor emissions, not just an estimate.

== Description ==

Most "website carbon" tools give you a single estimated number from your page weight. **EcoPigs measures the real thing** — the actual carbon of your real visitors, against the live electricity grid, with honest error bars.

This plugin installs the EcoPigs badge in one click (no editing theme files), shows your live carbon grade and figure right in your WordPress dashboard, and links to your public report.

**What makes EcoPigs different:**

* **Measured, not just estimated.** With the badge installed, EcoPigs measures your real visitors' device energy (CPU-time based) and the bytes they actually loaded — including caching and return visits a one-off scan can't see. The reportable figure is often very different from a cold estimate.
* **Live grid intensity.** Emissions are weighted by the real-time carbon intensity of the electricity grid, not a stale annual average.
* **Full lifecycle.** Operational *and* embodied carbon, across data centre, network and device.
* **Honest by design.** Every figure shows its 90% interval and whether it's measured or estimated. No fake precision. No cookies. No personal identifiers (IPs are truncated). Respects Do Not Track / GPC.
* **A figure you can report.** The kind of number that belongs in a CDP submission, SECR report or B Corp application — measured, intervalled, and reproducible.

The badge itself is lightweight, cookieless, and shows your per-page CO₂e per visit with your carbon grade, linking through to your full public report.

== Installation ==

1. Install and activate the plugin.
2. Go to **Settings → EcoPigs Badge**.
3. If your site isn't measured yet, click **Scan this site free** (opens ecopigs.co.uk).
4. Choose the badge style (floating or inline), position and theme.
5. Save. The badge appears on your site and starts measuring real visits.

Your grade and measured figure appear in the settings page as real visits accumulate.

== Frequently Asked Questions ==

= Does it slow my site down? =
No. The badge script is async/deferred and tiny. It renders in an isolated Shadow DOM so it can't clash with your theme.

= Does it use cookies or collect personal data? =
No cookies. No personal identifiers — IP addresses are truncated before storage. It honours Do Not Track and Global Privacy Control. It records only technical page-load data (bytes, device class, timings), never page content or form input.

= Is the carbon figure "measured" or "estimated"? =
Both tiers exist and are labelled. Before the badge has enough real visits, the figure is a modelled estimate. Once real visits accumulate, it becomes a measurement of your actual visitor footprint. Device energy is estimated from CPU-time (browsers don't expose joules), and the figure always carries its uncertainty interval.

= Do I need an EcoPigs account? =
No setup needed up front. Click "Connect & start measuring," enter your email, and the plugin registers your site, creates/links your free EcoPigs account, and starts the first scan — all without leaving WordPress. You can log into the full dashboard on ecopigs.co.uk any time using that email.

== Changelog ==

= 1.2.0 =
* Stores your EcoPigs account link on connect so the optional EcoPigs Auto-Fix add-on can rescan your site to confirm a grade improvement after applying fixes. No change to the badge itself.

= 1.1.0 =
* "What to improve" panel now reads the same optimisation list shown in your EcoPigs dashboard — the full set of prioritised opportunities (oversized images, WebP conversion, lazy loading, SVG and CSS optimisation), grouped by impact with the number of affected pages and assets.
* The panel now populates automatically after a scan — no need to click "Analyse" first.
* Each opportunity still maps to a concrete WordPress action (which plugin/setting to use).

= 1.0.0 =
* One-click badge install — no theme-file editing.
* Dashboard status panel: live grade, calibrated figure with 90% interval, and a measured/estimate tier chip.
* "What to improve" panel — a prioritised, WordPress-specific list of fixes (image compression, render-blocking CSS, heavy JS, caching, HTTPS, and more) with the carbon/byte impact of each. Powered by EcoPigs' full site analysis.
* Self-serve connect — register your site and kick off the first scan without leaving WordPress.
* [ecopigs_badge] shortcode to place an inline badge anywhere in your content (floating badge stays available site-wide).
* Public report link and full appearance controls (floating/inline, position, light/dark theme).
* Privacy by design — no cookies, truncated IPs, honours Do Not Track and Global Privacy Control.
