Step‑by‑Step Guide to Adding Google AdSense to a Halo‑Based Blog
This tutorial walks through registering a Google AdSense account, passing site approval, and three practical integration methods—including inserting the AdSense script, using a meta tag, and configuring an ads.txt file with Nginx—followed by tips for ad placement on a personal blog.
Effect Demonstration
The author shows a screenshot of the personal blog (flyeric.top) after AdSense integration, illustrating how ads appear on the site.
Site Approval Process
First, create a Google AdSense account at https://adsense.google.com/start/. Google reviews the site to ensure it contains normal blog or news content without policy violations; the author waited about five days, though some sites may require 2–4 weeks.
Three Integration Methods
Method 1: Direct AdSense Script
Insert the fixed AdSense script into the <head> section of every page, typically between the <header> (if present) and the closing </head> tag. This approach is invasive and requires updating all pages, so the author does not recommend it.
Method 2: Meta Tag (Meta‑Tag Verification)
Similar to the script method, place a meta element containing the verification code inside the <head>. It is slightly simpler but still relies on adding markup to each page.
Method 3: ads.txt File
Copy the ads.txt content provided in the AdSense dashboard, create a local ads.txt file, and upload it to the website’s root directory. Verify the file is reachable (e.g., https://flyeric.top/ads.txt). If the request fails, ensure the server serves the file correctly.
Nginx Configuration for ads.txt
If the ads.txt file is not accessible, add a location block to nginx.conf:
location = /ads.txt {
alias /www/wwwroot/flyeric.top/ads.txt;
expires 1h; # reasonable caching
add_header Cache-Control "public";
access_log off;
if ($request_uri ~* "\.\.\") { return 403; }
}After reloading Nginx, the file should be reachable, completing the verification step.
Ad Placement Settings
Once approved, the author chose the “by site” automatic ad format, allowing Google to place ads automatically. To minimize disruption, most PC‑side ad slots were removed, keeping only a bottom‑of‑article ad on mobile devices. The author also notes the variety of ad formats available (pop‑ups, sidebars, header/footer banners, in‑content ads) and suggests selecting those that suit the site’s layout and user‑experience goals.
Conclusion
The overall integration was smooth; for blogs with healthy content, clear structure, and decent traffic, the author recommends trying AdSense as a potential passive income source.
Eric Tech Circle
Backend team lead & architect with 10+ years experience, full‑stack engineer, sharing insights and solo development practice.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
