Expand my Community achievements bar.

Data element click URL Really not possible?

Avatar

Level 1

Is there really no way for data elements to return click URL? I know you can return event.element.href and setvar in RULES but I want this done through data elements for many reasons I don't have to elaborate on. Why is something as BASIC as click variables not part of the launch core extension for data elements? 

2 Replies

Avatar

Community Advisor

In your rule where you have a Click event, you can use "this.href" to return the URL of the clicked link.

Within the context of a rule, "this" generally refers to the DOM element that caused the rule's event to get triggered. However, note that this depends on the extension developer having configured the event to return the DOM element in "this". It's kinda confusing, but in general, you can use "this" with any event to refer to the DOM element that triggered the event.

Avatar

Level 5

The reason why click variables are not part of the core extension for data elements in Adobe Launch is likely due to the fact that there are multiple ways to track and capture click information in web analytics. Some users may prefer to use custom code or other methods to track click information, while others may prefer to use data elements.

However, it is possible to create a custom data element that captures click information, including the click URL. Here's an example of how to create a custom data element for click URL:

Navigate to the "Data Elements" section of Adobe Launch and click "Add Data Element".

In the "Data Element Name" field, give the data element a descriptive name, such as "Click URL".

In the "Data Element Type" field, select "Custom Code".

In the "Code" field, enter the following JavaScript code:

function() {
return _satellite.getVar("clickURL");
}

Save the data element.

In your rule, set the value of the "clickURL" data element to the appropriate click URL using custom code, such as:

_satellite.setVar("clickURL", event.element.href);
Note that this is just one example of how to create a custom data element for click URL, and there may be other approaches that work better for your specific use case.