Expand my Community achievements bar.

Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!
SOLVED

Putting tracked link name and url into eVars

Avatar

Level 2

I am building Launch Data Elements and a rule to capture modal-window opens on one of my sites.

I have a event to register the click that opens the modal, and in the Adobe Experience Cloud debugger I see the event, the link_o Link Type, and correct data in the Link Name and Link URL fields.

I'd also like to put the Name and URL into eVars.

I created the eVars in the Report Suite admin, and Data Elements in Launch. 

For Link URL, for instance, I have this custom code in the data element:

return(s.linkURL);

and for Link Text (alot of html is coming in there between the <a> and </a>), so I'm trying

return(s.linkName.textContent);

And I use those elements to populate the eVars in the event Rule

However, I don't see this data in the debugger or in Reporting.

I should note that the links are selected based on a class ( there are many on the page) but Link Text and Link URL does populate correctly.

How can I transfer that data to two eVars? Thanks very much.

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Does the AA "s" object have those linkUrl and linkName properties? I don't recall seeing them before.

Fortunately, you're using Adobe Launch, so there are some "shortcuts" that you can use.

First, grab the Launch cheat sheet, if you haven't already: https://jimalytics.com/wp-content/uploads/2017/11/Adobe-Launch-Cheat-Sheet.pdf

When you use a Click event, Launch provides a "this" object that is the DOM element of the clicked element. So, you can use these to set your eVars:

eVarxx: %this.@cleanText% <-- to set link text eVar

eVaryy: %this.href% <-- to set link URL eVar

No complicated custom code needed!

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Does the AA "s" object have those linkUrl and linkName properties? I don't recall seeing them before.

Fortunately, you're using Adobe Launch, so there are some "shortcuts" that you can use.

First, grab the Launch cheat sheet, if you haven't already: https://jimalytics.com/wp-content/uploads/2017/11/Adobe-Launch-Cheat-Sheet.pdf

When you use a Click event, Launch provides a "this" object that is the DOM element of the clicked element. So, you can use these to set your eVars:

eVarxx: %this.@cleanText% <-- to set link text eVar

eVaryy: %this.href% <-- to set link URL eVar

No complicated custom code needed!

Avatar

Level 2

Thanks - this works great - I see the correct values in Debugger and in Reporting.

In fact, I don't even need to create Data Elements - I can just put your code in the Rule.

Checking out the Cheat Sheet as well. Thanks and Happy New Year!