How I Added AdSense to My Website (Ghost Blog)

Adding AdSense to a Ghost blog is easy. It takes a few clicks and pasting to get it up and running. This post outlines how I introduced ads to my own Ghost blog.

How I Added AdSense to My Website (Ghost Blog)

In January 2022 after having my site for two years, I figured I'd try to see what the advertisement ecosystem looked like. Looking around at different providers, I went with Google's AdSense as I already had other Google products in place.

Signing Up To AdSense

Signing up is just as easy as any other website.

  1. https://www.google.com/adsense/start/
  2. Put in some numbers in the calculator
  3. Clicked Get Started
  4. Put in details

Adding Ad Code to Website

Ghost have a great tutorial on how to do this, however, I'll show these steps with my own examples on how I did it.

Official Ghost + Google AdSense Integration
Integrate your Ghost site with Google AdSense to introduce relevant ads to your audience and generate revenue while you focus on your content! ✍️💰

Connecting Site to AdSense

AdSense will give you a couple of code snippets required to get the ads started. From AdSense, grab the code and inject it to the header through Ghost. This is via Settings > Code Injection then paste it into the Header area. Mine (which also has Google Analytics) looks like:

My header injection for this Ghost blog.

Creating Ad Units

Ad units are each individual ad placement on your page. These give you control of where your ads will be placed and the form factor. There is another option too, Auto Ads. These ads will be placed on your page where Google deems fit. For my website, I will be using Ad Units.

🤔
By the time you're reading this, I'll be doing an AdSense Experiment to understand what other options may suit. 

To create an Ad Unit head to your AdSense home and click on the Ads side menu option, then one of the four under "Create new ad unit". For my site, I created two Display Ads where one went to the top of a post and one at the bottom.

Creating a new ad unit.

When creating a new Ad Unit I found that generating a horizontal advertisement still gave me a square one, I had to explicitly write it out as a horizontal ad. Check out the commit for my theme below where I add the bottom ad:

Added bottom post ad · nikouu/Casper@c65ab49
The default theme for Ghost. Contribute to nikouu/Casper development by creating an account on GitHub.

Ads.txt

According to Google, ads.txt helps as:

It can help buyers identify counterfeit inventory and help you receive more advertiser spend that might have otherwise gone toward that counterfeit inventory.

More information in the two links below:

Ads.txt guide - Google AdSense Help
Authorized Digital Sellers, or ads.txt is an IAB Tech Lab initiative that helps ensure that your digital ad inventory is only sold through sellers (such as AdSense) who you’ve identified as authorized
WTF is ads.txt? - Digiday
The IAB introduced ads.txt as a tool that can help ad buyers avoid illegitimate sellers who arbitrage inventory and spoof domains.

Essentially, you add this to your root, the commit for my theme is here:

Added ads.txt · nikouu/Casper@2ea35e9
The default theme for Ghost. Contribute to nikouu/Casper development by creating an account on GitHub.

Sellers.json

Seems to allow for a more transparent way for advertisers to discover ad users.

This gives advertisers a reliable way to discover and verify the identity of publishers.

See more information:

Provide your seller information with sellers.json - Google AdSense Help
Sellers.json is an IAB Tech Lab standard that increases transparency in the ads ecosystem and helps to combat fraud. Sellers.json works through a publicly-available file of seller information. Publish

Privacy

Specific messages for privacy laws.

The EU has GDPR and California has CCPA, each of these (if I skip over a lot of nuance - don't look at me I'm not a lawyer) talk about consent and data processing. AdSense allows you to automate this consent by having a dialog show. For example if I look at the GDPR dialog, I see:

GDPR consent dialog.

You can force these dialog boxes to appear with some URL parameters outlined here:

About privacy & messaging - Google AdSense Help
Google has a long history of taking a user-first approach in everything we do. As a part of our commitment to users, we never sell personal information and give users transparency and control over the

Oh and AdSense also suggested a Privacy page, and since I don't do anything else with user data, I took a default looking template.

To Conclude

It doesn't take long at all to begin using AdSense. Some clicks, a couple of code snippets, and a text file was all I needed to start going. There is the option for automatically placed ads (Auto ads) however I opted just to have an ad only at the top and bottom of a post. Who knows, perhaps by the time you're reading that this might've changed - and it was probably easy to change too!

I hope this helped out with understanding what needed to be done, or maybe gave you a peek into what it looks like on the other side if you're considering it.

Further Reading

Create an AdSense account - Google AdSense Help
Ready to join AdSense? You need these two things to create an AdSense account: A Google Account: If you’re using Gmail or any other Google service, you already have one. If not, you can
Official Ghost + Google AdSense Integration
Integrate your Ghost site with Google AdSense to introduce relevant ads to your audience and generate revenue while you focus on your content! ✍️💰