views:

315

answers:

1

Hi, i have a page with a list of items. Each item has a print now link (a.printMe) to print each item. At the end of the list, there's a print all link (a.printAll) to print all items.

I want to track number of times an item was printed. If a.printAll link is clicked, then i will send all the item's tracking value to Omniture. I added tracking string into individual item's a.printMe href attribute and track with the following functions:

$('a.printMe').click(function() {
   var value = $(this).attr('href');
   track(value);
});

$('a.printAll').click(function() {
   $('a.printMe').each(function() {
      this.click();
   }); // works in IE only. IE 6-8
}); 

function track(value) {
   var s = s_gi('account');
   s.prop10 = value;
   s.linkTrackVars = 'prop10';
   s.tl(true, 'o');
}

In IE 6-8, all the values are posting fine when i clicked on a.printAll. I understand that in Firefox, click event is only for input elements. So i implemented the below:

$('a.printMe').each(function() {
   var trackingCode = $(this).attr('href').replace('#','');
   track(trackingCode);
});

But only the last item's value is sent to Omniture. Has anyone implemented something like this and work?

A: 

FIXED: s.tl(true, 'o'); should include value as the last param.

So end result should be s.tl(true, 'o', value);

ilovewebdev
hmm... 3rd argument of s.tl() is an optional argument, to give the "link" a friendly name for reporting purposes. I doubt that adding that in there really fixed your problem..what else did you do?
Crayon Violent
Hi Crayon, that's all i did. Basically the values are printing in the firebug console. But its just that the network activity shows that only the last value is being sent. Adding the value as the last param works for me ;)
ilovewebdev