All docs
PublishersUpdated November 5, 2026

Prebid.js with Google Ad Manager

Add the Worksly bidder to Prebid.js 8, set up the GAM order and line items, and wire key-values so auction bids compete against your full stack.

This page walks through connecting Prebid.js 8 on your site to Worksly demand, and configuring Google Ad Manager so winning bids compete in your GAM stack. It assumes you already run Prebid.js 8 or newer and have a GAM account with line-item permissions. If you do not run a wrapper today, the simpler paths are the Worksly plugin or tag, which handle this configuration for you.

Prerequisites

  1. Prebid.js 8+ on your pages, with pbjs initialized before your GAM tag code.
  2. Your Worksly account active, with placements registered under Settings → Inventory. The exact placement IDs are in your dashboard.
  3. GAM with an order and line items you can create: step 4 below.

The Worksly Prebid adapter is maintained by us and configured in the Worksly dashboard: you set demand options on the dashboard side, and your integration only references the bidder code worksly.

Step 1: define the ad unit

Register each slot with Worksly as one bidder among the bidders you run. A typical banner ad unit:

pbjs.que.push(function () {
  pbjs.addAdUnits([
    {
      code: 'div-gpt-ad-article-top',
      mediaTypes: {
        banner: {
          sizes: [[970, 250], [728, 90], [320, 50]]
        }
      },
      bids: [
        { bidder: 'worksly', params: { placementId: 'YOUR_PLACEMENT_ID' } }
      ]
    }
  ]);

  pbjs.setConfig({
    priceGranularity: 'dense',
    enableSendAllBids: true
  });
});

Notes on the configuration:

  • placementId must match a placement in your dashboard; each slot gets its own. The exact IDs are in your dashboard under Settings → Inventory.
  • priceGranularity: 'dense' is Prebid’s dense scale: one-cent buckets up to $3.00, five-cent buckets to $8.00 and fifty-cent buckets to $20.00, which is what the GAM setup in step 4 targets.
  • enableSendAllBids: true sends each bidder’s price to GAM, so reports show per-bidder values in hb_bidder.
  • For video slots, use the video media type with your player’s context; for native, the native type. Both work through the same worksly bidder.

Step 2: request bids and pass targeting

On each page view, request bids and hand the results to GAM:

pbjs.que.push(function () {
  pbjs.requestBids({
    bidsBackHandler: function () {
      pbjs.setTargetingForGPTAsync();
      window.googletag = window.googletag || {};
      googletag.cmd.push(function () {
        googletag.pubads().refresh();
      });
    }
  });
});

setTargetingForGPTAsync() sets the key-values (hb_pb, hb_bidder, hb_adid) on each GAM slot. Worksly’s auction responds in real time, so the wrapper timeout bounds the slowest other bidder.

Step 3: create the GAM order

In GAM, create one order dedicated to auction demand. A common convention: order name Worksly HB, advertiser set to your house programmatic advertiser. All line items for header bidding demand live under this order, which keeps reporting clean and lets you pause the whole path if you ever need to.

Step 4: create line items per price bucket

Create one GAM line item per price bucket, named with the convention:

HB_- PREBID - 5.00

The name encodes the bucket’s clearing price, so GAM delivery reports read directly against bid data. With dense granularity, the bands are:

Price range Step Example line item names
$0.01 – $3.00 $0.01 HB_- PREBID - 0.01 … HB_- PREBID - 3.00
$3.00 – $8.00 $0.05 HB_- PREBID - 3.05 … HB_- PREBID - 8.00
$8.00 – $20.00 $0.50 HB_- PREBID - 8.50 … HB_- PREBID - 20.00

Each line item gets: rate equal to its bucket price, the same priority (value 12 is typical for this order), and a creative of the type your Prebid setup renders. The dashboard provides the creative snippet that renders the winning bid from hb_adid. If your account was set up through the dashboard-guided flow, the full bucket list is generated for you under Settings → Inventory → GAM setup.

Step 5: set up key-value targeting

Create the three key-values in GAM, all as Include values in reporting:

Key Meaning Values
hb_pb Winning price bucket Matches line item names, e.g. 5.00
hb_bidder Bidder that won worksly plus your other bidder codes
hb_adid Prebid ad ID for the winning bid Dynamic, used by the creative

Target every line item in the Worksly HB order on hb_pb matching its own bucket name. That single targeting rule is what makes a $7.50 bid land on the HB_- PREBID - 7.50 line item.

Step 6: verify delivery

  1. Open a page with your tag in a test environment, then check GAM delivery: line items in the Worksly HB order should serve, and each served impression should show hb_bidder=worksly among its key-values.
  2. In the Worksly dashboard, compare bid win rate against GAM delivery counts. Persistent gaps mean a bucket range in GAM that no line item covers.
  3. Review bid-loss reasons in the dashboard for the first week. Losses clustered in price are normal; losses clustered in errors or timeouts are wiring problems.

Placement IDs, account IDs and the generated bucket list are account-specific. Always copy them from your dashboard under Settings → Inventory.

Was this page helpful?It goes straight to the engineer who wrote it.
Suggest an edit
Next step

Start monetizing
with Worksly

Once the tag is live, the reports start filling in with the first impressions.