Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

The 1st edition of the Target Community Lens newsletter is out now! Click to the right to find all the latest updates

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?

3 Replies

Avatar

Employee

Thank you for logging a Client Care ticket, Christa.

Update:

After internal investigation, we have found that the issue is isolated to hosts mapped to the "Development" environment, the issue does not occur on hosts mapped to the "Production" environment. We have an internal ticket logged for this (ref: TGT-35572).

Should anyone else experience this issue, please make sure to log a Client Care ticket with the Target activity name and the URL.

Avatar

Employee

Update: Issue was resolved with a Target release.

Avatar

Employee

@surebee,

Thank you for sharing the ticket# with us and keeping us updated!

Mihnea Docea | Technical Support Consultant | Customer Experience | Adobe | (:: 1 (800) 497-0335