Consumers normally send tracking requests to the Intelligence tracking server. The options to do this are:

  • HTTP_CLIENT: Saves tracking requests in memory and sends them to the server using the same process as the library.
  • FORK_CURL: Saves tracking requests in memory and sends them in a separate, forked process to the server​.
  • FILE: Best for high traffic websites. Requests are saved in a separate file and sent via a cronjob to the tracking server in a specified interval.
  • CUSTOM: Create your own consumer to send the tracking requests.

The HTTP_CLIENT consumer is best for low-traffic websites or when using the library only to track specific pages. It ensures a fast responses and processing time for the track requests. For higher traffic websites (more than 20 requests per second), it is better to use the FILE transfer consumer.

It's important to set the max batch size to 1 when using the HTTP_CLIENT consumer and sending browser requests via pixel to the tracking server directly. This will help avoid processing issues and false analyses in Intelligence


By default, the attempt timeout is set to 100 milliseconds, with a maximum batch size of 50 requests and a maximum queue size of 1000 requests.

const config = new MappIntelligenceConfig()
    .setTrackDomain("analytics01.wt-eu02.net")
    .setTrackId("111111111111111")
    .setConsumerType(MappIntelligenceConsumerType.HTTP_CLIENT)
    .setMaxAttempt(1)
    .setAttemptTimeout(100)
    .setMaxBatchSize(1)
	.setMaxQueueSize(1000)
    .setForceSSL(true);
JS

The FORK_CURL consumer works with the curl cli and uses a separate process to send them in batches to the tracking server. This can optimize balancing load distribution on the server. FORK_CURL is best to use on low-traffic websites with up to 20 requests per second.

It's important to set the max batch size to 1 when using the FORK_CURL consumer and sending browser requests via pixel to the track server directly, in order to avoid processing issues and false analyses in Intelligence


By default, the attempt timeout is set to 100 milliseconds, with a maximum batch size of 50 requests, and a maximum queue size of 1000 requests.

const config = new MappIntelligenceConfig()
    .setTrackDomain("analytics01.wt-eu02.net")
    .setTrackId("111111111111111")
    .setConsumerType(MappIntelligenceConsumerType.FORK_CURL)
    .setMaxAttempt(1)
    .setAttemptTimeout(100)
    .setMaxBatchSize(1)
	.setMaxQueueSize(1000)
    .setForceSSL(true);
JS

For high traffic websites, it's best to use a FILE transfer. This is because it helps to reduce the load and memory used by your server. Instead of saving the requests in your memory, it writes the requests in a file and saves it there before sending it in batches to the track server. This solution is also more reliable in data collection. If a request attempt failed, it will re-write the failed requests to the file instead of dumping them, which done when using HTTP_CLIENT.

We recommend using a cron job to send the requests to the server every few minutes and empty your file to keep it at a manageable size

const config = new MappIntelligenceConfig()
    .setTrackDomain("analytics01.wt-eu02.net")
    .setTrackId("111111111111111")
    .setConsumerType(MappIntelligenceConsumerType.FILE)
	.setFilePath("path/to/file")
	.setFilePrefix("MappIntelligenceRequests")
	.setMaxAttempt(1)
    .setAttemptTimeout(100)
    .setMaxBatchSize(50)
	.setMaxFileLines(5000)
	.setMaxFileDuration(30 * 60 * 1000)
	.setMaxFileSize(12 * 1024 * 1024);
JS

CUSTOM consumers can be used to create your own consumer in order to send the tracking requests. For more information about CUSTOM consumers, see Interfaces.

class TestCustomConsumer implements IMappIntelligenceConsumer {
	public static final String CUSTOM = "CUSTOM";

	public sendBatch(batchContent: Array<string>): Promise<boolean> {
		return new Promise(async function(resolve) {
			// implement custom consumer logic

			resolve(true);
		});
	}
}

const mappIntelligenceConfig = new MappIntelligenceConfig()
	.setTrackDomain("analytics01.wt-eu02.net")
    .setTrackId("111111111111111")
	.setConsumerType(MappIntelligenceConsumerType.CUSTOM)
	.setConsumer(new TestCustomConsumer());
JS

Please check Configuration to see all configuration options and explanations of the Mapp Intelligence Node.js library, including default settings.