Ads & monetization
This site supports Google AdSense on documentation pages to offset domain and hosting costs. Layout slots are reserved; no ads render in production until environment variables are set.
Ad placements
| Placement | Variable | Notes |
|---|---|---|
| Above article body | ADSENSE_SLOT_ARTICLE_TOP | Below breadcrumbs |
| Below article body | ADSENSE_SLOT_ARTICLE_BOTTOM | Above footer prev/next |
| Right sidebar | ADSENSE_SLOT_SIDEBAR | Desktop only, when TOC is shown |
Development builds show dashed placeholder boxes so you can preview layout without live ads.
Setup
- Register at Google AdSense and pass site review.
- Obtain your publisher ID and slot IDs (see
.env.examplein the repo root).
Apex domain vs. doc. subdomain
| Topic | Guidance |
|---|---|
| Live docs URL | https://doc.abcreatoris.com (must match url in docusaurus.config.ts) |
| What to add in AdSense Sites | Usually the apex abcreatoris.com only—you often cannot add doc.abcreatoris.com as a separate site |
| Serving on subdomains | After apex verification, subdomains such as doc. are typically covered under the same publisher account |
ads.txt / script | Still hosted on the doc subdomain (e.g. https://doc.abcreatoris.com/ads.txt) on this Vercel project |
If the console shows apex Ready but doc. stays data-ad-status="unfilled" for days, it is often inventory or Auto ads conflicting with manual units—not necessarily a code bug.
Connect your site (AdSense onboarding)
After AdSense approval, the console shows Connect your site to AdSense. This repo already ships the script and ads.txt; you only need the correct URL in the console and time for Google to crawl.
URL to enter in AdSense
| Field | Correct value | Common mistake |
|---|---|---|
| Site URL | https://abcreatoris.com (apex) per console prompts; docs run on doc.abcreatoris.com | Wrong subdomain (docs.), adding an unsupported separate subdomain entry, paths like /docs/intro, or http:// |
| Publisher ID | ca-pub-2085315988106926 | Same account as pub-2085315988106926 in ads.txt |
Post-deploy verification
After deploying to Vercel, confirm all three are publicly reachable:
-
AdSense script (site-wide
<head>)
View source on the homepage and any doc page (e.g. /docs/intro). You should see:<script src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2085315988106926" async crossorigin="anonymous"></script>Injected via
scriptsindocusaurus.config.tson every page including the homepage. -
ads.txtat domain root
https://doc.abcreatoris.com/ads.txt should return:google.com, pub-2085315988106926, DIRECT, f08c47fec0942fa0Source file:
static/ads.txt(copied to site root at build time). -
robots.txt
This site does not block Google. If you addrobots.txtlater, do notDisallow/or/ads.txt.
Console steps
- Sign in to AdSense → Sites.
- Add site or Connect site for the pending property.
- Enter
https://abcreatoris.com(apex, no path) when the console only accepts the root domain. - If asked to paste code: the script is already deployed—choose I've placed the code.
- Wait for Google to crawl (hours to 48 hours). Status Ready / connected means done.
Common connection failures
| Symptom | Likely cause | Fix |
|---|---|---|
| AdSense code not found | Script missing or ADSENSE_CLIENT not set at build | Set Vercel env vars and Redeploy |
Invalid / 404 ads.txt | static/ads.txt not in deployment | Deploy latest commit; open /ads.txt |
| URL mismatch | Wrong subdomain or path in console | Use https://doc.abcreatoris.com |
| Site unreachable | DNS, HTTPS, or deploy issue | Confirm homepage loads with no login wall |
| Stuck on Pending | Crawl not finished | Wait 24–48h, then Check status in AdSense |
Production (Vercel)
This site is deployed on Vercel. AdSense values are injected at build time—configure them in the Vercel dashboard:
- Open Vercel Dashboard → select this project → Settings → Environment Variables.
- Add these four variables (Production; optionally mirror them on Preview / Development for branch previews):
| Variable | Description |
|---|---|
ADSENSE_CLIENT | AdSense publisher ID (ca-pub-…) |
ADSENSE_SLOT_ARTICLE_TOP | Slot for above-article placement |
ADSENSE_SLOT_ARTICLE_BOTTOM | Slot for below-article placement |
ADSENSE_SLOT_SIDEBAR | Slot for sidebar placement |
- Redeploy after saving (Deployments → latest deployment → Redeploy, or push a new commit). Changes do not apply until the next build.
Do not commit .env to Git. It is listed in .gitignore.
Local development
Copy .env.example to .env and fill in the variables above. docusaurus.config.ts loads .env at build time via dotenv.
npm run build
Compliance & UX
- If you use the manual ad units above, turn off Auto ads (Site → Auto ads → disable all formats). Auto ads inject extra
<ins>elements that stealpush({})from manual units—often you only see the “Ad” label and the bottom slot never fills. - This site is a Docusaurus SPA:
src/theme/Root.tsxandAdSlotre-request fills on client-side navigation. After deploy, hard-refresh and click between doc pages to verify all three slots. - Right after apex becomes Ready,
doc.may stay unfilled for hours or days while inventory ramps up. - Disclose cookies and ad partners in your privacy policy or a dedicated page.
- For investing and health content, avoid ad copy that could be mistaken for editorial advice; ad blocks are labeled “Ad”.
- If AdSense review fails, alternatives such as Carbon or EthicalAds are possible—you would adapt
src/components/AdSlot.
Disabling ads
Remove ADSENSE_CLIENT or leave it empty, then redeploy; the build will not load the AdSense script site-wide.