Adobe Launch - how to capture link URL on a click action? | Community
Skip to main content
Level 2
April 24, 2024
Solved

Adobe Launch - how to capture link URL on a click action?

  • April 24, 2024
  • 3 replies
  • 5348 views

Dear community,

 

I'm rather new to Adobe Launch and therefore, probably an obvious question:

 

  • I need to track some links in a custom way in Adobe Analytics via Adobe Launch.
  • I have a rule that triggers s.tl() tracking call with custom link with a specific value
  • I see in AA debugger that the link URL is sent in the call (see picture) but I can't retrieve this in AA reporting (not part of standard variables?)
  • Therefore I would like to capture the target URL (href value) of the clicked links in custom variable 
  • How can I do this? How to create a data element that returns the value for link HREF when clicked? Custom code?

I've been working for years with GTM and there it is pretty straightforward - these are built-in variables (link text, link href,...) without any coding.

Any help would be welcome 🙂

 

Thanks.

 

Note: I have found this article: https://experienceleaguecommunities.adobe.com/t5/dynamic-tag-management-questions/how-to-track-the-click-url-through-data-element-and-pass-to/m-p/280998 but it looks outdated (old DTM interface)

 

Best answer by pradnya_balvir

Go to Your Web Property

Create a Rule

Add event type Click 

Add specific element, add CSS selector value for that link (example for anchor a)

Define your variable eVar/prop for URL

example eVar1 is for URL

In set variable eVar1 = %this.href%

If needed I can share screenshots for more clarification.

 

3 replies

Adobe Employee
April 24, 2024

Hi @michaelnotte if you use Custom Code in the Action of the Rule, you can access two variables:

- event: that is the JS object of the event triggered. "event.target" is the DOM object where you clicked and from there you can retrieve the URL

- this: is the DOM object you clicked (like the event.target) and from there you can retrieve the URL from the href.

 

Hope this helps.

 

 

Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
April 24, 2024

To back this up, I do myself use custom code "this.href" to pass the url of the clicked element into my parameters....

 

However, it may be possible to get this with a "DOM Attribute" Data Element?

 

 

 

I have not tested this, but if you use the same CSS Selector as you are using for your click, it might pick up the value, or it might grab the first matched element.

 

This is why I've always used the custom code method, because I am sure it's exactly what I need..... 

pradnya_balvir
Community Advisor
pradnya_balvirCommunity AdvisorAccepted solution
Community Advisor
April 25, 2024

Go to Your Web Property

Create a Rule

Add event type Click 

Add specific element, add CSS selector value for that link (example for anchor a)

Define your variable eVar/prop for URL

example eVar1 is for URL

In set variable eVar1 = %this.href%

If needed I can share screenshots for more clarification.

 

Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
April 25, 2024

I don't think that worked when Launch was first launched, but I can confirm this does work!

 

But if you need to do any manipulation or logic checks on the value, custom code is still needed. But it sounds like you are using a straight pass-through @michaelnotte so this should be sufficient for your needs.

Level 2
April 30, 2024

Hi,

Thank you all for the feedback. It worked! (of course it did, so simple once you know it ;-))

And the cheat sheet is very handy.

You made my day.

 

Regards,

Michael

pradnya_balvir
Community Advisor
Community Advisor
April 30, 2024

Thanks @michaelnotte for the update.