How to Implement Outbrain's JavaScript Widget Code

service-account-zendesk
service-account-zendesk

Overview

Outbrain's JS widget is the most commonly used integration type. The code snippet consists of two parts:

  • A <div> container
  • A <script> tag that loads the Outbrain library asynchronously — so it won't affect your page load speed.

Before You Begin

Your Account Manager will provide the correct WIDGET_ID values for each placement. Do not use placeholder or example IDs.


Implementation Steps

  1. Place the code snippet in the <body> of your page, at the exact position where you want the widget to appear.
    • If you have multiple widgets, place each corresponding snippet in its respective position on the page.
  2. Pass the page URL dynamically into the data-src variable. This should be the URL of the page where the widget is loading.

Setting the data-src Value

  • Use the page's canonical URL or og:url.
  • Always use a live article URL.

⚠️ Important: Using a staging or development URL as the data-src value is one of the most common causes of content not appearing in the widget.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.