Webtrends Analytics 实施 - 使用异步跟踪调用/传递变量中的变量作为值

发布于 2024-11-08 23:04:21 字数 630 浏览 0 评论 0原文

这里有人有实施 Webtrends 的经验吗?根据他们的文档,他们的异步事件跟踪调用是通过将键值字符串对发送到他们的跟踪方法中来进行的,如下所示:

dcsMultiTrack('DCS.dcsuri', 'page.html', 'WT.ti', 'NameOfPage');

但是,该模型不太适合支持动态数据。我想做的是这样的,这样我就可以根据我捕获的用户交互动态创建键值对:

var wtString = "'DCS.dcsuri', 'page.html', 'WT.ti', 'NameOfPage'";
dcsMultiTrack(wtString); 

但是,在我的概念证明中,这不起作用。实际的 webtrends JS 会破坏数据并且不会进行调用。 (筛选他们的代码,在将参数分配给 Webtrends 对象时,看起来好像有些东西中断了。无论如何,我无法编辑他们的代码,因为那样他们就不会支持它,所以我停止调查这件事。

)问题是,如何将 JS 变量作为其值传递?我做了很多搜索并尝试了一些我认为既有效又无效的方法:String()、.toString()、.value()、闭包,甚至是可怕的 eval(),但都无济于事。

任何帮助将不胜感激。我对此一筹莫展。

Does anyone here have experience doing a Webtrends implementation? According to their documentation, their asynchronous event tracking call is made by sending key-value string pairs into their tracking method, like this:

dcsMultiTrack('DCS.dcsuri', 'page.html', 'WT.ti', 'NameOfPage');

However, that model does not lend well to supporting dynamic data. What I would like to do is something like this, so that I can dynamically create the key-value pairs based on the user interaction I am capturing:

var wtString = "'DCS.dcsuri', 'page.html', 'WT.ti', 'NameOfPage'";
dcsMultiTrack(wtString); 

In my proof of concept, though, that does not work. The actual webtrends JS mangles the data and the call is not made. (Sifting through their code, it looks like something breaks when assigning the arguments to the Webtrends object. Anyway, I can't edit their code because then they won't support it, so I stopped investigating that end of things.)

So the question is, how can I pass the JS variable as its value? I've done a lot of searching and tried things that I thought would both work and not work: String(), .toString(), .value(), closures, and even the dreaded eval(), but to no avail.

Any help would be MUCH appreciated. I'm at my wits end with this one.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

洋洋洒洒 2024-11-15 23:04:21

它看起来像 JavaScript 的 apply 函数可以在这里提供帮助:

var wtArguments = ['DCS.dcsuri', 'page.html', 'WT.ti', 'NameOfPage'];
dcsMultiTrack.apply(this, wtArguments);

这实际上与调用相同:

dcsMultiTrack('DCS.dcsuri', 'page.html', 'WT.ti', 'NameOfPage');

It looks like JavaScript's apply function could help here:

var wtArguments = ['DCS.dcsuri', 'page.html', 'WT.ti', 'NameOfPage'];
dcsMultiTrack.apply(this, wtArguments);

This is effectively the same as calling:

dcsMultiTrack('DCS.dcsuri', 'page.html', 'WT.ti', 'NameOfPage');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文