Expand my Community achievements bar.

Join us for an upcoming in-person Adobe Target Skill Builders event ~~> We're hosting these live learning opportunities to equip you with the knowledge and skills to leverage Target successfully. Learn more to see if we'll be coming to a city near you!

trackEvent not tracking with new at.js 2.1.0 - or does it need to be set up different?

Avatar

Level 1

With the latest version 2.1.0, the trackEvent doesn't seem to be working. I just want to track clicks on a link.

I am wondering if I have something set up incorrectly in my 'activity', although the documentation never explains how to actually set the things up in the 'activity' itself.

From the documentation: https://docs.adobe.com/help/en/target/using/implement-target/client-side/functions-overview/cmp-at_j...

I am using almost this exact code snippet:

<script>

$('a').click(function(event){

  adobe.target.trackEvent({'mbox':'homePageHero'})

});

</script>

In fact here is my code for my page (using at.js 2.1.0 version.)

<!doctype html>

<html lang="en-US">

<head>

</head>

<body>

    <a id="container1" href="https://forums.adobe.com/">Default content 1</a> test link 1

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    <script src="/js/thirdparty/at.2.1.0.min.js"></script>

    <script type="text/javascript">

adobe.target.getOffer({

mbox: 'experience-mbox',

success: function(offers) {

adobe.target.applyOffer({

mbox: 'experience-mbox',

offer: offers,

selector: '#container1'

});

},

error: function(status, error) {

//error -nothing

console.log('Error', status, error);

},

timeout: 5000

});

$('#container1').click(function(event){

adobe.target.trackEvent({'mbox':'track-mbox'});

});

    </script>

</body>

</html>

In my 'Activity' I set up experience-mbox as a location with two experiences, one is default and the second is updated text. The getOffer/applyOffer is working, this is getting changed. I added track-mbox as an additional location, it only has default content, since it is used for tracking.

Experiences.PNG

Then in the Goal Metrics i made a conversion metric for when the trackEvent mbox track-mbox was viewed, this is how I previously set up other activities that used trackEvent.

Metrics.PNG

Using the Adobe Cloud Debugger, I see two requests when I load the page, and when I click the page I see another one pop up. I haven't seen a call in the network tab (on the browser) though as I would expect.

CloudDebuggerRequests.PNG

Although I get this error when I turn on the trace

TargetConsoleLoggingError.PNG

I get no other errors at any time.

End result is the report never shows my links being tracked.

Report.PNG

I'm not sure what else to try. I set this up exactly like it used to work, and, it doesn't. Any suggestions / ideas?

5 Replies