Ads Setup (Primary Revenue)
Enable at 1,000+ visitors. Privacy-compliant ads that don't require cookie consent banners.
⚠️ When to Enable Ads
Wait until 1,000+ visitors/month. Enabling ads too early wastes time on setup for minimal revenue.
- • Months 0-3: Launch free, focus on SEO and building traffic
- • 1,000+ visitors: Apply for ad networks (approval takes 1-2 weeks)
- • Expected revenue: $50-500/month depending on traffic and CPM
No Cookie Banner Required
All supported ad networks are privacy-compliant and don't require cookie consent banners.
✨ Ready-to-Use Components Included: Pre-built ad components are available in components/ads/
Quick Start (Any Provider)
1. Configure .env.local
NEXT_PUBLIC_ADS_ENABLED="true"
NEXT_PUBLIC_ADS_PROVIDER="carbon" # or "adsense-npa" or "ethical"
NEXT_PUBLIC_ADS_SHOW_FREE="true"
NEXT_PUBLIC_ADS_SHOW_PAID="false"2. Add provider credentials
See provider-specific sections below for credential setup
3. Use the AdDisplay component
import { AdDisplay } from '@/components/ads';
export function MyPage() {
return (
<div>
<h1>My Content</h1>
<AdDisplay /> {/* Automatically shows correct ad provider */}
</div>
);
}The component handles everything automatically - no need to create components yourself!
Google AdSense (Non-Personalized Ads)
Setup Steps
1. Apply for AdSense
- • Go to https://www.google.com/adsense
- • Apply with your domain
- • Wait for approval (1-7 days)
2. Create Ad Unit
- • In AdSense dashboard, create a new ad unit
- • Choose "Display ads"
- • Copy your Client ID (looks like:
ca-pub-1234567890123456) - • Copy your Ad Slot ID (looks like:
1234567890)
3. Configure .env.local
NEXT_PUBLIC_ADS_ENABLED="true"
NEXT_PUBLIC_ADS_PROVIDER="adsense-npa"
NEXT_PUBLIC_ADS_SHOW_FREE="true"
NEXT_PUBLIC_ADS_SHOW_PAID="false"
NEXT_PUBLIC_ADSENSE_CLIENT="ca-pub-1234567890123456"
NEXT_PUBLIC_ADSENSE_SLOT="1234567890"4. Add AdSense Script to app/layout.tsx
import Script from 'next/script';
import { config } from '@/boilerplate.config';
{config.ads.enabled && config.ads.provider === 'adsense-npa' && (
<Script
async
src={`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${config.ads.adsense.client}`}
crossOrigin="anonymous"
strategy="afterInteractive"
/>
)Note: Non-personalized ads earn ~30-50% less than personalized ads, but require no privacy concerns or cookie banners. This is the right trade-off for small tools.
Conditional Display
The AdDisplay component automatically handles conditional display based on user's license status.
Configuration Options
# Show ads to free users (default: true)
NEXT_PUBLIC_ADS_SHOW_FREE="true"
# Show ads to paid users (default: false)
NEXT_PUBLIC_ADS_SHOW_PAID="false"Best Practices
Strategic Placement
- • Place after user gets value (not immediately)
- • Sidebar or bottom of page works best
- • Don't interrupt core functionality
Provider Selection
- • Carbon: Best CPM for developer tools ($1-3), requires approval
- • EthicalAds: Good for open-source ($0.50-2), easier approval
- • AdSense NPA: Highest volume ($0.50-2), takes time to approve
Start with one provider. Test different placements. Paid users see no ads.