I am trying to implement header bidding using prebid in next.js. I have two scenarios given below
- First ad unit is placed in sidebar of the website. This ad unit will serve for every page user visits. N.B. sidebar is a component.
- Second ad unit is only placed in /news/[..slug] path. When a user visits this path, both First and second ad unit will serve ads.
Now I have a single prebid.js code which competes for both ad units and I have placed it in _app.js file so that every page can access them. But there is a problem e.g.
In root url "/" prebid competes for two ad units but only the sidebar ad unit is present. So, for the second ad unit won't we lose impression as the ad unit is not present on root url and ad won't be displayed?
So how do I configure my prebid scripts for above those scenarios?
Possible solution in my mind:
- create two prebid scripts for two ad units.
- first ad unit prebid script will be placed on _app.js file header.
- second ad unit prebid script will be placed only on /news/[..slug] page header.
Will there be any conflict between two prebid scripts when user goes to /news/[..slug] page because both prebid scripts will be there? So what is the best practice?