数据元素点击 URL 在 Adobe Launch 中真的不可能吗?

huangapple go评论58阅读模式
英文:

Data element click URL Really not possible in Adobe Launch?

问题

数据元素真的不能返回点击URL吗?我知道你可以返回event.element.href并在规则中使用setvar,但出于许多我不必详细说明的原因,我想通过数据元素完成这个操作。为什么像点击变量这样基本的东西不包含在数据元素的核心扩展中呢?

数据元素不会返回点击URL。以下是我尝试过的一个迭代,但我已经尝试了各种方法来在数据元素中返回点击URL,但都不起作用。它会打印到控制台,但实际的数据元素值仍然未定义。

jQuery(document).ready(function(){
   jQuery('a').click(function(){
     let clickHref = $(this).attr('href');
     console.log('点击URL =>', clickHref);
     return clickHref;
   });
})
英文:

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?

Data element won't return click url. Below is one iteration I used but I've tried all kinds of ways to return click URL in a data element and none of them work. It prints to the console but the actual data element value remains undefined

jQuery(document).ready(function(){
   jQuery('a').click(function(){
     let clickHref = $(this).attr('href');
     console.log('Click URL =>', clickHref);
     return clickHref;
   });
})

答案1

得分: 1

抱歉,以下是您要求的代码部分的中文翻译:

"Launch非常慷慨地始终提供触发规则的上下文,每个规则都可以访问thiseventevent将包含this,但this是一个方便的快捷方式,当触发为点击时,它会立即为您提供所点击的元素。使用this的方式通常与GTM中的{{Click Element}}一样。

您可以将this作为数据元素使用。这在您想要在UI中放置点击元素的一部分而不是代码时非常有用。为此,您需要在同一规则中像这样设置您的数据元素:

_satellite.setVar("tempVarAttrZ", this.getAttribute("z"));

之后,此规则的每个操作都可以从UI中访问%tempVarAttrZ%。getVar也可以正常工作。

请始终为临时数据元素添加标记,以避免意外使用它们。还要记住,如果数据元素是通过Launch UI创建的,因此出现在数据元素列表中,那么您的setVar将无效,只需选择一个未使用的名称进行设置。

最后,您经常需要在第一个操作中设置它,添加一个操作仅用于设置临时变量有点过多。这没关系,我偶尔会通过规则的JS条件来执行它。这很方便,因为条件总是在操作之前执行,而且它们不允许异步操作。

对于迟来的回复,非常抱歉。这是一个很好的问题,我只是之前没有看到它在这里。"

英文:

In short, you can't because DEs don't have the context of the trigger or the event object. Another thing that doesn't have it is s code and doplugins.

Launch is gracious enough to always give you the context of what triggered the rule in other places, however. Every rule has access to this and event. event will contain this, but this is a useful shortcut and it will give you the clicked element right away when the trigger is click. this does depend on the trigger. You would typically use this exactly how you use the {{Click Element}} in GTM.

You can definitely still use this as a Data Element. It's useful when you want to put pieces of the clicked element in your UI rather than code. For this, you will have to set your DEs right here, in the same rule like so:

_satellite.setVar("tempVarAttrZ", this.getAttribute("z"));

After this, every action of this rule will have access to %tempVarAttrZ% from the UI. The getVar will work too:

数据元素点击 URL 在 Adobe Launch 中真的不可能吗?

Always have something marking temporary DEs to avoid using them unintendedly. Also keep in mind that if the DE is created through the Launch UI, so it pops up in the list of DEs, your setVar won't work, just pick an unused name for setting it like this.

Finally, you often need it to be set in the first action and adding an action just to set the temporary variable is a bit too much. That's fine. I occasionally would do it through the JS conditions of the rule. It's comfy since conditions always execute before actions. And they don't allow asyncness.

Sorry for the late reply. It's a good question, I just didn't see it here before.

huangapple
  • 本文由 发表于 2023年2月19日 09:07:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/75497386.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定