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:
- Smaller: 22k uncompressed & 8k gzipped (H.26 code is 33k uncompressed & 13k gzipped)
- Faster: 3-7x faster than the H.25 code
- Native Utilities: new native utilities provide product-level support for several common plugin use cases (getqueryparam, linkhandler, cookie handling, url encoding)
- Modules: updated Integrate and Media Modules available from code manager
- Head Tag Deployments: deploying s_code and page code inside the <head> tags is fully supported
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.
// from codingRepo
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:
//Configure Visitor ID Service
var visitor:Visitor = new Visitor("INSERT-MCORG-ID-HERE");
visitor.trackingServer = "INSERT-TRACKING-SERVER-HERE";
2. Instantiate and configure AppMeasurement:
var s:AppMeasurement = new AppMeasurement();
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.
AppMeasurement Plug-in Support
1. Tested Plugins
- manageVars (requires s.pt plugin utility)
- Cookie Combining Utility
2. Untested Plugins
3. Unsupported Plugins
- Form Analysis