Skip to main content

Agent

additionalApiKeys : Array.<string>

Array of additional API keys that are set in the config. If no primary API key is set, the first in this array will be assigned to pendo.apiKey.

Example

pendo.additionalApiKeys => ['FIRST_API_KEY', 'SECOND_API_KEY']

apiKey : string

API key that is associated with the current Pendo installation as a string.

Example

pendo.apiKey => 'API_KEY'

getVersion() ⇒ string

Returns current version of the Agent as a string. Also directly accessible at pendo.VERSION.

Returns: string - agent version
Example

pendo.getVersion() => '2.150.0'

initialize(options)

Initializes the Pendo agent in a browser window. This function only needs to be called once per page load. Any subsequent calls, without first having called teardown, will be ignored. Once the agent has been initialized, any updates to identity or metadata should be done using identify or updateOptions.

See: Pendo Installation

ParamTypeDescription
optionsobjectidentity metadata and configuration to initialize agent

Example

pendo.initialize({
visitor: {
id: <visitor-id-goes-here>, // Required if user is logged in
// full_name: "John Doe", // Recommended if using Pendo Feedback
// email: "user@acme.com", // Recommended if using Pendo Feedback or NPS email
// role: "Viewer" // Optional

// You can add any additional visitor level key-values here,
// as long as it's not one of the above reserved names.
},
account: {
id: <account-id-goes-here>, // Recommended, required if using Pendo Feedback
// name: "Acme Co", // Optional
// is_paying: false, // Recommended if using Pendo Feedback,
// monthly_value: 0, // Recommended if using Pendo Feedback

// You can add any additional account level key-values here,
// as long as it's not one of the above reserved names.
}
});

isReady() ⇒ boolean

Returns boolean representing whether the Agent is fully loaded and has an API key.

Example

if (pendo.isReady()) {
// runs if agent has fully loaded
}

teardown() ⇒ void

Shuts down the agent and cleans up all timers and listeners. Upon completion the agent will be able to be re-initialized when needed or cleaned up from the window. This will halt all guides and data collection.

Example

window.pendo.teardown();
pendo.isReady(); // this will return false
delete window.pendo;