Skip to content

feat: added adsense on /free page#1424

Merged
MODSetter merged 2 commits into
mainfrom
dev
May 22, 2026
Merged

feat: added adsense on /free page#1424
MODSetter merged 2 commits into
mainfrom
dev

Conversation

@MODSetter
Copy link
Copy Markdown
Owner

@MODSetter MODSetter commented May 22, 2026

Description

Motivation and Context

FIX #

Screenshots

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR integrates Google AdSense into the /free page by adding a reusable ad component system. The implementation includes three new components (AdSenseScript, AdUnit, and centralized slot configuration), environment variable configuration for the AdSense client ID and slot IDs, and places two ad units on the free hub page (one above the model table and one before the FAQ section). The ads are fully optional and controlled by environment variables, allowing them to be disabled by leaving the configuration empty.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_web/public/ads.txt
2 surfsense_web/.env.example
3 surfsense_web/components/ads/adsense-config.ts
4 surfsense_web/components/ads/adsense-script.tsx
5 surfsense_web/components/ads/ad-unit.tsx
6 surfsense_web/app/(home)/free/page.tsx

Need help? Join our Discord

Summary by CodeRabbit

Release Notes

  • New Features
    • Integrated Google AdSense advertising into the free hub page with multiple advertisement placements strategically positioned throughout the content
    • Added advertisement units within the free tier experience to support ongoing platform development
    • Configured environment variables and ad verification settings to enable advertising monetization

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
surf-sense-frontend Building Building Preview, Comment May 22, 2026 4:05am

Request Review

@MODSetter MODSetter merged commit 3347297 into main May 22, 2026
5 of 9 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 109a7cbf-cec9-451f-9b26-34348fcb4156

📥 Commits

Reviewing files that changed from the base of the PR and between 49dd840 and c381dd5.

📒 Files selected for processing (6)
  • surfsense_web/.env.example
  • surfsense_web/app/(home)/free/page.tsx
  • surfsense_web/components/ads/ad-unit.tsx
  • surfsense_web/components/ads/adsense-config.ts
  • surfsense_web/components/ads/adsense-script.tsx
  • surfsense_web/public/ads.txt

📝 Walkthrough

Walkthrough

This PR integrates Google AdSense into the SurfSense free hub page. It adds environment configuration for AdSense credentials, creates reusable ad script and unit components with safety guards, integrates them into the free hub page at two placements, and adds the ads.txt publisher verification file.

Changes

Google AdSense Integration

Layer / File(s) Summary
Environment and slot configuration
surfsense_web/.env.example, surfsense_web/components/ads/adsense-config.ts
Defines NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID and two NEXT_PUBLIC_GOOGLE_ADSENSE_SLOT_* environment variables, exported as a centralized ADSENSE_SLOTS constant that maps named placements.
AdSense script and ad unit components
surfsense_web/components/ads/adsense-script.tsx, surfsense_web/components/ads/ad-unit.tsx
AdSenseScript injects the Google AdSense loader script conditionally; AdUnit renders individual <ins> ad containers with duplicate-push prevention, error handling, and TypeScript typing for the window.adsbygoogle API.
Free hub page ad integration
surfsense_web/app/(home)/free/page.tsx
Imports ad components and configuration, renders AdSenseScript, and places two labeled AdUnit instances above the model table and before the FAQ section using mapped slot IDs.
Publisher verification
surfsense_web/public/ads.txt
Adds Google publisher line for AdSense domain verification.

Sequence Diagram

sequenceDiagram
  participant Page as Free Hub Page
  participant AdSenseScript as AdSenseScript
  participant AdUnit as AdUnit
  participant GoogleAPI as Google AdSense API
  Page->>AdSenseScript: Mount AdSenseScript
  AdSenseScript->>GoogleAPI: Load script (if client ID set)
  Page->>AdUnit: Mount AdUnit (slot A)
  AdUnit->>AdUnit: Check data-adsbygoogle-status
  AdUnit->>GoogleAPI: Push to window.adsbygoogle
  GoogleAPI->>AdUnit: Render ad (with error handling)
  Page->>AdUnit: Mount AdUnit (slot B)
  AdUnit->>AdUnit: Check data-adsbygoogle-status
  AdUnit->>GoogleAPI: Push to window.adsbygoogle
  GoogleAPI->>AdUnit: Render ad (with error handling)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Whiskers twitch with ad-sense glee,
Scripts and slots now dance so free,
Two placements born on hub so bright,
Each earning coin in morning light! 💰✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant