> 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/delivery-and-compliance/implement-dsa-transparency.md).

# Implement DSA transparency

This article describes how to use the ad transparency features of Relevant Yield - and how it can be used for sites and platforms that falls under the DSA legislation.

<div data-with-frame="true"><img src="/files/f4ab5854defa7ea4951760241b05575b1c09b50b" alt=""></div>

For online marketplaces and other sites and apps where the [Digital Service Act](https://www.eu-digital-services-act.com/Digital_Services_Act_Article_26.html) may apply, Relevant Yield provides built-in functionality to help complying with those rules when headerbidding ads are displayed. This includes:

* A customizable ad info "badge" for Prebid ads that links to a page with information about the ad, such as the advertiser and other transparency information. Without customization it will appear as in the screenshot above.
* Controls for what transparency information that should be sent, as [specified by the IAB](https://github.com/InteractiveAdvertisingBureau/openrtb/blob/main/extensions/community_extensions/dsa_transparency.md) - along with the (opt-in) possibility to reject bids lacking a DSA-object.

As default, creatives lacking DSA transparency information in the way specified by IAB *will still be shown*, along with *best effort* transparency information using e.g. the advertiser domain ( **adomain** in [OpenRTB](https://iabtechlab.com/wp-content/uploads/2022/04/OpenRTB-2-6_FINAL.pdf)).

*The ad info badge works the same across Web, App, AMP and with our Prebid.JS adapter.*

{% hint style="info" %}
For some web sites it might make more sense in the long run to to implement DSA transparency manually in the site code, instead of using this built-in functionality. Jump across to the [**Manual implementation on web**](#manual-implementation) section for guidelines on how to do that.
{% endhint %}

{% hint style="warning" %}
For web the bid adapters must support setting the DSA-object, therefore it's recommended to upgrade your Prebid build to **v8.37** or later.
{% endhint %}

#### Enabling of the ad info badge and DSA data

All settings are available on the global, account, site and prebid configuration levels under the [Prebid parameters](broken://pages/8b7006f574964243f6eb592104e02fba5bf61bf5) menus. You will find the settings under **Generic Prebid Config Data** and **Ad transparency**, like below:

<div data-with-frame="true"><img src="/files/ae94841e0be1139b4dc25e033bba1d0d1c6b615b" alt=""></div>

* **Show ad information badge** - This will enable display of the "Ad info" badge on all Prebid ads, no matter if they contain a DSA-object or not.
* **Enable sending DSA data** - This will add DSA-objects in the bid requests from the client. This should be enabled in order to make SSPs and DSPs send back DSA-objects with transparency information in the bid responses.

#### Information page with and without DSA information

When the bid supplied a DSA-object, the information will be displayed similar to below:

<div data-with-frame="true"><img src="/files/58ef559f295821909b677782c043bcd68088bca5" alt=""></div>

* Information obtained from the **paid**, **behalf** and **transparency** fields in the DSA object will be included.
* If no **paid** or **behalf** field exist in the object, then **Advertiser domain** will be shown instead when available,
* The name of the SSP will be included in **Advertiser system**.

When *no DSA object is provided* in the bid the information page will be display as this:

<div data-with-frame="true"><img src="/files/9e2a8f9032835f983cf1432671c53125964804a2" alt="3-1"></div>

* **Advertiser domain** will be used when available. Notice that this field is not always available, as in a minority of cases this information is not included in the bid response.
* The SSP will be listed under **Advertiser system**.
* Without a DSA-object we can't be certain what parameters that affected the selection of the ad. Hence the phrase " *The following parameters **might** have been*.." is used for the parameter box.
* If the user has consented TCF Purpose 4 " *Use profiles to select personalised advertising*", or if a CMP is not present - then **Profiling** will be shown.
* For users that have not accepted Purpose 4, **Basic advertising** will be shown.

#### UI customization

The HTML of the ad information "badge" that will be inserted into the creative's HTML is editable via the **HTML for ad information badge** setting.

<div data-with-frame="true"><img src="/files/1da054e78f210afebb0b27118bdf6cb25e748027" alt=""></div>

This makes it possible to change the appearance, like colors and positioning inside the ad. Notice that to just change the text (that defaults to "Ad info") you should use the **Text in badge** setting instead. The following are some of the *macros* that can be used in the HTML. *They must be used inside **double** " **{**" " **}**" marks - just as in the screenshot above.*(omitted here as they clashes with the markup on this help-page)

* **link** - The URL to the information page for the bid. It is constructed by *concatenating* the content of the **Ad information page base URL** setting and a *Base64-encoded* JSON-object containing the (possible) DSA object in the bid along with additional information.
* **infoText** - The text set in the **Text in badge** setting.
* **target** - Set by the **Info window open behavior (target)** setting.
* **encoded** - *Base64-encoded* JSON-object containing the (possible) DSA object in the bid along with additional information. On *web*, this additional information will include a **divId** field corresponding to the placement on the page that he bid belongs to.

Other UI settings are listed below:

<div data-with-frame="true"><img src="/files/3b744964059c5cc428013cf205aec95edb682087" alt=""></div>

* **Text in badge** - the text on the link, defaults to "Ad info".
* **Info window open behavior (target)** - Determines if the information-page should be opened in a new tab or inside the ad placement itself, etc.

If using **Open inside ad (*****self*****)** - then the information-page will slowly scroll up and down automatically if needed, as the user normally can't scroll himself in that case. **Notice:** in apps the "Open inside ad.." option might require code changes to work as expected.

* **Override logo URL on info page**... - Changes the logo on the default information destination page.
* **Ad information page base URL** - Makes it possible to change the information page to something else. The link will be constructed by this URL concatenated with a *Base64-encoded* JSON-object containing the (possible) DSA object in the bid along with additional information.

#### DSA settings

When **Enable sending DSA data** has been selected the settings below controls the behavior. They correspond to the the settings in [IABs OpenRTB extensions for DSA](https://github.com/InteractiveAdvertisingBureau/openrtb/blob/main/extensions/community_extensions/dsa_transparency.md).

<div data-with-frame="true"><img src="/files/4a6c2a14a93a572beb4c90a99906867de60040d7" alt=""></div>

* **DSA required** - this sets the **dsarequired** value in the bid requests.
* **Enforce DSA required by rejecting bids** - If **DSA required** is set to one of the two "Required.." options ( **dsarequired** is **2** or **3**), then enabling this will reject all bids that lacks DSA object. Please notice that, at the time of writing - this combination of options is likely to reduce Prebid revenue dramatically.
* Data to publisher - sets the **datatopub** value in the bid requests.
* **Don't show own information badge if bid indicates "adrender=1"** - If **Show ad information badge** is selected but the bid contains an adrender value of >=1, then the ad will not be shown. Instead it is assumed that the creative itself will render all necessary information. This will set the **pubrender** value in the bid requests to **1** instead of **2**.
* **DSA Transparency object to send** - sets the **transparency** value in the bid requests.

#### Manual implementation on web

On web it's possible to handle both sending of DSA-objects and to handle bids' DSA-objects without using any of the settings above. This can be done by combining the following JavaScript functions:

* [relevantDigital.addPrebidConfig()](broken://pages/a9fffdd117fc36121adcb0140d78230f65b73bb2) - To set the DSA-object in bid requests.
* [pbjs.onEvent()](https://docs.prebid.org/dev-docs/publisher-api-reference/onEvent.html) - To get the bid object including its' DSA-object when it e.g. renders - so that one can use an own ad information UI.
* [relevantDigital.getAdUnitInstanceByBid()](broken://pages/f9fc6befb7147744419e6033e7a170d6016568e7) - To get the ad slot / div that a Prebid.js bid belongs to.

Optionally it's also possible to to use the [dsaControl](https://github.com/prebid/Prebid.js/blob/master/modules/dsaControl.js) Prebid.js module to reject bids lacking DSA-objects.

**Example:**

```javascript
window.relevantDigital = window.relevantDigital || {};
relevantDigital.cmd = relevantDigital.cmd || [];
relevantDigital.cmd.push(function() {

   // Set DSA object for outgoing bid requests
   relevantDigital.addPrebidConfig({
      ortb2: {
         regs: {
            ext: {
               dsa: {
                  dsarequired: 1,
                  pubrender: 2,
                  datatopub: 2,
                  transparency: [{\
                     domain: 'platform1domain.com',\
                     dsaparams: [1, 2]\
                  }]
               }
            }
         }
      }
   });

   // Listen for winning bids, can be used for drawing
   // own ad information ui
   window.pbjs = window.pbjs || {};
   pbjs.que = pbjs.que || [];
   pbjs.que.push(() => pbjs.onEvent('bidWon', (bid) => {
      const instance = relevantDigital.getAdUnitInstanceByBid(bid);
      if (instance) {
         const { slot } = instance;
         console.info('div id: ', slot.getSlotElementId());
         console.info('placement: ', slot.getAdUnitPath());
         console.info('bid DSA object: ', bid.meta?.dsa);
      }
   }));

   // We can now start the ad loading as normal
   relevantDigital.loadPrebid({
      ...
   });
});
```


---

# 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/delivery-and-compliance/implement-dsa-transparency.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.
