The General API

The Glean SDK has a minimal API available on its top-level Glean object called the General API. This API allows, among other things, to enable and disable upload, register custom pings and set experiment data.

Only initialize in the main application!

The Glean SDK should only be initialized from the main application, not individual libraries. If you are adding Glean SDK support to a library, you can safely skip this section.

The API

The Glean SDK provides a general API that supports the following operations. See below for language-specific details.

OperationDescriptionNotes
initializeConfigure and initialize the Glean SDK.Initializing the Glean SDK
setUploadEnabledEnable or disable Glean collection and upload.Toggling upload status
registerPingsRegister custom pings generated from pings.yaml.Custom pings
setExperimentActiveIndicate that an experiment is running.Using the Experiments API
setExperimentInactiveIndicate that an experiment is no longer running..Using the Experiments API