Show Menu

The s_gi() Function

The s_gi() function is used to create or find your instance of AppMeasurement by report suite ID. Internally, AppMeasurement keeps track of every instance created, and s_gi() returns the existing instance for a report suite if one exists. If an instance does not exist, a new instance is created and returned.
We recommend calling s_gi() before setting variables and making tracking calls throughout your page code. This ensures that the correct object is used to make the tracking call in the case that the s variable is inadvertently overwritten.

Using Multiple Report Suites

The object returned varies based on the report suite ID(s) passed. For example, if you make the following initial call to s_gi() :
var s=s_gi('rsid1,rsid2')

The following table outlines what is returned by subsequent calls:
Subsequent Call to s_gi
Description of Object Returned
The same object referenced earlier.
A copy of the object created earlier, but not the original.
A copy of the object created earlier, but not the original.
A new, empty object, with no config variables set (e.g. linkTrackVars is empty, as is linkDownloadFileTypes).