-
Notifications
You must be signed in to change notification settings - Fork 0
TrackIt Plugin CSS Selector
hikirsch edited this page Sep 14, 2010
·
2 revisions
This plugin is available as part of the minified package and can be referenced by adding TrackItPlugins.CssSelector
to the TrackIt Options.
var options = { XmlUrl: "/Assets/xml/trackItData.xml", Plugins: [ $.TrackItPlugins.CssSelector ], Data: { "Track a Link Somewhere": { cssSelector: "a.someClassName", type: "click" eVar1: "i tracked a link with a new plugin!" } } };
The CssSelector Plugin allows you to fire a trackEvent based on a css selector against any element in the DOM. This utilizes jQuery live’s click event. This makes it very simple to fire track events based on certain elements that may exist in the site.
This plugin extends the TrackIt Data by adding a new cssSelector attribute on a trackEvent. This looks like the following:
<trackEvents> <trackEvent key=“Some Track Key Name” event=“click" cssSelector=“a.mySelector”> <eVar1>This would be a sample eVar1</eVar1> </trackEvent> </trackEvents>