---
title: "Install the header-bidding script on a page with Google Ad Manager"
description: "For a publisher whose network sells through Prebid — put the network's script in the page head above the Google Publisher Tag, place one container per ad position, set up the line item in Ad Manager and load the page, with the WordPress note and what to check when the first page view shows no network ads."
type: "howto"
audience: [publisher]
keywords: [header bidding, prebid, google ad manager, GAM, googletag, Google Publisher Tag, script, head, data-eas-ad, container, line item, key-values, hb_pb, universal creative, wordpress, async, defer, first page view]
---

Fetch the complete documentation index at: https://epom.com/ad-server/docs/llms.txt. Use this file to discover all available pages before exploring further. Append .md to any documentation page URL to get its markdown version.

# Install the header-bidding script on a page with Google Ad Manager

## What it is and why

Your pages serve ads through Google Ad Manager, and your network sells them through Prebid. The
network sends you one script line and one container per ad position, plus a line item to set up
in Ad Manager; you install them once, and every later change is made on the network's side.
The other setups — your own Prebid.js, an app — are on
[Header bidding: what a publisher installs](https://epom.com/ad-server/docs/guides/inventory/header-bidding-for-publishers.md).

**Example.** A news site runs Google Ad Manager with three positions. The network sends one
script line for the page `<head>` and three containers such as
`<div data-eas-ad="leaderboard"></div>`, plus a line item to set up in Ad Manager. From then on,
on each page view the network's campaigns bid on the three positions; a position they buy
shows their ad, the other two are filled by Google exactly as before.

## Typical scenarios

| How your pages serve ads today | What the network sends you | Where it goes |
|---|---|---|
| Google Ad Manager, no Prebid | One script and one container per ad position, plus a line item to set up in your Ad Manager | The script in the page `<head>`, the containers where the ads go |
| Google Ad Manager with your own `googletag` code you must keep | The same script; the network lists your slot ids or ad unit paths in the tag | The page `<head>`, above the Google tag |

## Step by step

1. Paste the script into the page `<head>`, **above** the Google Publisher Tag, exactly as sent:

   ```html
   <script src="https://{serving-domain}/eas/t/{tag-id}.js"></script>
   ```

   Do not add `async` and do not defer it: it has to run before Google's tag to hold the ad
   request until the bids are in.

   ![The network's Code face for its Prebid.js on the page: the script line and the container markup](https://epom.com/docs-images/ad-server/header-bidding/hb-code-our-prebidjs.webp)

2. Where each ad should appear, place the container the network sent, for example
   `<div data-eas-ad="leaderboard"></div>`. If the network adopted your existing Google slots, skip
   this step: your own `googletag` slots stay.
3. In your Google Ad Manager, create what the network describes: the key-values `hb_pb`, `hb_adid`,
   `hb_size`, `hb_bidder` and `hb_deal_epom_as`, an order with a line item targeted at your ad units,
   and the Prebid universal creative. The network's guide to this is
   [The Google Ad Manager line item](https://epom.com/ad-server/docs/guides/inventory/header-bidding-gam.md#the-google-ad-manager-line-item).
4. Load the page. Positions the network's campaigns buy show their ads; the rest are filled by
   Google exactly as before.

On WordPress, put the script in the theme's header area, not in a post block, so it loads above
the Google tag on every page.

## Caveats and exceptions

**The tag script must load before the Google tag.** Loaded after it — moved to the footer, given
`async`, or delayed by a script-optimisation plugin — it cannot hold Google's first ad request,
so the page's first impressions go without the bids and header bidding joins only from the first
refresh. The browser console says so.

The caveats that apply to every setup — who this is for, what you need before you start, the
floors and consent you keep, how changes reach the page — are on
[Header bidding: what a publisher installs](https://epom.com/ad-server/docs/guides/inventory/header-bidding-for-publishers.md#caveats-and-exceptions).

## Not working?

- **The first page view shows no network ads, refreshes do.** Where: the position of the script
  in the page source — it must be in `<head>`, above the Google Publisher Tag, without `async` or
  `defer`, and not moved by a script-optimisation plugin. The browser console reports it.

The causes common to every setup (currency floors, the consent stub, the missing tab) are on
[Header bidding: what a publisher installs](https://epom.com/ad-server/docs/guides/inventory/header-bidding-for-publishers.md#not-working).

## Reference

What the network sends per setup, and where it goes, is the table under
[Typical scenarios](https://epom.com/ad-server/docs/guides/inventory/header-bidding-for-publishers.md#typical-scenarios) on the hub. The Google
Ad Manager key-values and line item:
[The Google Ad Manager line item](https://epom.com/ad-server/docs/guides/inventory/header-bidding-gam.md#the-google-ad-manager-line-item).

## Related

- [Header bidding: what a publisher installs](https://epom.com/ad-server/docs/guides/inventory/header-bidding-for-publishers.md)
- [Add the network's bidder to your own Prebid.js](https://epom.com/ad-server/docs/guides/inventory/header-bidding-for-publishers-own-prebid-js.md)
- [Install header bidding in an app with Prebid Mobile](https://epom.com/ad-server/docs/guides/inventory/header-bidding-for-publishers-prebid-mobile.md)
- [Header bidding with Google Ad Manager](https://epom.com/ad-server/docs/guides/inventory/header-bidding-gam.md)
- [Publisher playbook](https://epom.com/ad-server/docs/roles/publisher.md)