Expand my Community achievements bar.

Get ready! An upgraded Experience League Community experience is coming in January.

Adobe Target Activities Not Loading Even Though at.js Is Loaded.

Avatar

Level 4

Hi Team,

I am facing an issue with Adobe Target on my AEM page. I am using the at.js file approach (not Adobe Launch). I downloaded the at.js file, added it to a client library, and included it on the page. In the browser console and network tab, I can see that Target is loading correctly, but Activities are not loading.

I also added the <meta name="at_property" content="xxxx" /> tag, and I set the same property in targetPageParams(), but still no change.


Below is the sample code.

<meta name="at_property" content="xxxxx"/>
<script>
window.targetPageParams = function() {
return {
"at_property": "xxxx"
};
};
</script>
<!-- Pre-hiding snippet before loading at.js asynchronously to manage flickering-->
<script>
;(function(win, doc, style, timeout) {
const STYLE_ID = 'at-body-style';

function getParent() {
return doc.getElementsByTagName('head')[0];
}

function addStyle(parent, id, def) {
if (!parent) {
return;
}

const styleTag = doc.createElement('style');
styleTag.id = id;
styleTag.innerHTML = def;
parent.appendChild(styleTag);
}

function removeStyle(parent, id) {
if (!parent) {
return;
}

const styleTag = doc.getElementById(id);

if (!styleTag) {
return;
}

parent.removeChild(styleTag);
}

addStyle(getParent(), STYLE_ID, style);
setTimeout(function() {
removeStyle(getParent(), STYLE_ID);
}, timeout);
}(window, document, "body {opacity: 0 !important}", 3000));
</script>


<script src="/etc.clientlibs/wknd-site/clientlibs/clientlib-adobe-target.lc-6544cf9fe3c838f8c6b96304a987fc51-lc.min.js"></script>


<script>
adobe.target.getOffer({
mbox: "target-global-mbox"
}).then(function(offer) {
adobe.target.applyOffer({ offer: offer });
});
</script>


Could you please help me understand why the activities are not loading and what additional steps or configuration might be missing?

Thanks.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Level 2

Hi @Rudra-2024 

It might work if you try it like this:

adobe.target.getOffer({
        "mbox": "target-global-mbox", "success": function (response) {
            console.log("Offer received:", response);
        }, "error": function (error) { console.error("Error fetching offer:", error); }
    });