AdSense Testing Guide for mrajan.com.np
Current Setup
✅ AdSense is configured to load ONLY on blog post pages (pages with layout: post)
- ✅ Blog posts: AdSense enabled
- ❌ Main pages (home, about, portfolio): AdSense disabled
- ❌ mgpc-stream: AdSense disabled
Domain: mrajan.com.np
Step 1: Verify Domain in AdSense
- Go to AdSense Dashboard
- Visit https://www.google.com/adsense/
- Navigate to Sites → Add site
- Add Your Domain
- Enter:
mrajan.com.np - Also add:
www.mrajan.com.np(if you use www) - Click Continue
- Enter:
- Verify Domain Ownership
- Google will provide a verification code
- Add it to your site’s HTML
<head>or via DNS - Or verify via Google Search Console (if already connected)
- Enable Site Authorization (Important for Security!)
- Go to Settings → My Sites
- Enable Site Authorization
- Add authorized domains:
mrajan.com.npwww.mrajan.com.np(if applicable)
Step 2: Test Locally
Option A: Test Mode (Recommended)
To test without affecting your account, you can temporarily add test mode parameter:
In _includes/head.html, temporarily change line 69 to:
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4166647782860352&test=true"
crossorigin="anonymous"></script>
This shows placeholder ads that won’t affect your account.
Option B: Build and Check HTML
# Build your Jekyll site
bundle exec jekyll build
# Check if AdSense script appears in post pages
grep -r "adsbygoogle" _site/posts/
# Check if it's NOT on non-post pages
grep -r "adsbygoogle" _site/ | grep -v "posts"
Step 3: Test in Production
Deploy to GitHub Pages
- Commit and push your changes:
git add . git commit -m "Add AdSense to blog posts only" git push origin main - Wait for GitHub Pages to build (usually 1-2 minutes)
Verify on Live Site
Check Blog Post Pages (Should have AdSense):
- Visit any blog post:
https://mrajan.com.np/posts/2023-07-11-ssg-vs-ssr/ - Right-click → View Page Source
- Search for “adsbygoogle”
- ✅ Should find:
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4166647782860352"
Check Non-Post Pages (Should NOT have AdSense):
- Visit homepage:
https://mrajan.com.np/ - Visit about page:
https://mrajan.com.np/aboutme/ - Visit posts listing:
https://mrajan.com.np/posts/ - Right-click → View Page Source
- Search for “adsbygoogle”
- ❌ Should NOT find the AdSense script
Browser Testing
- Clear Browser Cache
- Hard refresh:
Cmd+Shift+R(Mac) orCtrl+Shift+R(Windows)
- Hard refresh:
- Check Browser Console
- Open DevTools (F12)
- Go to Network tab
- Filter: “adsbygoogle”
- Visit a blog post
- Should see request to
adsbygoogle.js
- Check for Errors
- Go to Console tab
- Look for AdSense-related errors
- Common issues:
- Domain not verified
- Site not authorized
- Invalid client ID
Step 4: AdSense Dashboard Checks
- Check Site Status
- AdSense Dashboard → Sites
- Your domain should show as “Ready” or “Getting ready”
- May take 24-48 hours after first ad load
- Check Ad Units (if you’ve created any)
- Go to Ads → By ad unit
- Create ad units for placement in blog posts
- Check Policy Status
- Ensure no policy violations
- Site must comply with AdSense policies
Step 5: Automatic Ad Placement Testing
Google’s Auto Ads will automatically place ads on your blog post pages. To test:
- Wait for Ads to Appear
- Can take a few hours to a day after deployment
- Google crawls your site automatically
- Check Ad Placement
- Visit a blog post
- Scroll through the page
- Ads should appear automatically in optimal positions
- Manual Ad Units (Optional)
- If you want specific ad placements, create ad units in AdSense
- Add them manually to
_layouts/post.html
Troubleshooting
Ads Not Showing?
- Check Domain Verification - Must be verified in AdSense
- Check Site Authorization - Domain must be authorized
- Wait Time - Can take 24-48 hours after setup
- Browser Extensions - Disable ad blockers for testing
- Check Console - Look for JavaScript errors
Ads Showing on Wrong Pages?
- Check
_includes/head.html- Ensure conditional is correct - Verify
page.layout == 'post'is working - Check Jekyll build output
Domain Issues?
- Ensure
CNAMEfile points tomrajan.com.np - DNS must be properly configured
- GitHub Pages custom domain must be set up
Important Notes
⚠️ Don’t Click Your Own Ads - This violates AdSense policy and can result in account suspension
⚠️ Use Test Mode for Local Testing - Avoid invalid click activity during development
⚠️ Monitor AdSense Dashboard - Check for any warnings or policy issues
Summary
Your AdSense is now configured to:
- ✅ Load ONLY on blog post pages (
layout: post) - ✅ Keep main site ad-free (better ToS compliance)
- ✅ Use your domain:
mrajan.com.np - ✅ Client ID:
ca-pub-4166647782860352
Next steps:
- Verify domain in AdSense dashboard
- Enable site authorization
- Deploy to GitHub Pages
- Test on live blog posts
- Monitor AdSense dashboard for status