We have a rule in Launch to capture a paragraph(".link.sl-cta.video") click in the DOM. We also want to capture the text present in sibling div when the paragraph is clicked. We tried the below custom code in the data element to get the sibling value. nothing works. Any help appreciated. Thanks
var text = $(this).parent().find(".content-block-heading").text();
console.log(text);
var text1 = $(this).siblings(".content-block-heading").text();
console.log(text1);
The rule is getting trigger when the link click happens
Solved! Go to Solution.
Views
Replies
Total Likes
Thanks for the reply. Plain javascript code didnt work.
Below one worked.
$(event.target).parent().find(".content-block-heading").text()
i also read https://jimalytics.com/tag-management/adobe-launch-data-elements-guide/#Custom_Code
$(this) - wont work in launch, so we have to use the utilities.. Could anyone point me to the doc where the utilities are mentioned? Thanks
It looks like jQuery is missing. But you can do this via regular javascript
this.parentElement.querySelector(".content-block-heading").innerText
Thanks for the reply. Plain javascript code didnt work.
Below one worked.
$(event.target).parent().find(".content-block-heading").text()
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies