要在个人资料上设置的AEM目标第三方ID

时间:2018-12-07 16:34:39

标签: reactjs aem

我正在尝试在我的ReactJS Web应用程序中使用Adobe Target AEM模块设置mbox3rdPartyID。我在ReactJS应用程序中使用以下代码。但是,当我启动此页面时,它不会得到mbox3rdPartyID。我正在通过MiaProva - Chrome plugin

检查此ID
import React, {Component} from 'react';
import {hot} from 'react-hot-loader';
import Helmet from 'react-helmet';

class App extends Component {
    componentDidMount() {
        let event = new CustomEvent('at-start', {
            detail: {
                mbox: 'target-global-mbox',
                params: {                        
                    mbox3rdPartyID: '123123123'
                }
            }
        });
        document.dispatchEvent(event);
    }

    render() {
        return (
            <Template title="My Test Adobe App">
                <Helmet
                    title="New Web Ref App"
                    script={[
                        {
                            innerHTML:
                                'document.addEventListener("at-start", function(event) { var mbox = event.detail.mbox; var params = event.detail.params; adobe.target.getOffer({ mbox: mbox, params: params, success: function(offers) { var e = new CustomEvent("at-offers-received", {detail: {offers : offers, mbox: mbox } }); document.dispatchEvent(e); },error: function(status, error) {console.warn("Adobe Target custom mBox ( " + mbox + " ) request did not succeed :: ", status, error); var e = new CustomEvent("at-offers-received", {detail: {offers : [], mbox: mbox}}); document.dispatchEvent(e);} });});'
                        },
                        {
                            innerHTML: 'window.targetGlobalSettings = {globalMboxAutoCreate: false}'
                        },
                        {
                            src: 'https://xxxxx/at.js',
                            type: 'text/javascript'
                        }
                    ]}
                />
            </Template>
        );
    }
}
export default hot(module)(App);

有人可以帮助我知道问题在哪里吗?

0 个答案:

没有答案