Replace AdSense with Adsterra native banner - #9
Merged
Merged
Conversation
Swap the AdSense integration for the Adsterra native banner, loaded from a reusable React component on the public homepage only. - remove the adsbygoogle script from index.html and Google ad domains from the CSP in vercel.json - allow the Adsterra script/frame origins in the CSP - add AdsterraNativeBanner (useEffect script injection, mount/unmount safe) between the BYOK section and the bottom CTA - replace the Google ads.txt record with the Adsterra publisher record
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR swaps Google AdSense for an Adsterra native banner on the public homepage, updating the UI placement and tightening the surrounding ad-related infrastructure (CSP + ads.txt) to reflect the new provider.
Changes:
- Removed the AdSense script from
index.htmland removed Google ad origins from the production CSP. - Added an
AdsterraNativeBannercomponent (with CSS module) and rendered it on the landing page betweenBYOKSectionandBottomCTA. - Updated
public/ads.txtto replace the Google seller record with an Adsterra seller record (with explanatory comments).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vercel.json | Updates CSP allowlist to remove Google ad domains and allow Adsterra-related origins. |
| src/components/AdsterraNativeBanner/AdsterraNativeBanner.tsx | Adds the Adsterra native banner component that injects invoke.js and renders the slot container. |
| src/components/AdsterraNativeBanner/AdsterraNativeBanner.module.css | Styles the banner wrapper/label/container and attempts to collapse the slot when empty. |
| src/App.tsx | Places the banner on the public homepage between existing landing-page sections. |
| public/ads.txt | Replaces Google’s ads.txt record with Adsterra’s seller record and adds guidance comments. |
| index.html | Removes the AdSense script include from the base HTML. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+28
to
+40
| const script = document.createElement('script') | ||
| script.async = true | ||
| script.setAttribute('data-cfasync', 'false') | ||
| script.src = SCRIPT_SRC | ||
| script.onerror = () => setFailed(true) | ||
| document.head.appendChild(script) | ||
| activeScript = script | ||
|
|
||
| return () => { | ||
| script.remove() | ||
| if (activeScript === script) activeScript = null | ||
| container.innerHTML = '' | ||
| } |
| { | ||
| "key": "Content-Security-Policy", | ||
| "value": "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; form-action 'self'; script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval' blob: data: https://esm.sh https://pagead2.googlesyndication.com https://*.googlesyndication.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; font-src 'self' data:; worker-src 'self' blob:; child-src 'self' blob:; frame-src 'self' blob: data: https://www.youtube-nocookie.com https://googleads.g.doubleclick.net https://*.googlesyndication.com; connect-src 'self' https: wss: blob: data:; manifest-src 'self'" | ||
| "value": "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; form-action 'self'; script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval' blob: data: https://esm.sh https://pl31110698.profitableratecpmnetwork.com https://*.profitableratecpmnetwork.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; font-src 'self' data:; worker-src 'self' blob:; child-src 'self' blob:; frame-src 'self' blob: data: https://www.youtube-nocookie.com https://*.profitableratecpmnetwork.com; connect-src 'self' https: wss: blob: data:; manifest-src 'self'" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Swaps Google AdSense for the Adsterra native banner on the public homepage.
Removed
adsbygoogle.js,ca-pub-7071904662816669) fromindex.htmlpagead2.googlesyndication.com,*.googlesyndication.com,googleads.g.doubleclick.net) from the CSP invercel.jsonpublic/ads.txtAdded
AdsterraNativeBannercomponent (+ CSS module): injects the Adsterrainvoke.jstag viauseEffectwithasync/data-cfasync="false", renders thecontainer-acd496412d230553ca4f4a243557f98cslot, and removes the tag plus clears the slot on unmount (remount/Strict-Mode safe, no duplicate tags)BYOKSectionandBottomCTA— dashboard, builder, admin and other authenticated pages stay ad-freescript-src/frame-src31110698) inads.txt; the 4th field is omitted because the dashboard certification ID isn't known — swap in the exact dashboard line if it has oneChecks:
npm run lint(no new warnings),npm run test(285 passed),npm run build(including prerender of 38 routes) all pass, and the prerendered homepage contains the ad container between the BYOK section and the bottom CTA.