Place customisable ads across your Ghost publication with a Google Ad Manager integration

Google Ad Manager can help you manage your advertising business and grow your revenue streams with user-driven tools that scale to the needs of your publication. It is an efficient, hosted ad serving platform that streamlines ad management on your site, giving you full control of your brand.

Here's how to get started with Google Ad Manager and Ghost.

Sign up for Google Ad Manager

In order to sign up for Google Ad Manager, you will need to have an approved Google AdSense account.

Create Ad Units

Next up, build your ads by creating Ad Units in the Google Ad Manager dashboard. For further information about Ad Manager elements, read this Google help doc which explains how inventory and delivery works.

You can also enable AdSense for your Google Ad Manager network, or specific Ad Units. ‌

Inject generated code on your Ghost publication

Once you have completed the necessary configuration for your ads in the Google Ad Manager dashboard, generate your ad tags to place on your site.

Google Ad Manager gives you full control over how you serve ads on your site. With Ghost, there are a few different ways to implement the generated code and unique ad tags.

Code injection

If you would like to place a snippet of code across your site, you can use the Code Injection feature. This will inject the code across all of your posts and pages in Ghost in the <head> or <foot>:

Site wide code injection

To inject generated code for a specific ad slot, you can also use code injection on individual posts or pages from within the editor:

Or you could use an HTML card within the editor to place ad slots inline with your content:

Place ads in specific areas of your site

The more likely outcome is that you would like full control over the placement of your ads within your theme. Popular places to display ads include in the sidebar or at the top and bottom of a page.

It's entirely possible to paste your ad slot generated code anywhere in the theme layer in Ghost, which makes it possible to build designated ad slots across all posts that fits in neatly with the design of your publication.

To do this, locate the template file where you want to insert your ad unit code. In Casper, Ghost's default theme, you'll see a line of code specifically reserved for inserting comments at the bottom of a post. This is one example of where your ad tags could go:‌

Make sure you remove the comments on line 65 and 69

Once you're done, save your updated files and upload a fresh copy of your theme. This can be done from the design menu in Ghost Admin. Don't forget to restart Ghost if you're self-hosting.

Install an ads.txt file

Using an ads.txt file is not a requirement but is advised in order to protect your brand and declare authorised sellers.

Authorized Digital Sellers, or ads.txt, is an initiative to improve transparency in programmatic advertising. Publishers can create their own ads.txt files to identify who is authorised to sell their inventory. The files are publicly available and crawlable by buyers, third-party vendors, and exchanges.

An ads.txt file can be created via Google Ad Manager or manually, and must be uploaded to your root domain. To do this with Ghost, simply move your ads.txt file to your theme's root directory, and then update the active theme on your site. This will ensure your file is available publicly.