的Adobe DTM数据元素更新 [英] Adobe DTM Data Element Updating

查看:200
本文介绍了的Adobe DTM数据元素更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一种方式来动态更新的DTM的pre定义数据元素。一旦页面加载和数据元素被初始化它来更新它们是不可能的,_sattelite.setVar()不工作。我可以动态创建一个数据元素,但它不会从网页坚持到page.Example:

I'm looking for a way to dynamically update a pre-defined data element in DTM. Once the page loads and the data elements are initialized it is not possible to update them, _sattelite.setVar() does not work. I can create a Data Element on the fly but it won't persist from page to page.Example:

var currElementName = this.getAttribute('data-analytics-tracking-name');
_satellite.setVar('custom link name', currElementName);

有什么建议?我问这个,因为我要与一个MVC框架的工作,我想存放一些DTM中的数据元素和更新数据的看法发生改变。谢谢!

Any suggestions? I'm asking this because I'm going to be working with a MVC framework and I'd like to store some of the data in DTM data elements and update as views change. Thanks!

推荐答案

在为持久性数据元素设置为一个新值,则需要任何来源的数据元素是基于关闭的第一次更新,然后用 _satellite.getVar('element_name_here')强制数据元素的评价。

In order to set a persistent data element to a new value, you need to first update whatever source the data element is based off of, and then use _satellite.getVar('element_name_here') to force evaluation of the data element.

这里的关键是,在页面加载的,对于持久性数据元素的操作顺序基本上是:

The key here is that on page load, the order of operations for a persistent data element is basically:

  1. 查找卫星Cookie,并返回一个值
  2. 查找指定目标为键入(如路径(JS VAR)对于键入 JS对象),并返回一个值
  3. 返回默认值
  1. Look for the satellite cookie and return that value
  2. Look for the specified target for the type (e.g. path (js var) for type JS Object) and return that value
  3. Return the default value

但是,当你的明确要求 _satellite.getVar('例'),操作顺序是相反:

But when you explicitly call _satellite.getVar('Example'), the order of operations is instead:

  1. 查找指定目标为键入(如路径(JS VAR)对于键入 JS对象),并返回一个值
  2. 查找卫星Cookie,并返回一个值
  3. 返回默认值
  1. Look for the specified target for the type (e.g. path (js var) for type JS Object) and return that value
  2. Look for the satellite cookie and return that value
  3. Return the default value

数据元素例如:

名称:示例

类型: JS对象

路径: someVariable

Path: someVariable

默认值:默认值

记住这个值:会话

所以我们可以说我有以下的(之前设定为DTM脚本标记)的网页上:

So let's say I have on the page the following (set prior to DTM script tag):

someVariable = 'foo';

这会使你可以用%示例% _satellite.getVar(样本)引用命名为榜样提供的数据元素,这取决于上下文。

This will make available a data element named "Example" which you can reference with %Example% or _satellite.getVar('Example'), depending on the context.

有关该会话的持续时间,该数据元素将有一个foo值。因此,要改变它,你会做以下内容:

For the duration of the session, the data element will have that value "foo". So to change it, you would do the following:

someVariable='bar';
_satellite.getVar('Example');

您可以拨打这个在自己的脚本中的某个地方,或者,如果你想抛出此进入混音如一个页面加载的规则,你可以将其添加为在标准&gt的条件;数据>自定义 code箱(注意:如果你把它放在这里,添加返回true; 作为第3行的)等。

You can call this within your own script somewhere, or if you want to throw this into the mix for e.g. a page load rule, you can add it as a condition inside a Criteria > Data > Custom code box (note: if you put it here, add a return true; as 3rd line), etc..

作为替代方案,如果你感觉更冒险,还是需要一个变通为您的数据元素的设置(例如,您的数据元素类型的自定义脚本,你需要回避的逻辑在那里)..

As an alternative, if you are feeling more adventurous, or need a work-around for your data element setup (e.g. your data element is type Custom Script and you need to sidestep the logic in there)..

当你配置是持久性的数据元素,它设置了一个名为cookie的

When you have a data element configured to be persistent, it sets a cookie named

_sdsat_ [数据元素名称]

因此​​,在上面的例子中,它设置一个名为饼干

So in the example above, it sets a cookie named

_sdsat_Example

所以,如果你的真正的想,你可以而不是只更新与新值的cookie,并且只让操作的默认顺序返回(现在更新)cookie的值。 (注:由于这是不可能的JavaScript得到一个cookie的有效期,如果你设置的范围,以游客,你可以设置期满2年,的这就是DTM做 的)

So, if you really wanted to, you can instead just update the cookie with the new value, and just let the default order of operations return the (now updated) cookie value. (note: since it's not possible with javascript to get the expiration of a cookie, if you are setting the scope to "Visitor", you can set the expiration to 2 years, which is what DTM does)

这篇关于的Adobe DTM数据元素更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆