updateAdUnitInfo
Updates an existing ad unit in the AD_UNITS array while preserving existing properties, then triggers a re-render.
Signature
updateAdUnitInfo(adUnitInfo)
Category
Inventory
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
adUnitInfo | Object | Yes | null | Object containing ad unit information with a code property to identify the ad unit. Only provided fields will be updated. Optional boolean key: collapseEmptyImpression — collapses the ad's container div if no impression is served for the ad unit. |
Returns
boolean
True if the ad unit was found and updated; false if not found.
Usage
- Include only the fields you want to update; other fields will be preserved.
- Call this before refreshing to ensure the latest config is applied.
- To hide the ad container when no impression is served, set
collapseEmptyImpression: trueinadUnitInfo.
Examples
Update ad unit with collapse on no impression
bqjs.updateAdUnitInfo({
code: "banner_1",
divId: "banner_div",
collapseEmptyImpression: true
});