Skip to content

Release Guide: CO2.js v0.15

CO2.js v0.15 gives developers access to richer information about a hosting provider when checking a domain or multiple domains for green hosting.

Verbose API responses

Version 0.15.0 of CO2.js allows developers to specify if they would like green domain checks  performed against the Green Web Dataset through CO2.js to return the full API response.

Until now, hosting checks performed in CO2.js would return either a boolean value (true or false) when a single domain is checked, or an array of strings (e.g. ['a-green-domain.com']) when multiple domains are checked.

This behaviour remains the default, however developers can now opt-in to receiving the full API response instead. This response allows developers to access much more information about a green domain, including when it was last modified, and the related supporting documents.

The example code below shows how to run a check on a single domain and return a verbose response.

import { hosting } from "@tgwf/co2";

hosting.check("google.com", {
    verbose: true,
    userAgentIdentifier: "TheNameOfYourApp"
})

If you want to see more examples of how to use this, our documentation site has a tutorial you can follow: CO2.js: Check a domain for green hosting

⚠️ Feature REMOVAL

In version 0.15.0 of CO2.js, we have removed functions that were specific to using CO2.js with Sitespeed’s Page X-ray. Namely, we have removed the following functions from the CO2.js library:

  • perDomain
  • perPage
  • perContentType
  • dirtiestResources
  • perParty

This functionality has already been merged into the existing Sitespeed.io Sustainability Plugin.


You can find details of every release for CO2.js on GitHub, where you’ll also be able find the changelog for this project.


Get notified about CO2.js news