Open npm widget
cometweb.io/carbon-badge Live

Carbon Badge

Embed a lightweight CO₂e badge — api mode (Insight) or estimate (local).

Web component @cometweb/carbon-badge (MIT). api measures a URL via the public API; estimate uses the current page’s Performance API weight. Transfer estimate — not an ESG certificate.

mode=api — Insight public API measures the given URL (here: cometweb.io).

1. Install
Then: import '@cometweb/carbon-badge' in your bundler. Pinned version: 1.0.6.
2. Drop in your page
mode=api — Insight public API measures the given URL (here: cometweb.io). Component default mode is api. Tag: cometweb-carbon-badge (not carbon-badge).
Attributes
urlURL for API (defaults to current). In estimate it does not drive page weight.
modeapi | estimate — default api
themedark | light
cache-ttllocalStorage cache minutes (default 720 = 12h)
api-urlhttps://app.cometweb.io/api
green-hostestimate only — "true" lowers hosting factor
Score thresholds (g CO₂e / visit)
A+< 0.10g
A< 0.20g
B< 0.40g
C< 0.70g
D< 1.00g
F≥ 1.00g

This estimates page transfer emissions — not an org-wide footprint or ESG certificate.

SWDM v4 model

CO₂e estimate via the Sustainable Web Design Model (Green Web Foundation). API responses also expose Insight formula_version.

~4.7 KB gzip

@cometweb/[email protected] — zero runtime dependencies.

api or estimate

api: GET /api/public/carbon-badge for the given URL. estimate: current page weight from the Performance API.

theme dark / light

Two built-in web component themes — no custom CSS required.

MIT license

Use commercially, self-host, modify — no fee for the widget.

Links to Ecology

Click opens cometweb.io/insight/ecology (module page), not an ESG certificate or a full project report.