Expand my Community achievements bar.

SOLVED

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

Avatar

Level 2

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-c... but it looks outdated (old DTM interface)

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 4

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.

 

View solution in original post

8 Replies

Avatar

Employee

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.

 

 

Avatar

Community Advisor

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?

 

Jennifer_Dungan_0-1713976173190.png

 

 

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..... 

Avatar

Correct answer by
Level 4

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.

 

Avatar

Community Advisor

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.

Avatar

Level 4

@Jennifer_Dungan , @MichaelNotte 

 

maybe this cheat sheet helps (also backs what @prads wrote)

bk_work_0-1714415179611.png

 

A slightly different, more complex approach could be going to the "Adobe Analytics" extension > Configure > CONFIGURE TRACKER USING CUSTOM CODE > Open Editor

s.registerPreTrackCallback(function (requestUrl) {
    if (s.linkURL) {
        s.eVar1 = s.linkURL;
        s.linkTrackVars += ",eVar1";
    }
});

The same way, you can implement different behavior, based on the different link properties e.g., if you want to treat downloads differently, you can only listen to s.linkType === "d" and so forth.

s.linkName": "My custom link"
s.linkURL: "https://example.com"
s.linkType: "o"/"d"/"e"

 

Best regards

Björn

Avatar

Community Advisor

Thanks @bk_work 

 

I always use the custom code route myself, but usually because I want to do some clean up / manipulation / logic on top of the values.. but for a simple grab, this is definitely handy.

 

And in case anyone is wondering, most of the time I will let Activity Map handle my tracking needs, if I am creating custom click logic, it usually means I need to pair a specific link or usage with additional parameters, and I often need to check which variation the link is pointing to, so that I can add contextual information to the tracking (such as a button that will link to a feature directly vs link to our purchase a subscription page in order to actually access the feature... (I need to know the usage of the link in total, but split it to see the different behaviours - that is one such use in my experience)

Avatar

Level 2

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