Niveau 1
Niveau 2
Se connecter à la communauté
Connectez-vous pour voir tous les badges
I am attempting to track clicks on a button that lives inside a modal. The modal does not exist when the page first loads -- it is rendered only after the user takes a certain action.
I have successfully added the goal metric using the VEC; I can see the blue highlight around the selected element.
However, clicks on this element are not being tracked. When I inspect the element with dev tools, it lacks the class "at-element-click-tracking", which tells me that is not getting wired up properly. (For reference, other elements on that page are tracked just fine.)
Should I expect this setup to work? Should I be able to track clicks on dynamic elements? Or is Target limited to tracking elements which are present at the time of page load?
I'm running at.js 2.2. The activity is being served through my global mbox.
Résolu ! Accéder à la solution.
Les sujets facilitent la catégorisation du contenu de la Communauté et vous aident à retrouver le contenu le plus pertinent.
Vues
Réponses
Nombre de J’aime
Hi Travis,
The modal code should to added in the custom code, then the modal gets rendered when the page load event . You can use Adobe Experience template for the same . Refer to this url (https://github.com/Adobe-Marketing-Cloud/target-experience-templates/tree/master/lightbox-exit-inten...). Once you deploy the code through the custom code in modifications. The pop - up comes up for every page load event.
Vues
Réponses
Nombre de J’aime
You can select button in modal by using browse option in VEC.
If you are still not sure if clicks are getting tracked you can add button id/class in modifications (add modifications) this will work if html of modal is already present after page load.
Let me know if this helps you
Vues
Réponses
Nombre de J’aime
_
Vues
Réponses
Nombre de J’aime
Vues
Réponses
Nombre de J’aime
Vues
Réponses
Nombre de J’aime
Should be also possible to track contents generated after an AJAX Call using the AT v2 triggerView() ? Does Adobe Target bind all track events to elements once a particular view is triggered?
Vues
Réponses
Nombre de J’aime
Vues
Réponses
Nombre de J’aime
Was any of those workarounds successful? Could you please comment how you did if you found a successful way to track those kind of cases? Thanks
Vues
Réponses
Nombre de J’aime
We've been getting a lot of mileage out of custom events. Here's a simplified/contrived example:
let header = document.querySelector('.header');
let newButton = '<a id="new-cta-button" href="https://www.google.com">Click here</a>';
header.insertAdjacentHTML('afterbegin', newButton);
const linkElement = document.querySelector('#new-cta-button');
linkElement.addEventListener('click', function(event) {
s.tl(this, 'o', 'target-cta-button-click');
});
(I'm the original poster, btw. Not sure why my usernames are crossed up.)
Thanks for your insights! Looks promising.
I understand all the code until the ¿minified? line:
s.tl(this, 'o', 'target-cta-button-click');
Could you further explain or use the unmifiedtversion?
It's not minified.
"s" is the AppMeasurement instance, and .tl() is the track link method:
Vues
Réponses
Nombre de J’aime
Vues
Réponses
Nombre de J’aime
Hi Travis,
The modal code should to added in the custom code, then the modal gets rendered when the page load event . You can use Adobe Experience template for the same . Refer to this url (https://github.com/Adobe-Marketing-Cloud/target-experience-templates/tree/master/lightbox-exit-inten...). Once you deploy the code through the custom code in modifications. The pop - up comes up for every page load event.
Vues
Réponses
Nombre de J’aime
Vues
Réponses
Nombre de J’aime
Vues
Likes
Réponses
Vues
Likes
Réponses