By Author Jonathan David
In this PLEM Academy lesson, I connect MathMonthly.com to Google AdSense and upload an ads.txt file through my hosting dashboard. I’m setting up ads for selected public posts while keeping the main site and member lesson library ad-free.
Connect your WordPress site to AdSense
I add my domain in AdSense, copy the verification code into my theme’s header scripts field alongside the existing MathJax code, and return to AdSense to verify the site and request a review.
Upload ads.txt through cPanel
- Copy the exact
ads.txtentry shown for your site in AdSense. - Paste it into a plain-text document and save it as
ads.txt. - In cPanel File Manager, upload it to your domain’s document root. In my setup, that folder is
public_html. If your hosting account serves several sites, use the document root assigned to the domain you’re connecting. - Open
yourdomain.com/ads.txtin a browser and confirm that the page displays the entry you uploaded.
Check your site after editing the header
During the walkthrough, one of my lesson accordions looked compressed after I edited the header. I checked the MathJax snippet and retested the page. The layout returned to normal during troubleshooting.