Understanding the Target JavaScript Libraries

Implement Target by referencing the Target libraries (at.js or mbox.js) on your web pages.

You can use either of two library references: at.js or mbox.js.

Note: The mbox.js library is no longer being developed. All customers should migrate from mbox.js to at.js. For more information, see Migrate to at.js from mbox.js.

This section contains the following information:

Differences Between the Two Libraries

The following table explains the differences between the two libraries:

Library Reference Description
at.js

at.js replaces mbox.js for Target implementations.

Among other benefits, at.js improves page-load times for web implementations, improves security, prevents document.write warnings in Google Chrome, and provides better implementation options for single-page applications.

For more information, see at.js Implementation.

mbox.js

Prior to Target 16.3.1 (March 2016), Target required a call to mbox.js to create the global mbox required for Adobe Target to deliver Target activities, track clicks, and track most success metrics. This file contains the libraries needed for all of your activities. You do not need to maintain different activity-specific versions of the file.

If you already have wrapping mboxes on your pages from an older style of Target implementation, these mboxes can still be used in the new interface. The updated mbox.js file is still required, but these mboxes can be selected for activities and edited using the Visual Experience Composer.

Target Standard and Premium update and supplement mbox.js with a reference to a target.js file. The target.js file is hosted by Adobe. The Target.js file makes it possible to edit content on any page using the Visual Experience Composer, even if the page does not contain predefined mboxes. You must reference this file on every page on your site.

Although at.js replaces mbox.js, mbox.js will continue to be supported.

For more information, see mbox.js Implementation.

Note: Target requires a minimum version of mbox.js. For more information, see Target Requirements.

Impact of at.js and mbox.js on Page-Load Time

Many customers and consultants want to know the impact of at.js and mbox.js on page-load time, especially in the context of new vs returning users. Unfortunately, it's hard to measure and give concrete numbers regarding how at.js or mbox.js influence page-load time due to each customer's implementation.

However, if the Visitor API is present on the page, we can better understand how at.js and mbox.js influence page-load time.

Note: The Visitor API and at.js or mbox.js have an impact on page-load time only when you are using the global mbox (because of the body-hiding technique). Regional mboxes are not impacted by Visitor API integration.

The following table describes the sequence of actions for new and returning visitors:

Library Reference Description

New Visitors

  1. The Visitor API is loaded, parsed, and executed.

  2. at.js / mbox.js is loaded, parsed, and executed.

  3. If global mbox auto-create is enabled, the Target JavaScript library:

    • Instantiates the Visitor object.

    • The Target library tries to retrieve Marketing Cloud Visitor ID data.

    • Because this is a new visitor, the Visitor API fires a cross-domain request to demdex.net.

    • After Marketing Cloud Visitor ID data is retrieved, a request to Target is fired.

Returning Visitors

  1. The Visitor API is loaded, parsed, and executed.

  2. at.js / mbox.js is loaded, parsed, and executed.

  3. If global mbox auto-create is enabled, the Target JavaScript library:

    • Instantiates the Visitor object.

    • The Target library tries to retrieve Marketing Cloud Visitor ID data.

    • The Visitor API retrieves data from cookies.

    • After Marketing Cloud Visitor ID data is retrieved, a request to Target is fired.

For new visitors, when the Visitor API is present, Target has to go over the wire multiple times to make sure that Target requests contain Marketing Cloud Visitor ID data. For returning visitors, Target goes over the wire only to Target to retrieve the personalized content.