Version 1.0.0 · Website CO₂ analyzer for any PHP website · by OK Multimedia
EcoMeter Script analyzes every page of your website, estimates the CO₂ that one visit produces and gives each page a grade from A+ to F. Then it can show your visitors a seal with the real result of the page they are reading.
It is a self-hosted PHP script: it runs on your own hosting, next to your website, and it does not need WordPress. It works with plain HTML sites, PHP sites, Laravel and other frameworks, and custom CMSs.
Main features:
| Requirement | Details |
|---|---|
| PHP 7.4 or newer | Tested from PHP 7.4 to PHP 8.5. |
| PHP extensions | PDO with the SQLite driver, cURL, DOM and JSON (all usually enabled). zlib is recommended: without it, compressed pages are measured a little less precisely. |
| A writable folder | The ecometer/data/ folder must be writable by PHP. The installer checks it for you. |
| Your website must be reachable | EcoMeter loads your own pages over HTTP(S), like a visitor, from your server. |
| Optional: a scheduled task | A cron job keeps the measurements fully automatic. Without one, EcoMeter still measures while the dashboard is open and, little by little, after visits. See section 5. |
The installer (step 2) checks all of this and tells you exactly what is missing.
ecometer-script-1.0.0/
├── ecometer/ ← the script: upload this folder to your website
│ ├── index.php installer, login and dashboard
│ ├── badge.js the seals and eco mode for your visitors
│ ├── badge.php PHP alternative for the seal line, and the data the seals read
│ ├── cron.php scheduled measurements
│ ├── assets/ styles, images, fonts and the seal drawing
│ ├── data/ your settings and database (created by the installer)
│ ├── inc/ lang/ views/ the engine, the 8 languages and the screens
├── documentation/ this guide
├── licensing/ licence notes, the GPL and the Poppins font licence
└── README.txt
Upload the ecometer folder to the root of your website (the folder that contains your home page), with FTP or the file manager of your hosting. You will then have, for example, public_html/ecometer/.
Open https://yourwebsite.com/ecometer/ in your browser and follow the four steps:
data/ folder. Fix anything marked in red, then reload.When the installation finishes, the installer locks itself: nobody can run it again.
Copy the line from the dashboard (Seals screen) and paste it into your website where you want the seal to appear:
<script src="https://yourwebsite.com/ecometer/badge.js" async></script>
That is all. More options in section 7.
A scheduled task makes EcoMeter fully automatic: it measures new pages, re-checks every page each week and keeps the CO₂ VERIFIED seal confirmed. Add one of these in the panel of your hosting, every 5 minutes. Your exact lines, with your folder and your private key, are in Dashboard › Settings.
php /home/youruser/public_html/ecometer/cron.php
Or, if your hosting only allows calling an address:
https://yourwebsite.com/ecometer/cron.php?key=YOUR-PRIVATE-KEY
Without the key, cron.php answers "Forbidden". Settings shows when the task last ran.
In Settings you can also choose to measure only at night (from 00:00 to 07:00, server time) and to turn the weekly re-check on or off.
Open https://yourwebsite.com/ecometer/ and sign in.
Paste this line where you want the seal (each page shows its own result):
<script src="https://yourwebsite.com/ecometer/badge.js" async data-style="card" data-lang="en"></script>
data-style: card, standard, bar or mini. Without it, the style chosen in the dashboard is used.data-lang: en, es, fr, pt, de, ru, ar or zh. Without it, the language chosen in the dashboard is used.Put the line once (for example before </body>) and place one or more holders wherever you like:
<div data-ecometer data-style="mini"></div>
<div data-ecometer data-style="card" data-lang="es"></div>
If your pages are PHP, you can use this line instead. It prints the same seal and, when the CO₂ VERIFIED challenge is on, the line our server needs (see section 10):
<?php include $_SERVER['DOCUMENT_ROOT'] . '/ecometer/badge.php'; ?>
The first time a page is seen, its seal says "Measuring the CO2 of this page…" until it is measured (a few minutes with the scheduled task). Visitors never wait: they always read a saved figure.
Tracking parameters added by ads, social networks and newsletters (utm_…, fbclid, gclid and similar) are ignored, so those visits show the result of the page itself. To protect your server, visits add at most 30 new pages an hour; the rest are found by "Find pages" and the weekly check.
In Seals, choose the background, border and text colours of the seal (or leave "Default"), and the size: small, normal or large. The preview changes as you choose. Press Save: every seal on your website uses the new look, without changing the line.
Eco mode adds a small tab on the edge of your website. When a visitor switches it on, the page moves and downloads less:
Turn it on in Seals › Eco mode for your visitors and choose the tab position on computers and on phones. It appears on every page that has the EcoMeter line. The visitor's choice is remembered in their browser (local storage); no cookies are used. Visitors who ask their device for reduced motion get eco mode without the animation of the tab.
Keep your website at A or A+ for 30 days in a row and earn the CO₂ VERIFIED seal. Our server checks your website every day: the home page and two random pages. A day at B or below starts the count again.
<head> of your home page. It looks like this (yours has its own code):
<meta name="ecometer-seal" content="…">
If your website uses the PHP line from section 7 on the home page, it is already there.<div data-ecometer-seal data-size="160"></div>
data-size is the width in pixels (60 to 600). The seal links to its public verification page on okmultimedia.com.The seal is shown only while the service confirms it (it is checked again at least once a day). If our server cannot find the line on your home page, the daily check stops: press Start again. You can leave the challenge at any time ("Leave the challenge").
The line on your home page contains only a fingerprint (SHA-256) of a private code that never leaves your server. Pressing Start sends your home page address and that private code to the verification service; nothing else. Service terms and privacy: okmultimedia.com/en/ecometer/terms.
EcoMeter loads each page as a first-time desktop visitor would (1440 px wide) and adds up everything that visit downloads: HTML, styles, scripts, images (choosing the same file as a browser from srcset and <picture>), fonts and video. It then turns that data into energy and CO₂ with the Sustainable Web Design model, version 4, published by the Green Web Foundation, and gives a grade from A+ to F.
Limits, so a measurement never overloads your server:
The installer, the dashboard, the seals, the details window and eco mode are available in English, Spanish, French, Portuguese, German, Russian, Arabic (right to left) and Chinese. Choose the dashboard language in Settings and the seal language in Seals (or per line with data-lang).
data/, inc/, lang/, views/) are closed to visitors with .htaccess files, and the database has a random, unguessable name.Nginx does not read .htaccess files. Add this to your site configuration (adjust the folder name if you renamed it):
location ~ ^/ecometer/(data|inc|lang|views)/ { deny all; }
Create an empty file called reset.txt inside ecometer/data/ (with FTP or your hosting's file manager) and open the dashboard: you can choose a new password. The file is deleted afterwards.
ecometer folder over the old one, keeping your ecometer/data/ folder (it holds your settings and measurements).ecometer folder and the scheduled task.Deleting the folder deletes all EcoMeter data too (settings and measurements live only in ecometer/data/). Nothing is left in any other place of your website or database.
okmultimedia.com), sending your home page address and your private code; our server loads your home page and two random pages once a day. Nothing is sent before you press Start. Service terms and privacy.data/ folder is not writable (set it to 755 or 775 in your file manager) or a PHP extension is disabled (enable PDO SQLite or cURL in your hosting's PHP settings). Reload the page after the change.https://yourwebsite.com/ecometer/badge.js: it must show code). If your website uses a strict Content Security Policy, allow your own domain for scripts. If you use a cache or CDN, clear it.<head> of the home page and, if you use a cache plugin or CDN, clear it. Then press Start again.We are happy to help with installation and setup. Please contact us through the Support section of the product page on the marketplace where you bought EcoMeter Script. Tell us your PHP version, your hosting and what you see (a screenshot helps). We usually answer within 24 hours on working days.
First release.
licensing/GPL-2.0.txt.licensing/README.txt.licensing/OFL-Poppins.txt.