Can't seem to clear the s.events when I have a s.tl() call. how can I clear s.events out?

北战南征 提交于 2019-12-24 15:08:08

问题


Omniture Tracking Question:

I have a module on my page that loads some third party information. When that module loads I call a "s.tl()" call. Unfortunetly, if I have clicked previuosly on a link or somesuch in the site then the s.events has a value in it.

So, when the module loads... that 's.events' value gets sticky and then is passed when I call s.tl() when the module is loaded. Thus, dbl counted clicks and such. I NEED for that s.events to be empty when that module loads and I call the s.tl(). how?

I tried just normal js assignments. ala s.events = "", I tried clearVars() plugin method, no go.. nothing seems to work.

Any help?


回答1:


You can try s.events.length = 0; to reset it back to empty.




回答2:


Normally clearing the variables out is not necessary, as you define the proper variables you wish to track before submitting a link tracking image request. All variables are reset after each page load.

If you want to clear the events variable out, you can simply use:

s.events=null;

Either that or define the events variable with different events prior to calling your next image request.




回答3:


It sounds like you might need to wrap your s.tl() call in a function. Here's an example of how I've implemented my s.tl() calls. Hopefully this helps you. :)

function trackOmniEvent(eventString, eventLabel) {
    /* uses global namespace s */
    // set vars
    s.linkTrackVars="eVar58,events";
    s.linkTrackEvent="event20";
    s.events="event20";
    s.eVar58=eventString;
    // run tracker
    s.tl(this,'o',eventLabel);
    // reset vars
    s.linkTrackVars="None";
    s.linkTrackEvent="None";
    s.eVar58="";
    s.events="";
}



回答4:


You should always set s.linkTrackEvents and s.linkTrackVars whenever you make an s.tl() call. So in your case you will be doing something like this:

s.linkTrackVars = "prop25,eVar25";
s.linkTrackEvents = "none";
s.prop25 = 'someValue';
s.eVar25 = 'someValue';
s.tl(true, 'o', 'linkName');

This will reset any predefined events when making s.tl() calls.

Example when you have an event:

s.linkTrackVars = "prop25,eVar25,events";
s.linkTrackEvents = "event25";
s.prop25 = 'someValue';
s.eVar25 = 'someValue';
s.event25 = 'someEventValue';
s.tl(true, 'o', 'linkName');


来源:https://stackoverflow.com/questions/9204429/cant-seem-to-clear-the-s-events-when-i-have-a-s-tl-call-how-can-i-clear-s-ev

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!