AppMeasurement for JavaScript is a new version library that provides the same core functionality of old library H-Code s_code.js, but is lighter and faster for use on both mobile and desktop sites. It is light & fast enough to be used with mobile sites AND robust enough to be used on the full desktop web, allowing you to leverage a single JS file across all web measurement environments. There are also a number of powerful new capabilities in the new JS file:

While the new JS file will dramatically improve your efforts to unify web analytics deployments and increase the sophistication of your mobile implementations, there are two limitations you should be aware of:

The new JS file doesn’t support TagManager.

The new JS file doesn’t support all Consulting Plugins. A partial list of supported and non-supported plugins may be found here. If you’ll be migrating an existing implementation to the new JS file, you will need to remove or update any plugins that aren’t supported. Consulting is currently working to test and upgrade (where necessary) commonly used plugins, and the plugin support documentation above will be regularly updated with these changes.

Download

Adobe JavaScript code is zipped as AppMeasurement_JavaScript-1.5.2.zip (current version is 1.5.2) under Marketing Cloud Client Libraries from Adobe Marketing Cloud Code Manager. It contains below files, for now we are concerned only with AppMeasurement.js and VisitorAPI.js

1

2

3

4

5

6

7

8

9

// from codingRepo

AppMeasurement_Module_AudienceManagement.js

AppMeasurement_Module_Integrate.js

AppMeasurement_Module_Media.js

AppMeasurement.js

help.html

releasenotes.html

version

VisitorAPI.js

Configuration

Once you’ve downloaded the core JS file from the code manager, you’ll need to add the configuration settings to the top of the file. When complete, your code will look something like as below. You’ll notice the way the instance is instantiated (top two lines of code) is slightly different from the old method—be sure to use this new approach if you’re migrating to the new library.

1. Instantiate and configure the Marketing Cloud visitor ID service:

1

2

3

4

5

//Configure Visitor ID Service

varvisitor:Visitor=newVisitor("INSERT-MCORG-ID-HERE");

visitor.trackingServer="INSERT-TRACKING-SERVER-HERE";

2. Instantiate and configure AppMeasurement:

1

2

3

4

5

6

7

vars:AppMeasurement=newAppMeasurement();

s.account="INSERT-RSID-HERE";

s.trackingServer="INSERT-TRACKING-SERVER-HERE";

s.visitor=visitor;// from Step 1

At a minimum, configure the following three variables below, they can be copied directly from your s_code.js or AppMeasurement.js file.