Webtrends Analytics 实施 - 使用异步跟踪调用/传递变量中的变量作为值
这里有人有实施 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它看起来像 JavaScript 的
apply
函数可以在这里提供帮助:这实际上与调用相同:
It looks like JavaScript's
apply
function could help here:This is effectively the same as calling: