Expand my Community achievements bar.

SOLVED

Custom links populating evars defined for any rule with 'Unspecified'

Avatar

Level 2

Hi all

This is slightly difficult to explain but I will try my best.

I noticed in the current implementation I am working on that for events that are tracked as custom links, that whenever an evar has been defined for any of these rules, this populates for all custom links with Unspecified if not explicitly defined for that event/rule.  Just wanting to know if this behaviour is expected or if there is a change I could make to avoid this happening? I don't need suggestions of other ways to capture at this point, just if other users see this.  Using a very simple example:

I have 2 rule based events that are captured as a custom link, named time and day

During a journey:

the time rule populates evar1 with '11am'

the day rule populates evar 2 with 'Wednesday'

In AA, the data we get appears like the following is happening:

When the time rule fires, evar1 = 11am and evar2=Unspecified

When the day rule fires, evar1 = Unspecified and evar2=Wednesday

So it looks like both custom links are populating all variables, whether a value has been defined for the rule or not.  Does that make sense and is this something that is expected?

Thanks in advance for any help

1 Accepted Solution

Avatar

Correct answer by
Level 6

Dear John,

Try the below code

/* ******** Time - Time Parting ******** */

var hh = s.getTimeParting("h", SC_timezone);

hh = hh.split('|')[0];

var tt = s.getTimeParting("z", SC_timezone);

tt = tt.split('|')[1];

s.eVar1= hh+'|'+tt;

    /* ******** Time - Time Parting ******** */

  

Add this below section inPlugin

//getTimeParting version 3.4 Plugin

  1. s.getTimeParting=new Function("h","z",""

+"var s=this,od;od=new Date('1/1/2000');if(od.getDay()!=6||od.getMont"

+"h()!=0){return'Data Not Available';}else{var H,M,D,U,ds,de,tm,da=['"

+"Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturda"

+"y'],d=new Date();z=z?z:0;z=parseFloat(z);if(s._tpDST){var dso=s._tp"

+"DST[d.getFullYear()].split(/,/);ds=new Date(dso[0]+'/'+d.getFullYea"

+"r());de=new Date(dso[1]+'/'+d.getFullYear());if(h=='n'&&d>ds&&d<de)"

+"{z=z+1;}else if(h=='s'&&(d>de||d<ds)){z=z+1;}}d=d.getTime()+(d.getT"

+"imezoneOffset()*60000);d=new Date(d+(3600000*z));H=d.getHours();M=d"

+".getMinutes();M=(M<10)?'0'+M:M;D=d.getDay();U=' AM';if(H>=12){U=' P"

+"M';H=H-12;}if(H==0){H=12;}D=da[D];tm=H+':'+M+U;return(tm+'|'+D);}");

Regards,

Kumararaja K

View solution in original post

3 Replies

Avatar

Correct answer by
Level 6

Dear John,

Try the below code

/* ******** Time - Time Parting ******** */

var hh = s.getTimeParting("h", SC_timezone);

hh = hh.split('|')[0];

var tt = s.getTimeParting("z", SC_timezone);

tt = tt.split('|')[1];

s.eVar1= hh+'|'+tt;

    /* ******** Time - Time Parting ******** */

  

Add this below section inPlugin

//getTimeParting version 3.4 Plugin

  1. s.getTimeParting=new Function("h","z",""

+"var s=this,od;od=new Date('1/1/2000');if(od.getDay()!=6||od.getMont"

+"h()!=0){return'Data Not Available';}else{var H,M,D,U,ds,de,tm,da=['"

+"Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturda"

+"y'],d=new Date();z=z?z:0;z=parseFloat(z);if(s._tpDST){var dso=s._tp"

+"DST[d.getFullYear()].split(/,/);ds=new Date(dso[0]+'/'+d.getFullYea"

+"r());de=new Date(dso[1]+'/'+d.getFullYear());if(h=='n'&&d>ds&&d<de)"

+"{z=z+1;}else if(h=='s'&&(d>de||d<ds)){z=z+1;}}d=d.getTime()+(d.getT"

+"imezoneOffset()*60000);d=new Date(d+(3600000*z));H=d.getHours();M=d"

+".getMinutes();M=(M<10)?'0'+M:M;D=d.getDay();U=' AM';if(H>=12){U=' P"

+"M';H=H-12;}if(H==0){H=12;}D=da[D];tm=H+':'+M+U;return(tm+'|'+D);}");

Regards,

Kumararaja K

Avatar

Employee Advisor

Hi,

Not sure if I understood the scenario completely, but it looks like the issue might be related to the concept of linkTrackVars and linkTrackEvents in Analytics. By logic and design, if you are using custom code in a rule and if s.linkTrackVars isn't explicitly defined, all the variables that have values will be triggered with the custom link calls.

You may want to have a look at the doc for reference: Using s.linkTrackVars and s.linkTrackEvents

Thank you!

Avatar

Level 2

Hi kumararajak, thanks for the response, however, the day and time were only example rules, I did not need another way of tracking these.  I maybe should have called my examples something completely obscure so nothing was read into this.  Apologies for the confusion