Jump to content

Recommended Posts

Posted

Hi everyone,

Every web page has a carbon footprint. Most developers have no idea what it is. This module measures it.

GitHub: https://github.com/mxmsmnv/PageCarbon

What it does

Tracks response size, PHP execution time, and peak memory per front-end request, then estimates CO₂ using the Sustainable Web Design Model v4 (Wholegrain Digital, 2024). Results appear in a dashboard under Setup → PageCarbon.

Admin dashboard:

  • Per-page ratings: 🟢 A (< 100 mg) / 🟡 B / 🟠 C / 🔴 D (≥ 700 mg)
  • 24-hour hourly CO₂ bar chart
  • Top 50 pages by average CO₂ with exec time, response size, and hit count
  • Real-world analogies - all-time total translated into 12 everyday equivalents: car km driven, espressos brewed, Netflix hours, Google searches, short-haul flights, trees needed for a year, and more
  • DOCX export - zero-dependency, pure PHP via ZipArchive

Screenshot:

pagecarbon.thumb.png.aaea3294ddf1c7b5c16207b7d50f8555.png

Performance-first architecture:

  • WireCache buffer - metrics accumulate in memory, batch INSERT once per hour (zero per-request DB writes)
  • Bot sampling - only 1-in-N bot requests recorded, human requests always in full
  • 90-day raw retention with permanent hourly aggregates - historical data never lost

Frontend API:

$pc = $modules->get('PageCarbon');
echo $pc->renderBadge($page);            // full card
echo $pc->renderBadge($page, 'compact'); // single-line pill
$stats = $pc->getStats($page);           // avg_co2_mg, rating, hits...

The average web page produces ~500 mg CO₂ per view. Most ProcessWire sites do better - now you can prove it.

Quote

A note for our European friends - especially in Germany, Switzerland, and the EU in general: you can finally track your website's carbon footprint the way you track calories. The rest of the world is still figuring out why that matters.

 

  • Like 2
Posted
1 hour ago, maximus said:

carbon footprint

Which should be addressed by planting forests and most importantly, letting nature heal.

https://en.wikipedia.org/wiki/Biological_carbon_fixation

"The process of biological carbon fixation plays a crucial role in the global carbon cycle, as it serves as the primary mechanism for removing CO2 from the atmosphere and incorporating it into living biomass. The primary production of organic compounds allows carbon to enter the biosphere. Carbon is considered essential for life as a base element for building organic compounds. The flow of carbon from the Earth's atmosphere, oceans and lithosphere into lifeforms and then back into the air, water and soil is one of the key biogeochemical cycles (or nutrient cycles). Understanding biological carbon fixation is essential for comprehending ecosystem dynamics, climate regulation, and the sustainability of life on Earth."

Destroying natural habitats is something we should have stopped doing a long time ago. But it's not too late. I think we should concentrate on letting nature heal on its own by restoring (letting it restore) as much habitat as possible. We should just let Mother Nature do what she does best, without trying to play God by always trying to fix what we have screwed up by some sort of yet another artificial method we (most of the time) come up with.

  • Like 1
Posted

Agreed — and while we're waiting for the forests to grow back, at least we can measure how much damage our websites are doing. 🌱 Awareness is the first step. Knowing your numbers is what makes the conversation about natural restoration possible in the first place. The module doesn't claim to solve anything, just to measure.

  • Like 1
Posted
2 minutes ago, maximus said:

The module doesn't claim to solve anything

Sure thing. If it were possible to code a module like that, I would be the first to do it. Jokes aside, anything that helps even a little is welcome, of course. Thanks for sharing!

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   1 member

×
×
  • Create New...