1.3.3 • Published 2 years ago

react-outbrain-widget v1.3.3

Weekly downloads
443
License
-
Repository
-
Last release
2 years ago

react-outbrain-widget

npm.io

Embed your outbrain widget inside a react app

npm version

Demo

Live Demo

Installation

Note: react-outbrain-widget assumes outbrain.js was loaded before react's first rendering. Please make sure outbrain.js is loaded via a script tag on the app's index.html

<head>
	<script async src="https://widgets.outbrain.com/outbrain.js"></script>
</head>

With NPM

npm install react-outbrain-widget --save

Usage

Include the Component

import React from 'react';
import { OutbrainWidget } from 'react-outbrain-widget';

class Component extends React.Component {
  render() {
    return (
      <OutbrainWidget dataSrc="mySite.com" dataWidgetId="AR_1" />
    );
  }
}

Placement props (Only use advised one)

Either of the following props is required to use the component. Use the correct props and value which were advised by your Sales Engineer to represent where the widget is served.

Props NameTypeIntegration typeDescriptionExample
dataSrcStringDirect WebThe crawlable URL of the current page"http://www.webx0.com/2010/07/some-posthype-thoughts-about-flipboard.html"
obContentUrlStringWeb MediationThe crawlable URL of the placement"http://www.webx0.com/2010/07/some-posthype-thoughts-about-flipboard.html"
obBundleUrlStringAppThe store URL of the App"https://play.google.com/store/apps/details?id=com.outbrain.app"
obPortalUrlStringNative 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"

Other props

props NameTypeRequirementDescriptionExample
dataWidgetIdStringRequired The widget ID as provided by Outbrain."JS_1"
obInstallationKeyStringRequired for Web Mediation, App and Native Environment Installation/partner key as provided by Outbrain."ABC1234567890"
obUserIdStringRequired for App & Native Environment It is mandatory to pass the Google or Apple Advertising ID for Outbrain installations in mobile apps, according to Google and Apple guidelines and developer agreements. See this page for Outbrain requirements."EA7583CD-A667-48BC-B806-42ECB2B48606"
obLanguageStringRequired for App & Native Environment The 2-letter language code (ISO-639-1-alpha-2). Must be added if bundleUrl or portalUrl is sent."en"
data-ob-app-idStringRequired for pre-installed App EnvironmentThe App's unique identifier iOS: Bundle ID, Android: Application ID/Package Name"com.outbrain.app"
data-app-verStringOptionalA version number of the App"1.0.0"
obPsubStringOnly if instructed by SE, App & Native only String value for additional section-level reporting breakdowns. Allowed characters: alphanumeric and underscore '_'. Requires permission from your Sales Engineer or Partner Manager."minus1"
externalIdStringOptionalString value with maximum of 70 characters for use with the Engage Variant Reporting API. A maximum of 10K IDs/hour are supported. Contact your Partner Manager for API access."id123"

Rendering optimisation

Modifications not recommended

The component itself handles rendering of widgets when required props are given properly. When it doesn't work as expected on your site, please do not try modifying the code of component itself, but contact your Sales Engineer or Partner manager with sample pages.

The component must not be hidden or cached.

If the page history is cached in the DOM tree, please remove the component itself from the cache. Only the component placed in the visible contents should be rendered. Toggle example:

render() {
  return (
      {showOutbrainWidget ? <OutbrainWidget dataSrc="mySite.com" dataWidgetId="AR_1" /> : null}
  );
}

Server Side Rendering

The component should work with SSR. If it's used in the combination of SSR and CSR, it should either reuse the components (rehydration) or clear them (clear the Placement prop) and make sure to remove the component on hidden contents as mentioned in the previous section.

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.3.0

3 years ago

1.2.5-canary

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.3

3 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago