I have a function that tracks custom events. I would like to set s.channel in the function, but so far no success. It seems that s.channel is set through onload only? Is it possible to capture s.channel in the onClick function?
Here is my sample code.
function customLinks() {
s.channel='CHANNEL VALUE'; //<=== this is not working
s.events = 'events27';
s.linkTrackVars = 'events, event27';
s.linkTrackEvents = 'event27';
s.tl(this.'o','Custom Link Click');
}
s.tl
call, you need to declare them in linkTrackVars
and linkTrackEvents
. The only exception is pageName
, which will get tracked whether or not you declare it. linkTrackEvents
is a comma delimited list of any events you want to track (note: you should not have spaces between the commas). linkTrackVars
is a comma delimited list of variables you want to track. For example, you can see in your own code how you are tracking event27
. Note that for events, you must declare events
in linkTrackVars
(which you did). s.events
you have "events27"
when it should be
"event27"
(no "s"
).s.tl
call pass this, 'o'
event27
in linkTrackVars
, only linkTrackEvents
So overall, this is what your function should look like:
function customLinks() {
s.channel='CHANNEL VALUE'; //<=== this is not working
s.events = 'event27';
s.linkTrackVars = 'events,channel';
s.linkTrackEvents = 'event27';
s.tl(this,'o','Custom Link Click');
}