0

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');    
}
user2326737
  • 211
  • 1
  • 4
  • 16

2 Answers2

2
  • In order to track a variable/event in an 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).
  • In your s.events you have "events27" when it should be "event27" (no "s").
  • Also, in your s.tl call pass this, 'o'
  • You don't need to put 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');    
}
Rodrigo Medeiros
  • 7,814
  • 4
  • 43
  • 54
CrayonViolent
  • 32,111
  • 5
  • 56
  • 79
  • Directly from [SiteCate Implementation docs](https://microsite.omniture.com/t2/help/en_US/sc/implement/index.html#Setting_Additional_Variables_for_File_Downloads_Exit_Links_and___Custom_Links) Note: The variable pageName cannot be set for a file download, exit link, or custom link, because each of the link types is not a page view and does not have an associated page name. – BrettAHale Dec 10 '13 at 05:24
  • @BrettAHale well the docs are wrong. Or at least, not entirely accurate. The last known `pageName` value *does* get sent along with an `s.tl` call, to associate the data to the page. And I *have* set it to a different value. The only thing that does *not* happen is a new page view does not get counted. Over the years I have come to discover a lot of misleading, undocumented, or outright wrong things in the docs. Don't trust the docs. Trust what you see popping in a sniffer and what actually shows up in reports. – CrayonViolent Dec 10 '13 at 15:28
-1

That won't be tracked using s.tl, I copy s.channel to an ever to work around that. Or, use a prop if you need pathing.

BrettAHale
  • 791
  • 1
  • 5
  • 13
  • `s.channel` can be tracked in an `s.tl` call; he just needs to declare it in `s.linkTrackVars`. And he would have the same problem with an `eVar` or `prop`. – CrayonViolent Dec 10 '13 at 01:24
  • s.pageName will not be tracked using s.tl as it's not a page view. I'm 90% sure s.channel works the same. If you're trying to correlate custom link events with a site section, you can copy it to a prop at which point you can run the correlation report. – BrettAHale Dec 10 '13 at 05:29