> 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/implementation-and-testing-guidelines-for-direct-rendering.md).

# Implementation and testing guidelines for direct rendering

Enabling the **Direct rendering and bid exclusion settings for Prebid.js** settings will work out of the box for some sites. But if logic on the site depends on the adserver JavaScripts's reporting of whether an ad is shown - it might be necessary to do adjustments in the site code.

A typical example is code which hides placements based upon events from *Google Ad Manager*'s JavaScript API (*gpt.js*). The problematic example below might unintentionally hide placements with bids that are rendered without adserver involvement:

```
window.googletag = window.googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(() => {
    googletag.pubads().addEventListener('slotRenderEnded', (ev) => {
        if (ev.isEmpty) { // No ad, hide placement... 
            const adDiv = document.getElementById(
               ev.slot.getSlotElementId());
            adDiv.style.display = 'none';
        }
    });    
});
```

**Testing**

We recommend using the live preview functionality on the publisher account page in order to create preview links that can used both to identify issues - and, if needed, by developers.\ <br>

<img src="https://4674099.fs1.hubspotusercontent-na1.net/hubfs/4674099/1-1.png" alt="1-1" height="382" width="670">

\
The easiest way is usually to enable direct rendering on *all* placements, *without* any constraints (such as **Minimum CPM** and **Deal ID**) - by enabling it under the main **Prebid parameters** for the publisher account. The **Direct rendering and bid exclusion settings for Prebid.js** settings are available in the **Generic Placement Data** section in **Prebid Parameters**.\
\
There is no need to save anything when the default **Current settings on screen** option is selected in the live preview settings.\
\
By keeping the **Use demo bidder** checkbox enabled, demo bids will be triggered on all placements after following the link.

<img src="https://4674099.fs1.hubspotusercontent-na1.net/hubfs/4674099/Screenshot%20from%202025-11-06%2019-36-20-png.png" alt="" height="377" width="539">

**Resolution of potential problems**

Common problems includes ads which disappears - or styling issues, such as "this-is-an-ad" texts that doesn't show up.

This can be solved by replacing the usage of adserver-specific JavaScript functions for setting up listeners (such as in the problematic example above), with call(s) to [relevantDigital.addAdsCallbacks()](https://help.relevant-digital.com/knowledge/relevantdigital.addadscallbacks) - in order to set up the same listeners. This usually only requires small modifications.

**Ad iframes**

The adserver specific `<iframe>` will be removed from the div when a bid is rendered directly. Therefore it might also be good to look for any CSS-styling or JS logic which depends on that one, such as: iframe\[id^="google\_ads\_iframe\_"]::before { content: "AD"; }

Instead the directly rendered bid will be rendered inside an iframe with the attribute `data-rlv-direct-rendered`.

In order to handle the rendering of direct bids yourself, it is possible to supply a `directRenderFn` function to [relevantDigital.loadPrebid()](https://help.relevant-digital.com/knowledge/relevantdigital.loadprebid). Example:

```
relevantDigital.loadPrebid({
    .... 
    directRenderFn: (settings) => {
        const { auction, bid, adDiv, renderBid } = settings;
        if (doItCompletelyOurselves) {
             // Render bid somehow
        } else {
            // Use the default function for rendering bids
            const iframe = renderBid(settings);
            // Maybe do something with iframe
        }
    },
});
```

&#x20;


---

# 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/implementation-and-testing-guidelines-for-direct-rendering.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.
