Skip to main content

Using JS Widget in Web Mediation

Implementation process

All the Web mediation implementation requires consultation with your Account Manager and QA process before going live.

Code Snippet

Regular HTML

<div class="OUTBRAIN"
data-ob-contentUrl="DROP_PERMALINK_HERE"
data-widget-id="DROP_WIDGET_ID_HERE"
data-ob-installation-key="DROP_PARTNER_KEY_HERE"
></div>
<script type="text/javascript" async="async"
src="https://widgets.outbrain.com/outbrain.js"></script>

AMP HTML version — details

<amp-embed
width="100"
height="100"
type="outbrain"
layout="responsive"
data-contentUrl
data-widgetIds="DROP_WIDGET_ID_HERE"
data-installation-key="DROP_PARTNER_KEY_HERE"
data-block-on-consent
></amp-embed>

The data-contentUrl attribute will automatically fetch canonical URL of the AMP page.

Please consult with your Sales Engineer or Partner Manager before using

GAM SafeFrame

<div class="OUTBRAIN"
data-ob-contentUrl="%%PATTERN:url%%"
data-widget-id="DROP_WIDGET_ID_HERE"
data-ob-installation-key="DROP_PARTNER_KEY_HERE"
data-consent-string="${GDPR_CONSENT_164}"
data-consent-version="2">
</div>
<script type="text/javascript" async="async"
src="https://widgets.outbrain.com/outbrain.js"></script>

GAM expandable Friendly iFrame

The fixed height/width on the container element must be removed. It will not load widgets if it's served under SafeFrame.

<div class="OUTBRAIN"
data-ob-contentUrl="%%PATTERN:url%%"
data-widget-id="DROP_WIDGET_ID_HERE"
data-ob-installation-key="DROP_PARTNER_KEY_HERE"
data-consent-string="${GDPR_CONSENT_164}"
data-consent-version="2"></div>
<script src="https://widgets.outbrain.com/ob-gam/ob-gam.js"></script>

Parameters

Attribute NameRequirementDescriptionExample value
data-ob-contentUrlRequired for Web MediationThe permalink of placement to identify the currently displayed content"https://www.outbrain.com/blog/123.html"
data-widget-idRequiredThe widget id that you received from your Account Manager"AR_1"
data-ob-installation-keyRequiredThe partner key that you received from your Account Manager"DEMOP1MN24J3E1MGLQ92067LH"
data-ob-portalUrlOnly if instructed by SE, Required for Native EnvironmentA URL representing the context where the ad placement is presented to users. Does not need to be a reachable/crawlable URL."http://www.chatPortal.com"
data-ob-languageOnly if instructed by SE, Required for Native EnvironmentThe 2-letter ISO 639-1 language code"en"
data-ob-psubOnly if instructed by SE, Optional for Native EnvironmentString value for additional section-level reporting breakdowns. Allowed characters: alphanumeric and underscore '_'. Requires permission from your Sales Engineer or Partner Manager."minus1"
data-ob-adblockOnly if instructed by SE, Required for AdBlocked EnvironmentBoolean value to indicate if the placement is under the AdBlocked environment."true"
data-external-idOptionalA unique key for report breakdowns. See Engage External Id Report API for details"123abcXYZ"
data-external-secondary-idOptionalA secondary key for Engage External Id Report breakdowns as same as external-id."456defABC"
data-click-urlOptionalAn image pixel URL for tracking clicks on paid recommendations"https://yourdomain.com/click?123"
data-consent-stringOptional: Only if TCF API is not available.Base64-encoded consent string, as defined by IAB for TCF v2.0"CO4SiGQO4SiGQAGABBENAzCgAP…(omitted)…YAAAAAAAAAAA"
data-consent-versionOptionalVersion of TCF consent string"2"
data-ccpa-stringOptional: Only if US API is not available.Four digit US privacy string, as defined by IAB for CCPA compatibility. See about IAB CCPA Compliance Framework here"1YNN"
data-ob-testOptionalA boolean flag for testing. Set to true to avoid registering clicks and impressions with Outbrain during development and troubleshooting. This attribute must be removed before releasing to production."true"

Parameters in detail

Our JS Widget is fully compliant to TCF v2.0 and CCPA. It will automatically fetch consent/US privacy string from CMPs, so there's no need to pass consent string manually. However, if the WebView does not support TCF API or US API, it's possible to pass consent/US privacy string directly to widgets by using the data-consent-string or data-ccpa-string attribute.

Widget Callback Events

Custom callback scripts can be supported by Widget External Event Handler. For example, the Ad fill status of the widget can be checked by scanning the value of recsNumber at widgetDataReturned event. Widgets must be shown to users even the Ad slots are not fully filled.