How to customize ad unit names ?

Summarize how to customize ad unit names ?

By default, the integration uses the adUnitCode defined in the Ad Unit.
If you want Pubstack to use another name, you just have to provide the desired value through the pubstack.adUnitName property.
The following example shows you how to set a custom name, whatever the ad unit code is:

const adUnits = [
{
code: `random-adunit`,
pubstack: {
adUnitName: 'top_hb_leaderboard',
},
mediaTypes: ...
bids: [{ bidder: 'appnexus', params: ... }],
},
{
code: `random-adunit-2`,
pubstack: {
adUnitName: 'middle_hb_square',
},
mediaTypes: ...
bids: [{ bidder: 'appnexus', params: ... }],
}];


pbjs.que.push(pbjs.addAdUnits(adUnits));

With this feature, you also have the ability to essentially merge adUnits under the Pubstack UI, by assigning the same pubstack.adUnitName to several adUnits. This can be useful for infinite scroll adUnits, or when it comes to randomly generated adUnitCode.