Expand my Community achievements bar.

SOLVED

Dynamic Links Adobe Target tracking

Avatar

Level 2

I am trying to track dynamic links via AT, in the editor i have the right selectors see image, these link are dynamically added to the pages after page load so don't receive the AT class .at-element-click-tracking. Any ideas how i can track these links?

 

selected-links.PNG

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Are you trying to have all of those function as conversion mbox events? Could just put a click handler on all of them via client side js and fire off a trackEvent call.

 

Something like

 

function fireConversion() {
    window.adobe.target.trackEvent({'mbox':'facetClick'})
}

document.querySelectorAll('div.someclass').forEach((d)=> {
    d.addEventListener("click", fireConversion);
});

View solution in original post

9 Replies

Avatar

Correct answer by
Community Advisor

Are you trying to have all of those function as conversion mbox events? Could just put a click handler on all of them via client side js and fire off a trackEvent call.

 

Something like

 

function fireConversion() {
    window.adobe.target.trackEvent({'mbox':'facetClick'})
}

document.querySelectorAll('div.someclass').forEach((d)=> {
    d.addEventListener("click", fireConversion);
});

Avatar

Level 2

Thank you @Eric_Vidana  for the answer, I did read you can make your own triggers, will this create the same action /event that selecting via the editor? Because when I look in dev tools ad see the delivery action in the network tab I don't see a 'mox' key from the the ones tagged via the editor?

 

 

delivery-mbox.PNG

Avatar

Community Advisor
@johnuff can you open up that notification[0] property. There should be a mbox property in there which holds the name.

Avatar

Level 2

@Eric_Vidanathe notification does show the mbox name, just having trouble changing the type from display to click, I have tried 

 

 window.adobe.target.trackEvent({ 'mobox': 'facetClick', type: 'click'})

 

and I assume to track this mbox in Goals and Settings I create a Conversion goal of Viewed an Mbox? 

Avatar

Community Advisor
@johnuff correct. set it up as a viewed an mbox rather than click. I have noticed that click only seems to pertain to the same name as the entry mbox. I think you are on the right track.

Avatar

Community Advisor
@johnuff also, window.adobe.target.trackEvent({'mbox':'facetClick'}) the mbox name 'facetClick' will be your input/mbox name on that settings page. You can name this whatever your want. Nothing special about facetClick.

Avatar

Level 4
Just a note that forEach won't work in Internet Explorer 11, if that matters to you. https://caniuse.com/?search=foreach

Avatar

Community Advisor
@ zach_shearer fair point. same goes for arrow functions. thanks for calling it out.

Avatar

Level 2

@zach_shearer thanks yeah I know about forEach and ie11 and i would have loved to write the functionality in es6.