-
Notifications
You must be signed in to change notification settings - Fork 0
TrackIt Holders Create Custom Holders
Another useful feature with holders is the ability to create your own custom holder. This allows you to take the value of the variable you are tracking a step further. This might be necessary depending on the tracking needs. Below is an example on how to pull in an XML file and define a custom Holder.
// using an external XML file var myTracker = new $TrackIt(‘omniture’, { XmlFile: ‘/path/to/file.xml’ GlobalHolders: { 'MyStaticHolder': 'some string', ‘MyDynamicHolder’: function() { return “a custom static string”; } } });
The above example will retrieve the XML file ‘/path/to/file.xml’ and defines two custom holders called MyStaticHolder and MyDynamicHolder. That means that for any variable within a trackEvent that has a value “[MyDynamicHolder]”, it will get replaced with “a custom static string”. The same would go for ‘MyStaticHolder’ as it would always get the ‘some string’ value.
These custom holders are a core feature within TrackIt. Typical usage would be to create a function that would return some sort of dynamic aspect of the page, whether it’s a HTML snippet or some sort of value derived from something on the page.