The Acoustic Analytics Developer Hub

Welcome to the Acoustic Analytics developer hub. You'll find comprehensive guides and documentation to help you start working with Acoustic Analytics as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Implementing the Tealeaf Web Worker script

Improve performance by implementing the optional Tealeaf Web Worker script.

Overview

Skill Level: Advanced

Prerequisites

The Experience Analytics (Tealeaf) Web Worker script relies on the fetch API for network communication. The Experience Analytics (Tealeaf) Web Worker script does not function on browsers that do not support fetch. Thus, the initialization of the Experience Analytics (Tealeaf) Web Worker in the UIC queue configuration is conditional on the availability of the fetch API.

Introduction

Modern browsers allow the creation of background tasks within the context of a web application. This technology is referred to as web workers. With UIC 5.6.0 (and above), applications can use the optional Experience Analytics (Tealeaf) Web Worker script to offload the JSON serialization, gzip encoding, and network communication tasks. Some processing that would otherwise occur in the main application thread is moved into a parallel worker thread, which results in a performance boost. The performance improvement varies depending on the application. In general, applications that have large DOM sizes and make heavy use of the CPU are more likely to experience performance improvements when using the Experience Analytics (Tealeaf) Web Worker script.

Deploy the Experience Analytics (Tealeaf) Web Worker script

To deploy the Experience Analytics (Tealeaf) Web Worker in your application, follow these steps:

Step-by-step

  1. Copy the Tealeaf Web Worker script from the UIC release bundle into your working directory.
    The Experience Analytics (Tealeaf) Web Worker script (tltWorker.js) is included in the UIC release bundle in the Worker folder.
  2. Open the Tealeaf Web Worker script in a text editor and copy the pako gzip encoder script into the beginning of the file.
  3. Save the Tealeaf Web Worker script to a web server directory in the same domain that hosts the application.
    It is recommended that you add the tltWorker.js script to the same folder and path used for other site-specific JavaScript, but it is not required.
    NOTE: The Experience Analytics (Tealeaf) Web Worker script cannot be combined with the UIC or any other script.
  4. Verify the Tealeaf Web Worker script is accessible in a browser by using the URL.
  5. Initialize the deployed Tealeaf Web Worker script.
    To inialize the deployed Experience Analytics (Tealeaf) Web Worker script, add the tltWorker property to the UIC queue configuration and replace /js/tltWorker.js with the actual URL or path of the Experience Analytics (Tealeaf) Web Worker script as tested in step 4.
    Note: As part of our ongoing transformation, Acoustic has updated the branding in our product URLs, including the Tealeaf collector URL. To access and integrate with Tealeaf, make sure that you replace your old collector URL with this new URL, lib-us-2.brilliantcollector.com. For details, see https://acoustic.com/standardized-acoustic-urls/.
queue: {
	// WARNING: Enabling asynchronous request on unload may result in incomplete or missing data
	asyncReqOnUnload: false,
	useBeacon: true,
	xhrLogging: true,
	tltWorker: window.fetch && window.Worker ? new Worker("/js/tltWorker.js") : null,
	queues: [{
			qid: "DEFAULT",
			
			"endpoint": "//lib-us-2.brilliantcollector.com",
			maxEvents: 50,
			timerInterval: 300000,
			maxSize: 250000,
			checkEndpoint: true,
			endpointCheckTimeout: 5000
		}
	]
},

Expected outcome

The Experience Analytics (Tealeaf) Web Worker is deployed in your application.

Updated 26 days ago


Implementing the Tealeaf Web Worker script


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.