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?