Advertising & privacy
How this site makes money β and what it refuses to do
This page exists because "free" usually hides something. Here is the whole thing, in plain language, with the actual code that runs on the site. No fine print.
The short version
- Your code never leaves your device. The compiler runs inside your browser. There is no server that receives it.
- No ads on the part you're working on. The editor, the Run button and the test results are ad-free by design β enforced in code, not promised in a policy.
- No ads above the content you came for. There will be no banner pushing the article down. This is also enforced by an allow-list.
- We set no tracking cookies. Your theme, language, drafts and progress are stored locally in your browser only.
- Ads come from Google AdSense, and Google sets its own cookies β we show you exactly how to opt out of personalised ads below.
Claim 1 β your code is not uploaded
Everything you type is compiled by JSCPP, a C++ interpreter written in JavaScript, loaded once into your page:
// js/site.js β the only place the engine is fetched
var SELF = document.currentScript;
var VENDOR_BASE = (function () {
var src = (SELF && SELF.src) || "";
var i = src.indexOf("js/site.js");
return i >= 0 ? src.slice(0, i) : ""; // works from /, /zh/ and /es/
})();
// A local file that ships with the site. Not a CDN β the page loads
// nothing from a third-party host.
var JSCPP_URL = VENDOR_BASE + "vendor/jscpp.min.js";
// ... and here is how your program is executed: locally, in this tab.
function runInPage(code, stdin) {
return loadEngineScript().then(function (JSCPP) {
var out = "";
var exitCode = JSCPP.run(code, stdin || "", {
stdio: { write: function (s) { out += s; } }
});
return { ok: true, output: out, exitCode: exitCode };
});
}
There is no fetch, no XMLHttpRequest, no form post anywhere in the judging code. You can verify it: open DevTools β Network, run any problem, and watch that no request carries your source code.
Claim 2 β no ads beside the editor or the test results
The site has 370 ad placeholder comments. Only seven kinds are allowed to actually serve an ad. The others β including every "top of page" slot β stay dormant forever, because they would push the content down:
// js/ads.js β the actual allow-list shipped on this site
var CPPLAB_AD_PLACEMENT = {
allow: [
"below solution", // one spot, after the problem's solution
"mid-article", // long articles only, between sections
"mid-lesson unit",
"end of article",
"end-of-lesson unit",
"bottom of hub", // page footer of a list page
"bottom unit"
]
// "top of article", "top of hub", "above lesson content" and
// "top responsive unit" are deliberately NOT here. They never render.
};
And here is the loop that walks the page looking for placeholders β note the allow.some(...) filter: anything not on the list is skipped, not rendered:
if (/^\s*AD:/.test(t) && allow.some(function (k) { return t.indexOf(k) !== -1; })) {
marks.push(walker.currentNode); // only allowed slots get an ad
}
What this means for you as a learner: when you are writing code and reading pass/fail results, there is nothing to click and nothing competing for attention. The first ad you can meet on a problem page appears after the solution, i.e. after you're done.
Claim 3 β no tracking cookies from us
This site stores exactly five things, all local, all readable and deletable by you:
| Key | What it holds |
|---|---|
cpplab.theme | light or dark mode |
cpplab.lang | your language choice |
cpplab.code | your playground draft |
cpplab.practice.β¦ | your draft for each problem |
cpplab.game | solved problems, achievements, streak |
We set no cookies of our own. Clearing site data in your browser deletes all of the above and nothing is lost on our side β because we don't have a copy.
Claim 4 β what Google does, honestly
To keep the site free, we intend to show advertising from Google AdSense. When that is active:
- Google (as a third-party vendor) uses cookies to serve ads based on your prior visits to this and other websites.
- Google's use of advertising cookies enables it and its partners to serve ads based on your visits here and/or elsewhere on the internet.
- You can opt out of personalised advertising at Google Ads Settings.
- Visitors in the EEA/UK will be shown a consent prompt as required by Google's EU user consent policy.
- We keep Auto Ads off. That means no full-screen interstitials, no sticky bottom bar ambushing you mid-paragraph.
What we will never do
- Put an ad between you and a Run button, or inside a test result.
- Paywall the practice problems, or hide a solution behind a signup.
- Sell your data β we don't collect any to sell.
- Show a "please turn off your ad blocker" wall. If you block ads, the site still works completely.
How to check all of this yourself
- See the code: the files above (
js/site.js,js/ads.js) are plain JavaScript, unabridged, no build step. - Watch the network: DevTools β Network β solve a problem. No request contains your code.
- Count the ads: on a problem page, the first ad slot is after the solution; on an article, never above the first heading.
- Clean up: DevTools β Application β Local Storage β delete the keys. Reload. You are a brand-new visitor.
If something on this page turns out not to match what the site actually does, that is a bug β tell us and we'll fix the code or the page. Full privacy policy.