> For the complete documentation index, see [llms.txt](https://docs.relevant-digital.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.relevant-digital.com/technical/integration/advanced-implementation-patterns/push-google-slot-information-to-the-prebid-auction.md).

# Push Google slot information to the Prebid auction

## **Overview**

This article outlines a method by which a publisher can retrieve information from the gpt slot setup and pass it into the pbjs adUnit object. This can be useful for certain specific bidder requirements.

This example involves the use of the '[onSlotAndUnit](https://help.relevant-digital.com/knowledge/relevantdigital.loadprebid)' callback. A callback function that will be invoked for every slot that will participate in the auction.

Using the onSlotAndUnit exposes; 'slot' the gpt slot object, 'unit' information on the placement settings in yield, the auction object. From there 'unit' object we can retrieve the pbAdUnit which is where we can set extra adUnit informaiton to be passed to pbjs.

### **Code**

```
relevantDigital.addAuctionCallbacks({
    onSlotAndUnit: ({ slot, unit }) => {
        const path = slot.getAdUnitPath();
        const tgtArray = slot.getTargetingMap();
        const newObj = unit.pbAdUnit.newObj = {};
        const tgtValue = tgtArray.tgtValue[0];
        newObj.adUnitPath = path;
        newObj.targeting = {key: tgtValue}
    }
});
```

## **Walk-through**

Opposed to demonstrating the usecase in relevantDigital.loadPrebid(), the code is using [relevantDigital.addAuctionCallbacks](https://help.relevant-digital.com/knowledge/relevantdigital.addauctioncallbacks) instead. The addAuctionCallbacks function is useful for implementing callback functions in scenarios where it may not be possible to edit relevantDigital.loadPrebid().

onSlotAndUnit is a callback function that will be invoked for every slot that will participate in the auction. onSlotAndUnit exposes; 'slot' the gpt slot object, 'unit' information on the placement settings in yield, the auction object.

From the 'slot' object we can use the gpt functions to retrieve gpt slot information to be passed to the pbAdUnit. In this example we use 'getAdunitPath()' and 'slot.getTargetingMap()' to retrieve the fulll path of the gam slot and the targeting that will be set on this slot respectively

From there 'unit' object we can retrieve the pbAdUnit which is where we can set extra adUnit informaiton to be passed to pbjs ([prebid AdUnit](https://docs.prebid.org/dev-docs/adunit-reference.html) setup).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.relevant-digital.com/technical/integration/advanced-implementation-patterns/push-google-slot-information-to-the-prebid-auction.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
