Sustainability widgets, checkout "green" badges, and trip-footprint tools often update a kilogram total as soon as you change a quantity. When the emission factors, the allocation rules, and the rounding policy all run in the browser, you have published the model that makes the number look official — and a map of how it can be nudged.

A competitor can lift the factor table. A user can hook the function and shrink a reported footprint, or a supplier can see exactly how you weight their category. Neither is acceptable if you later publish that number in a report, a badge, or a checkout claim.

What actually ships

A typical client-side footprint calculator includes:

  • Emission factor tables — kg CO2e per kWh, tonne-km, SKU, or spend category, often with regional variants.
  • Allocation and scope rules — what you include, what you silently drop, and how you split shared legs of a trip or a shipment.
  • Rounding and display policy — the precision you show, and the "less than X" wording that hides small totals.
  • Badge thresholds — the cutoffs that unlock a "lower impact" label at checkout.
  • Override hooks — partner or staff flags that apply a friendlier factor.

The explanatory article can live on a CMS. The function that produces the number you display is often already in the bundle.

How it gets lifted

People search the bundle for strings like kgCO2e, factor, or a function named footprintFor.

export const FACTORS = { "air-short": { kgPerKm: 0.255, firstLeg: 50 }, "air-long": { kgPerKm: 0.195, firstLeg: 50 }, "truck-diesel": { kgPerTkm: 0.107 }, "grid-eu": { kgPerKwh: 0.231 }, }; export function footprintFor(activity, qty, region) { const f = FACTORS[activity] || FACTORS[fallback(region, activity)]; const raw = qty * (f.kgPerKm || f.kgPerTkm || f.kgPerKwh) + (f.firstLeg || 0); return { kg: round(raw, 1), badge: raw < 20 ? "lower-impact" : "standard" }; } 

Once FACTORS and the badge cutoffs are public, a rival widget can advertise "the same methodology" without the research work, and a checkout page that grants a badge when badge === "lower-impact" can be hooked. If your factors came from a licensed dataset, you may also be in breach of the license by embedding them in public JavaScript.

What actually protects you

Move official totals off the client

  • Authoritative footprint figures used in reports, product claims, or checkout badges belong on the server, against the current factor set, logged with the inputs you actually used.
  • Licensed factor tables should be queried through an API your license allows, not copied into a static bundle.
  • Badge and claim decisions must be recorded server-side if you show them to a customer or a regulator.

Protect a local preview if you still want one

A local preview can update a rough figure while someone is typing. For that chunk:

  • Ship a short, rounded, stale subset, not the full regional table or unpublished factors.
  • Bundle the preview separately from checkout and reporting UI.
  • Apply stronger-than-mangling protection (control-flow flattening or VM-based compilation) to the factors and allocation rules you still ship.
  • Leave source maps off the public CDN.
  • Do not put claim thresholds or partner overrides only in the client.

Do not treat the client as a reporting authority

If a badge or a published total is issued because footprintFor returned a low number, anyone can hook the function. Official claims need a server that computed them.

Practical checklist

  • [ ] Reportable totals and checkout badges are computed or confirmed on the server, not only in the page.
  • [ ] Licensed or unpublished factor tables are not copied in full into a public bundle.
  • [ ] Any local preview is a short subset, split from the claim UI, and protected with stronger-than-Terser obfuscation.
  • [ ] Source maps for the calculator are not on the public CDN.
  • [ ] Hooking the calculator cannot grant a badge or alter a published figure in a system you control.
  • [ ] Inputs used for official claims are logged on the server.
  • [ ] The UI labels a local figure as an estimate until the server confirms it.

Honest limits

Emission factors change, and no table is complete. Obfuscation does not keep a methodology honest; a server and a documented source do. If a factor cannot be public or cannot be stale, it cannot live in JavaScript you send to every browser.

Summary

A client-side footprint calculator ships the work that makes the number look official: the factors, the allocation rules, and the badge cutoffs. Use a rough preview if you must, protect that chunk, and let the server be the only path that issues a claim.

Disclosure: I work on VEILVM, a JavaScript VM-protection service. Free browser tier (3 runs/day, up to 5 KB) and a Pro plan at $9/month or $79/year with API access. Try the playground at vm.ldvmp.com.