Google Ad Manager

Difficulty: Intermediate | Updated: April 13, 2022
Pro Feature

AdRotate always supported Google Ad Manager, but with its increasing popularity recently support got extended a little bit.
Most notably a place to add the header code has been added to AdRotate. This is of-course to make it easier to add Google Ad Manager adverts.

When you create an advert in Google Ad Manager and perhaps some types in Google Adsense as well you’ll get 2 pieces of code. One of which is supposed to go in your websites header, the other piece of code goes where the advert should show up. In AdRotate that’s in an advert you create.

Adding the header code

First, add the header code in AdRotate. You’ll find the text field for that in the ‘Header & ads.txt’ tab in ‘Manage Adverts’.

Simply paste the header code for your advert in the Google Ad Manager field:

And that’s it for the header. Click save and continue.

Adding the body code

Next, create the actual advert in AdRotate. You’ll do that the usual way from ‘Manage Adverts’ by clicking ‘New Advert’.
In the create advert screen paste the body code in the AdCode field.

That’ll look something like this:

To make the advert functional you need a schedule as well. And perhaps you select a group for the advert.
Google of-course has its own tracking. Click tracking won’t work in AdRotate (Pro) for these adverts. But Impression tracking will work.
This is however not required for the advert to function.

Multiple adverts

If you have multiple adverts, and as such multiple header codes, you can combine those codes by taking 1 line from each extra header code and adding it to the one you’re going to use.

For example this:
<script async='async' src='https://www.googletagservices.com/tag/js/gpt.js'>
<script>
var gptadslots = [];
var googletag = googletag || {cmd:[]};
googletag.cmd.push(function() {
//Adslot declaration
gptadslots.push(googletag.defineSlot('/123/Test', [[728,90]], 'div-gpt-ad-1234567-1') .addService(googletag.pubads()));
googletag.enableServices();
});
</script>

And this code:
<script async='async' src='https://www.googletagservices.com/tag/js/gpt.js'>
<script>
var gptadslots = [];
var googletag = googletag || {cmd:[]};
googletag.cmd.push(function() {
//Adslot declaration
gptadslots.push(googletag.defineSlot('/456/Demo', [[728,90]], 'div-gpt-ad-7654321-1') .addService(googletag.pubads()));
googletag.enableServices();
});
</script>

You’ll notice that these 2 snippets are almost identical.
And if you look in the second code you’ll see that the adslot definition is a little different.

gptadslots.push(googletag.defineSlot('/456/Demo', [[728,90]], 'div-gpt-ad-7654321-1') .addService(googletag.pubads()));

This means that you can copy that line and add it to the first header code just below the one that’s already there in the header code you’re going to use. That way it’ll look like this:

<script async='async' src='https://www.googletagservices.com/tag/js/gpt.js'>
<script>
var gptadslots = [];
var googletag = googletag || {cmd:[]};
googletag.cmd.push(function() {
//Adslot declaration
gptadslots.push(googletag.defineSlot('/123/Test', [[728,90]], 'div-gpt-ad-1234567-1') .addService(googletag.pubads()));
gptadslots.push(googletag.defineSlot('/456/Demo', [[728,90]], 'div-gpt-ad-7654321-1') .addService(googletag.pubads()));
googletag.enableServices();
});
</script>

And with that you have now prepared AdRotate to show 2 adverts in 2 different slots.
Repeat these steps to add as many ad slots as you need.
Click save further down on the page and head over to Manage Adverts in AdRotate Pro.

Back to AdRotate Manuals

You may be interested in