React Component Adobe Target at.js extension
This extension returns a React component, to be used as container for content delivered by at.js
The extension returns a React component, that acts as a container for offers delivered by at.js.
Initially, it renders a hidden
<div> element, which is later made visible once the offer content is successfully fetched by
adobe.target.getOffer() and applied by
The returned React component is to be composed into React apps, e.g.:
The component is available as a UMD module, to be included into Webpack/Browserify builds.
npm i @adobe/target-react-component
import createTargetComponent from '@adobe/target-react-component'; const Target = createTargetComponent(React); ... <Target data-mbox="testMbox"> Default mbox content </Target>
The following options can be set on the component as
||String||Yes||mbox name. It is mandatory if you want to track clicks. If not provided, an error will be logged and tracking event won't be attached.|
||Object||No||mbox parameters - an object of key-value pairs, that has the following structure:
||Number||No||timeout in milliseconds. If not specified, default adobe.target will be used. Default timeout is the one set in the at.js settings. This value can be configured using in the Target UI the on Setup->Implementation->at.js Settings page.|
- at.js must be included in the page before the React app using React components
- Server-side rendering is not yet supported, the extension is intended to be used solely on the client-side
- React Component state updating is disabled (once Target has updated component, app can’t update component)
paramsattributes can be set as follows:
<Target data-mbox="myMbox" data-param1="value1" data-param2="value2" data-timeout="3000"/>
Apache-2.0 Adobe Systems, Inc.