Show Menu

About AppMeasurement for JavaScript

AppMeasurement for JavaScript is a new library that provides the same core functionality of s_code.js, but is lighter and faster for use on both mobile and desktop sites.

Things to know before you migrate

The following list contains changes you need to understand before switching to this new AppMeasurement version:
  • Some plug-ins are no longer supported. See AppMeasurement Plug-in Support .
  • The library does not support dynamic account selection ( dynamicAccountList , dynamicAccountMatch , and dynamicAccountSelection ).
  • The library and page code can be deployed inside the <head> tag.
  • The Media and Integrate modules are supported using updated module code that is in the JavaScript AppMeasurement download package. The Survey module is not supported.
  • Your existing page code is compatible with the new version.
  • The library provides native utilities to get query parameters, read and write cookies, and perform advanced link tracking.

Frequently Asked Questions

See the FAQ for information about performance, video tracking, mobile, and more.

Initialization process

Call s_gi() , passing the report suite ID to initialize an AppMeasurement instance:
var s_account="INSERT-RSID-HERE"
var s=s_gi(s_account)

When s_gi is called, if an AppMeasurement instance does not exist for the specified s_account , a new instance is created. Otherwise the existing instance is returned. This helps avoid creating duplicate objects for the same account.

Retrieve an AppMeasurement instance

Throughout your code, call the global s_gi() function to retrieve an existing AppMeasurement instance.


JavaScript AppMeasurement provides the following built-in utilities:

Clear Vars

A new clearVars method is available to clear the following values from the instance object:
  • props
  • eVars
  • hier
  • list
  • events
  • eventList
  • products
  • productsList
  • channel
  • purchaseID
  • transactionID
  • state
  • zip
  • campaign
For example:


  • 3-7x faster than H.25 code.
  • Only 21k uncompressed and 8k gzipped (H.25 code is 33k uncompressed and 13k gzipped).
  • Native support for several common plugins ().
  • Small and 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 library across all web environments.