Add carbon estimate results
This PR adds back carbon estimates which were removed in #16.
The implementation uses thegreenwebfoundation/co2.js, so there is no need to make external API calls. The calculations use the median page weight as the basis for calculating a carbon estimate for a page.
Inside CO2.js, we use the Sustainable Web Design (SWD) model however utilise the perByte method. This does not apply any of the assumptions caching & return visitor assumptions that are made in the original SWD model. As a result, the carbon estimate returned is higher than what you would see for the same page using a tool like Website Carbon Calculator (which was used previously).
More details on the SWD model, and the CO2.js perByte method can be found at the links below:
- Calculating digital emissions (SWD original post).
- How the SWD model is applied in CO2.js.
-
Explainer of the
perBytemethod. (Details of the alternateperVisitmethod are also on that page).