.d.ts files of the published packages. Read SDK reference for
the import forms.
Grain Tag
The instance also has
track, identify, and destroy with the same signatures as the module
functions. The script build exposes init, getInstance, track, identify, and the
GrainTag class on window.GrainTag.
init
init creates the instance and starts automatic tracking. Outside a browser,
init returns a no-op stub. If init runs a second time, it returns the existing instance and
logs a warning. To start again with a new configuration, call destroy first.
getInstance
null before init runs.
isInitialized
track
track runs before init, the event goes into a queue. The SDK replays the queue after
init.
identify
identify runs before init, the call goes into the same queue as track. Read
Identify users.
destroy
destroy, init can run again with a new configuration.
consent.grant
consent.revoke
consent.status
null when the user made no consent decision.
flush
isReady
true when the instance is a real instance in a
browser, and false for the no-op stub.
updateDataLayerConnectors
Analytics Web
Every method is a member of aGrainAnalytics instance. Create the instance with
new GrainAnalytics(config) or createGrainAnalytics(config).
Every example below starts from this instance.
track
identify
setUserId
getUserId
null when no user ID is set.
getEffectiveUserId
getSessionId
login
logout
setProperty
Read User properties.
flush
grantConsent
revokeConsent
getConsentState
null when the user made no consent decision.