How To Add Google AdSense To Hugo + PaperMod Website
Visit pacebits.com for my recent projects
Goal
Add Google AdSense to the website to monetize it 💸💸
Prerequisites
- Website built with Hugo and PaperMod theme
- Google AdSense account
Steps
- Add the website to Google AdSense account.
- [Optional] Config Ads setting in Google AdSense.
- Get AdSense code snippet, which should be similar to the following:
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=xxxxxxxxxx" crossorigin="anonymous"></script>
- Create file
layouts/partials/extend_head.html
in the code of the website, if it doesn't exist.- Note: the content of this file will be added to
<head>...</head>
of the page by PaperMod.
- Note: the content of this file will be added to
- Paste "AdSense code snippet" into
layouts/partials/extend_head.html
. - Create file
static/ads.txt
in the code of the website, if it doesn't exist. - Paste "Ads.txt snippet" from AdSense into
static/ads.txt
- Verify the change locally, and deploy it.
- Submit review request in Google Adsense, and wait for the processing.
DONE!
<<< Older Post
DNSSEC ExplainedNewer Post >>>
How To Integrate ChatGPT With Apple HomeKit