mab.js Specifications

Resources requested by mab.js and its effect on page load time.

Resources requested by chartbeat_mab.js

chartbeat_mab.js requests the testing “strategy” for the page the visitor is on. The strategy contains the specs of the tests that are currently active — where the tests are (which article links), what the variant headlines are, and what the current play percentages are for each variant. chartbeat_mab.js will request the strategy via asynchronous ​XMLHttpRequest as soon as it loads. The strategy itself is not user cacheable, because the play percentages for each variant in each test are frequently changing as we receive data and converge on a winner for each test.

We host our strategy files on the fastly CDN (click here for details on edge locations), and we actively push new changes to the strategy files on the CDN as tests update, so user requests should effectively never have a cache miss at the CDN edge. The size of the strategy depends on how many tests are running on the page, and the details of those tests — when no tests are running the strategy is about 150 bytes; each test will add about 500-1000 bytes.

The strategy file is requested from a URL with the following structure:

https://mab.chartbeat.com/mab_strategy/headline_testing/get_strategy/?host=example.com&domain=example.com&path=%2F

For each test that is described in the strategy, there will be a single ping request (technically, a GET request for a 1x1 gif image) that is sent to our servers to indicate that the test was found (or not) and which variant was picked. These requests are not sent to our servers until the main ​chartbeat.js script loads and runs.

Effect on page load time

We work to ensure the file is as small as possible but also fully self-contained without any additional dependencies. It is currently about 13Kb. It is served through our CDN network and is sent as a gzipped file. This ensures that the customer download time is as speedy as possible by reducing network latency and overhead.

We generally have a cache-header of between 2 to 24 hours on the response. We keep this low enough so that we can push out changes without having to do any complicated cache-busting when we need to make a scheduled change, but high enough so that most users would not be downloading the file more than once per visit to your site. As well, since all customers across the entire Chartbeat network access the same version of that file, it is quite possible that your website users will already have a cached version of the file.

Image Testing specs

Image Storage and Requests

Test images are stored on the fastly CDN, which is optimized to cache and serve test images in a low latency configuration (click here for details on edge locations).

Image Testing flicker control code size

Our flicker control code is about 1.7Kb; however, because it is directly inserted into your page's HTML, it will not result in another network request. There is close to zero impact to page load time.

Next steps

Review our integration QA instructions article for best practice advice to test your integration.

Last updated