v0.9
Mapping templates for Omniture / SiteCatalyst
A mapping template system for Omniture custom link and form tracking.
scMap uses data attributes to associate elements with a object literal map. Map items can be shared for common tracking tasks that use the same properties. Wildcards ( {attribute} ) can be used to place unique values in the tracking instance.
<button data-sc-item="tracked-item" title="Sample Tracked Item">...</button>
<form action="#" data-sc-item="tracked-form">
<label>Name <input type="text" name="name" required="required"></label>
<label>Email <input type="email" name="email" required="required"></label>
<button type="submit">SUBMIT</button>
</form>
- init: attach tracking events to elements with "data-sc-item" attribute with map key as value.
- attachLinkEvents: Adds tracking to custom link.
- attachFormEvents: Adds tracking to form submissions. Form element values can be used as wildcards.
- replaceWildCards: Replaces wildcards in map with attribute values or form values.
Optional
- data-sc-event: user event (default is 'click')
<button data-sc-event="mouseover" data-sc-item="tracked-item" title="Sample Tracked Item">...</button>
- data-sc-url: url to track if not a link (default is event target)
<button data-sc-url="somewhere.html" data-sc-item="tracked-item" title="Sample Tracked Item">...</button>
- init argument: use init(element) to scope DOM elements i.e. an ajax response (default is 'body')
siteCatalyst.init($('ajax-response-wrapper'));
scMap = {
/*
* Any property in "s" can be added through the map.
* Wildcards that are escaped with { } will be replaced
* with the elements matching attribute.
*/
'tracked-item' : {
'linkTrackName':'Button-{title}',
'linkTrackVars':'products,events,eVar9',
'linkTrackEvents':'event9',
'type':'o',
'products':'product',
'eVar9': 'Just a button',
'events':'event9'
}
Check the demo page.
http://blogs.omniture.com/2009/03/12/custom-link-tracking-capturing-user-actions/
Sasha Sklar, Shiva Vannavada