Skip to main content

Identity

Functions

clearSession()

Removes current visitor id and account id. Triggers an identify event and reloads with a new anonymous visitor.

generate_unique_id(prefix)string

Generate a unique id string, usually for a visitor id. Default for anonymous visitor ids.

getAccountId()string | null

Returns the id for the account currently being applied to any events being sent to Pendo.

getSerializedMetadata()JSON

Returns all metadata being passed through the agent.

getVisitorId()string

Returns the id for the visitor currently being applied to any events being sent to Pendo. Will always be set either by host application or as an anonymous generated ID.

identify()

This function accepts either a string for just the visitor id or it accepts an Object that will contain at least a visitor object with at least an id field. It may also contain other visitor related Key/Value pairs in the visitor object. Also, in the options object may be an account object that will contain at least an id field. It may also contain other account related Key/Value pairs. This will potentially send an identify event and a metadata event.

Identifying a visitor will send an event to Pendo and begin loading eligible guides to the identified user. To remove visitor identity use pendo.clearSession().

isAnonymousVisitor(visitorId)boolean

Checks if a given visitor id string is anonymous. If no argument is given, calls withpendo.getVisitorId() to check current visitor status.

set_account_id(newAccountId)

Sets account id for the agent without changing existing metadata. However, An invalid account id or an explicit null value will clear the current account id and account metadata.

set_visitor_id(newVisitorId)

Sets visitor id for the agent. Requires a valid visitor id string. This will not change or clear existing visitor metadata set.

updateOptions(options)

Updates metadata object for the Pendo agent. Can include visitor and/or account updates, along with customer-defined metadata values. Changes to identity information will potentially fire identity and metadata events, in turn evaluating guide eligibility for the new user and displaying any matching guides automatically.

clearSession()

Removes current visitor id and account id. Triggers an identify event and reloads with a new anonymous visitor.

Kind: global function
Category: Identity
Access: public
Example

pendo.clearSession()

generate_unique_id(prefix) ⇒ string

Generate a unique id string, usually for a visitor id. Default for anonymous visitor ids.

Kind: global function
Category: Identity
Access: public

ParamTypeDescription
prefixstringstring to prepend to the unique id

Example

pendo.generate_unique_id('user-') => 'user-RaPiWJ5M53Y'

getAccountId() ⇒ string | null

Returns the id for the account currently being applied to any events being sent to Pendo.

Kind: global function
Returns: string | null - active account id or null if not set
Category: Identity
Access: public
Example

pendo.getAccountId()

Example

pendo.get_account_id()

getSerializedMetadata() ⇒ JSON

Returns all metadata being passed through the agent.

Kind: global function
Returns: JSON - metadata available to the agent
Category: Identity
Access: public
Example

pendo.getSerializedMetadata()

getVisitorId() ⇒ string

Returns the id for the visitor currently being applied to any events being sent to Pendo. Will always be set either by host application or as an anonymous generated ID.

Kind: global function
Returns: string - id of currently active visitor
Category: Identity
Access: public
Example

pendo.getVisitorId()

Example

pendo.get_visitor_id()

identify()

This function accepts either a string for just the visitor id or it accepts an Object that will contain at least a visitor object with at least an id field. It may also contain other visitor related Key/Value pairs in the visitor object. Also, in the options object may be an account object that will contain at least an id field. It may also contain other account related Key/Value pairs. This will potentially send an identify event and a metadata event.

Identifying a visitor will send an event to Pendo and begin loading eligible guides to the identified user. To remove visitor identity use pendo.clearSession().

Kind: global function
Category: Identity
Access: public
Example

pendo.identify("put_visitor_id_here", "put_account_id_here");

Example

pendo.identify({
visitor: {
id: "put_visitor_id_here",
name: "Neo",
email: "neo@thematrix.io",
role: "admin"
},
account: {
id: "put_account_id_here",
name: "CorpSchmorp"
}
});

isAnonymousVisitor(visitorId) ⇒ boolean

Checks if a given visitor id string is anonymous. If no argument is given, calls with pendo.getVisitorId() to check current visitor status.

Kind: global function
Category: Identity
Access: public

ParamTypeDescription
visitorIdstringstring to check if anonymous

Example

pendo.isAnonymousVisitor('_PENDO_T_123') => true

set_account_id(newAccountId)

Sets account id for the agent without changing existing metadata. However, An invalid account id or an explicit null value will clear the current account id and account metadata.

Kind: global function
Category: Identity
Access: public

ParamType
newAccountIdstring

Example

pendo.set_account_id('new_account');

set_visitor_id(newVisitorId)

Sets visitor id for the agent. Requires a valid visitor id string. This will not change or clear existing visitor metadata set.

Kind: global function
Category: Identity
Access: public

ParamType
newVisitorIdstring

Example

pendo.set_visitor_id('new_visitor');

updateOptions(options)

Updates metadata object for the Pendo agent. Can include visitor and/or account updates, along with customer-defined metadata values. Changes to identity information will potentially fire identity and metadata events, in turn evaluating guide eligibility for the new user and displaying any matching guides automatically.

Kind: global function
Category: Identity
Access: public

ParamTypeDescription
optionsobjectnew metadata to set in the agent

Example

pendo.updateOptions( { visitor: {"role":"admin"} }, { account: {"industry":"retail"} });