Skip to content

TrackIt Instance Examples

sdasilva edited this page Sep 14, 2010 · 5 revisions

Essentially, the most basic example defines no track specific data but only a tracker.

// this is pretty pointless since it won't really do anything 
// but it will give you a real trackit object back.

var myTracker = new $.TrackIt("omniture");

You’ll most likey want to attach some sort of data to your instance. Here’s an example grabbing an XML file:

var options = {
    XmlUrl: "/Assets/xml/trackItData.xml"
};
var myTracker = new $.TrackIt("omniture", options);

You may not have that many kinds of events, so you may want to just declare it inline.

var options = {
    XmlUrl: "/Assets/xml/trackItData.xml",
    Plugins: [ 
        $.TrackItPlugins.CheckUrlMapping 
    ],
     Data: { 
        "Homepage Load": {
             urlMap: "/|/index.html",
             type: "pageView"
             pageName: "Homepage"
        }
    }
};
var myTracker = new $.TrackIt("omniture", options);

TrackIt supports a very thorough debugging mode that can be turned on by setting the “ShowDebugInfo” option to true.

var options = {
    XmlUrl: "/Assets/xml/trackItData.xml",
    Settings: { ShowDebugInfo: true }
};
var myTracker = new $.TrackIt("omniture", options);

And now utilizing all of the options and features currently supported.

var options= {
    Settings: {
        TestMode: true,
        ShowMissingHolderWarnings: true,
        ShowDebugInfo: true,
        SanityCheckEnabled: true,
        SanityCheckMissingOnly: true
    }
}
var myTracker = new $.TrackIt("omniture", options);