Collecting data with Trackers and Webhooks

  1. Home
  2. Docs
  3. Collecting data with Trackers and Webhooks
  4. Trackers – collecting data from your own applications
  5. Javascript Tracker
  6. Tracker Setup
  7. Managing multiple trackers

Managing multiple trackers

You have more than one tracker instance running on the same page at once. This may be useful if you want to log events to different collectors. By default, any Snowplow method you call will be executed by every tracker you have created so far:

snowplow("newTracker", "cf1", "", { appId: "cfe23a", platform: "mob" }); snowplow("newTracker", "cf2", "", { appId: "cfe23a", platform: "mob" }); // Both trackers will use this custom title snowplow('setCustomUrl', ''); // Both trackers will fire a structured event snowplow('trackStructEvent', 'Mixes', 'Play', 'MrC/fabric-0503-mix', '', '0.0'); // Only the first tracker will fire this structured event snowplow('trackStructEvent:cf1', 'Mixes', 'Play', 'MrC/fabric-0503-mix', '', '0.0'); // Only the second tracker will fire this self-describing event snowplow('trackSelfDescribingEvent:cf2', 'com.acme_company' 'Viewed Product', { product_id: 'ASO01043', category: 'Dresses', brand: 'ACME', returning: true, price: 49.95, sizes: ['xs', 's', 'l', 'xl', 'xxl'], available_since$dt: new Date(2013,3,7) } ); // Both trackers will fire a page view event snowplow('trackPageView:cf1;cf2');

You can override this behaviour and specify which trackers will execute a Snowplow method. To do this, change the method name by adding a colon followed by a list of tracker names separated by semicolons: