The Browsi API is an essential step to the implementation. It uses your current ad placements and optimises your ad inventory based on our machine learning software.
1. Copy and paste the code snippet on your <head> section of the page. This snippet needs to inserted after the Browsi Tag (See first steps).
<head>
<meta charset="utf-8">
<title>Hello World</title>
<script
src="https://cdn.browsiprod.com/bootstrap/bootstrap.js"
id="browsi-tag"
data-pubkey="browsi" // will be provided by Browsi
data-sitekey="browsi" // will be provided by Browsi
async > </script>
<script>
window.browsitag = window.browsitag || {};
window.browsitag.cmd = window.browsitag.cmd || [];
</script>
</head>
2. Replace each ad placement tags with the Browsi tags. Here's a simple example of an ad placement tag by Google (GPT tag)
<body>
<!-- replace this code -->
<div id="banner-ad" style="width: 300px; height: 250px;">
<script>
googletag.cmd.push(function() {
googletag.display('banner-ad');
});
</script>
</div>
</body>
And replace them with
<body>
<div id="<DIV_ID>">
<script>
window.browsitag.cmd.push(() => {
window.browsitag.display("<DIV_ID>", {
sizes: [ {w:300,h:600},{w:300,h: 250},"fluid" ],
adUnit: "AD_UNIT",
disableViewabilityOptimization: false ,
positionTag: 'top'
//can be also: 'bottom','in-content','adhesive','left-rail', 'right-rail'
});
});
</script>
</div>
</body>
API Parameters
parameter
description
type
required
example
div_id
Element id; must be a single unique id per slot on the page; unit id and element id need to be the same.
string
required
“div-gpt-ad-12345”
adUnit
Google Ad Manager ad unit to call, including the publisher id and leading “/”.
When left empty we will use the default configured ad unit on the Browsi platform.
string
required
adUnit: "/1234456/browsi/ad/unit"
sizes
A list of all sizes for this specific ad placement.
Format - {w:XXX, h:XXX} (Width x Height). For Fluid ad size - 'fluid'.
array of objects
required
sizes: [
{w:300,h:600},
{w:300,h: 250},
"fluid"
]
positionTag
Communicates the position of the ad element/unit to be served. The position tag can be from the following options: top, bottom, in-content(in-line), adhesive, rail-left and rail-right.
string
required
positionTag:'top'
parameter
description
type
required
example
keyValues
A list of all Key Values that will be passed for this ad request. You can add more key values from the Browsi dashboard.
array of objects
optional
keyValues: [
{key: 'browsi', value: 'true'},
{key: 'widget', value: 'top'}
]
disableViewability
Optimization
Optimization
A boolean toggle telling Browsi to enable AI based features to optimize this placement for maximum viewability.
boolean
optional
(can be overridden)
(can be overridden)
disableViewabilityOptimization: false
refresh
Object contains the Browsi in-view refresh configuration.
object
optional
{}
refresh: active
A boolean toggle telling Browsi to refresh in-view this ad placement.
boolean
optional
refresh:{
active: true
}
refresh: refreshSeconds
The number of seconds an ad must be in view before executing a refresh ad request.
number
required if refresh is active
refresh:{
refreshSeconds: 30
}