Core
additionalPublicAppIds : Array.<string>
Formerly additionalApiKeys. An array of additional app IDs that are set in the config. If no primary app ID is set,
the first in this array will be assigned to pendo.publicAppId.
Example
pendo.additionalPublicAppIds => ['FIRST_PUBLIC_APP_ID', 'SECOND_PUBLIC_APP_ID']
getConfigValue ⇒ *
Retrieve a configuration value from the web SDK's config. Available configuration keys can be found in the configuration section.
Returns: * - The configuration value.
| Param | Type | Description |
|---|---|---|
| key | string | The configuration key to retrieve. |
Example
pendo.getConfigValue('excludeAllText') => false
getVersion() ⇒ string
Returns the current version of the Pendo Web SDK as a string. Also directly accessible at pendo.VERSION.
Returns: string - web SDK version
Example
pendo.getVersion() => '2.150.0'
initialize(options)
Initializes the Pendo Web SDK 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 web SDK has been initialized, any updates to identity or metadata should be done using identify or updateOptions.
See: Pendo Installation
| Param | Type | Description |
|---|---|---|
| options | object | identity metadata and configuration to initialize the web SDK |
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 a boolean representing whether the Pendo Web SDK is fully loaded and has an API key.
Example
if (pendo.isReady()) {
// runs if web SDK has fully loaded
}
publicAppId : string
Formerly apiKey. The public app ID associated with the current Pendo installation as a string.
Example
pendo.publicAppId => 'PUBLIC_APP_ID'
teardown() ⇒ void
Shuts down the web SDK and cleans up all timers and listeners. Upon completion the web SDK 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;
updateCookieConsent(tiers, [identity]) ⇒ object
Enforces the cookie consent policy a visitor has agreed to. The policy is defined by the subscription's cookie consent configuration,
and is used to determine what data the web SDK can collect. The new tiers replace any previously consented tiers,
including those passed to pendo.initialize as cookieConsentTiers, and are shared with other frames running the web SDK for the same application.
A visitor who was not being tracked has no identity for the web SDK to resume, so pass one in
identity when the new tiers start allowing identity. It is ignored otherwise.
Read more about Cookie Consent Levels.
Returns: object - what data is now collected -- guides and identity are
booleans (identity disabled means DNT), textCollection is none/whitelist/all,
analytics and guideAnalytics are each an array of allowed event types
| Param | Type | Description |
|---|---|---|
| tiers | string | Array.<string> | tier or tiers the visitor consented to |
| [identity] | object | visitor and account to identify, in the same shape as pendo.updateOptions -- applied only when consent moves a do-not-track visitor to a tier that permits identity |
Example
pendo.updateCookieConsent('strictlyNecessary');
Example
pendo.updateCookieConsent(['strictlyNecessary', 'functional']);
Example
pendo.updateCookieConsent(['strictlyNecessary', 'functional'], {
visitor: { id: 'put_visitor_id_here', role: 'admin' },
account: { id: 'put_account_id_here' }
});