Developer's Guide To Installing the Pendo Snippet

Pendo Agent and API Developer documentation is available at


Pendo captures product usage data, gathers user feedback, and lets you communicate in-app to onboard, educate, and guide users to value. Pendo tagging and guides are codeless, no engineering resources are required. However, we need engineers to install the Agent and initialize Pendo. Information about Pendo and the Pendo installation process is available in the Installation Planning article. We suggest your Pendo Champion fill out the Pendo Installation Workbook to share the information you'll need to complete the install. With preparation the technical installation of the Pendo Snippet is straightforward.

Our agent is the only technical piece of the initial Pendo installation. Once the agent is properly installed anyone can use Pendo. The agent tracks a visitor’s events, like page loads and feature clicks, loads guides, and captures session metadata. Additional development may be done later to optimize and expand the use of Pendo, for example adding custom HTML attributes for tagging or Track Events. Pendo also has integrations with other popular CRM, analytics, and collaboration tools. The scope of integrations ranges from native integrations with a codeless installation wizard to custom development and will not be covered in this article. Check our Integrations articles for help with our popular integrations or reach out to a Pendo representative for help with integrations in your subscription after completing the snippet install.


Web Installation Overview and Demonstration - Runtime: 6:24


The Agent

The installation of the Pendo agent is made up of two pieces, the snippet and the initialization. The snippet is a short Javascript function that adds the Pendo.js file to the window. The initialization identifies the user with visitor and account metadata. Both pieces of the installation must be present on all pages of your website, if you have a single-page application you only need to initialize once per session. Multi-page apps may need to initialize on every page, not just the login page, to initialize Pendo if there's a hard refresh on a page after login.

Typically Pendo is initialized after a visitor is identified. Only initialize Pendo without a visitor ID if you are deliberately trying to track anonymous visitors. Anonymous visitors are tracked with cookies and the same user could easily count as multiple visitors across multiple sessions. Anonymous visitors will count towards the subscription's MAU total. Contact your Sales Representative or Account Manager to understand the impact anonymous visitors will have on your subscription billing.


The Snippet

The Snippet

The snippet code block loads Pendo as a library that will make our functions available at the window-level. The script also passes through the application key. The applicaton key is included in the snippet provided on the Install page or in your App Settings. The application key maps the data the agent collects to your app in your Pendo subscription.

Note: The existence of the snippet does not mean tracking is taking place. The snippet must be initialized to start tracking.


The Initialization

The Pendo agent must be initialized to track usage and to deliver guides. The initialization is where you customize the metadata that you provide Pendo. Pendo users will be able to segment visitors and accounts in analytics and target guides using this metadata. The initialization must run on every window reload after a visitor is authenticated or in every frame, if your site has iframes.

The visitor ID and account ID values should not be changed after installation. Only the visitor and account ID are stored in raw events. Other metadata may be added after the initial installation and will update to the visitor and account details in Pendo. If the visitor or account ID mapping change after installation, new visitor or account records will be created in Pendo with no product usage or guide view history. This will result in anomalies in analytics and segmentation and will repeat guide experiences.

We provide the initialization code block. Your team must determine the appropriate values to pass as the visitor and account ID and additional metadata.  The visitor ID must represent one person through their entire customer journey in your various products, across web and mobile apps. Consensus on this ID between your product and engineering team is crucial. If you’re worried that IDs between your environments, dev or staging, will collide you can append an identifier for the environment to the ID using a prefix or suffix. Methods for identifying visitors in different environments are described in Pendo in Development and Testing. Identifying visitors in different environments will be helpful later when excluding data.

The additional fields shown above are examples of other metadata you can send us about the visitor or account. You can send dates, integers, floats, booleans, and lists. Pendo does not support objects. See our article on Data Mappings for more information.

If your Pendo champion has filled out an Installation Workbook refer to Basic Installation for the fields your team expects to capture.

Note: The total size of the metadata passed during initialization must be less than 64kb. To determine the size, convert the parameters passed to pendo.initialize() into JSON, that JSON file must be smaller than 64kb. This data is compressed by the agent and sent to Pendo. If the compressed JSON data is greater than 64kb it will be dropped by the agent.


Verifying Your Install

There are two ways you can validate your installation.

  1. Review Pendo raw events and data mappings in App Settings
  2. pendo.validateInstall() in Browser Developer Console

Review Pendo Raw Events and Data Mappings In Settings

Get to Raw Events by opening Subscription Settings in Settings.

Get to Data Mappings by opening Data Mappings in Settings.



Raw Events

Open App Details and click Raw Events. 


Note: The App Details should indicate that the app is installed.



The Raw Events Page shows a list of raw events that have been captured by the agent. Clicking into an event will show the code and metadata collected by that event. The event should indicate the visitor ID and account ID of the user who generated the event. It may also indicate the browser session metadata. The additional metadata in the snippet is not stored in raw events.


Note: It may take up to two hours to receive initial data.


Data Mappings

Review Data Mappings to validate that the data listed in Pendo matches the data sent by the agent. This metadata creates a new visitor or updates an existing visitor when a user initializes Pendo in your application. If an agent metadata field is incorrectly populated, it can only be updated the next time Pendo initializes. These fields cannot be modified manually. They can only be changed by modifying the snippet or passing an update visitor function.



Browser Developer Console

You can validate your installation by entering the pendo.validateInstall() command in the browser console. This should be done where the snippet and initialization have been installed and the user is authenticated, unless anonymous users are being used.

  1. Sign in to your app
  2. Open the browser Developer Console
  3. Enter pendo.validateInstall() into the Console
  4. Visitor and account metadata will be returned 



Additional Configurations

How can I prevent Pendo from running in certain situations?

While Pendo does allow you to specify a staging domain for guide testing, it does not provide any configurations to prevent initialization under certain conditions. If pendo.initialize() is called the agent will track behavior and attempt to display guides.

If you want to conditionally initialize Pendo we recommend using some logic to determine if Pendo should be initialized, either by feature flagging or by wrapping the initialize in an 'if' statement. 


Some of our URLs contain sensitive data, how can we prevent Pendo from seeing that data?

Pendo pulls a visitor's current URL in raw events and page tagging. Specific details of the information in one visitor's URL won't be accessible without looking at raw events or untagged pages. If the page rules for tagged pages incorporate the sensitive data as a wildcard, those page views will automatically group under the tagged page and won't be visible in untagged pages.

If you need to prevent this data from ever making it to Pendo we suggest using URL sanitization. Reach out to Support for more details.


How can we prevent Pendo from collecting text?

Pendo doesn't collect user-entered text, like input fields or text boxes, unless it is configured by a Pendo user using Click Event Properties. However, we will collect text from the DOM to make tagging easier. For example, features or guides can tag elements in the UI targeting element:contains("UI Text"). If sensitive information is displayed in the DOM it might be collected, completely or partially, by raw events when recording the hierarchy of an element.

If you need to prevent text collection, add an extra line with excludeAllText: true to your initialization.

For additional agent customizations check our developer docs.

Example of Modified Snippet


Can I block Pendo guides in the snippet if we won't be using them?

If you know that you are not going to be using guides at all, you can set the disableGuides:true flag, which will prevent the Pendo agent from making outbound requests to see if there are guides available. If a Pendo user builds and publishes a guide it cannot load in your app.

Example of Modified Snippet

It is technically possible for a user to change this setting and load guides in the console after initializing. Doing this manually requires significant technical knowledge of Pendo and your application. In this unlikely scenario, the only guide content that may load are published guides in the app that meet all of the user and application-specific targeting criteria.


What if Visitor or Account Data changes without a window reload?

We have some functions that can either modify optional fields or reinitialize a session with a new visitor or account ID.

If you are modifying additional metadata associated with a visitor, call pendo.updateOptions().

If you need to change a visitor or account ID, call pendo.identify() and pass in your visitor and account IDs just like in the initialization.

Learn more about our Initialization and Identification functions.


Can I host the Agent locally?

The installation snippet pulls in pendo.js which contains the Pendo agent code. pendo.js can be downloaded and hosted by your application if you do not want it to be pulled from Pendo’s CDN.

For instructions on hosting the Agent reference Self-hosting the Pendo Agent.


Can Pendo be installed on-premise?

The Pendo agent can be hosted locally and included in on-premise applications. Pendo currently only hosts and processes data in the cloud so this will still require a connection to the internet and Pendo servers must be added to Include Lists. Broadly, guides are inbound traffic and analytics are outbound.



Why is my data not appearing in Pendo?

Confirm that your application key has been included in the snippet. If you copy your snippet from your Install Settings page, the application key is already included. If you pulled the snippet from somewhere else, confirm the application key is present in your snippet.

There are data syntax rules you will need to follow in order for Pendo to receive all of your data.

  • Do not send null values for any fields. If you do not have data for a field omit sending that field.
  • Any custom fields added in the snippet cannot include a space.
  • Fields must start with letter or underscore and can include any combination of letters, numbers, and an underscore.

Learn more about Visitor and Account metadata.

Note: Most data used for analytics is batch aggregated at the top of the hour, every hour, and can take up to 15 minutes past the top of the hour to appear in the Pendo UI.

pendo.js and pendo-staging.js

The Pendo snippet will first load the pendo.js agent. This agent will check if the server hostname matches a staging server rule and if it does it will load the Pendo object from pendo-staging.js instead of pendo.js.


No Logged In Users

During setup, the message "No Logged In Users" means that Pendo is receiving, pages and features usage data but there is no user identifying information. You can still use Pendo without identified users but the functionality will be greatly reduced.

Either the visitor or account ID parameters in the snippet could be causing the issue. Either the data is not being passed or it is structured incorrectly.

Code Template

  id:'VISITOR-UNIQUE-ID'// Required if user is logged in
  // email:        // Recommended if using Pendo Feedback, or NPS Email
  // full_name:    // Recommended if using Pendo Feedback
  // role:         // Optional
  // You can add any additional visitor level key-values here,
  // as long as it's not one of the above reserved names.

  // id:           'ACCOUNT-UNIQUE-ID' // Highly recommended
  // name:         // Optional
  // monthly_value:// Recommended if using Pendo Feedback
  // is_paying:    // Recommended if using Pendo Feedback
  // planLevel:    // Optional
  // planPrice:    // Optional
  // creationDate: // Optional
  // You can add any additional account level key-values here,
  // as long as it's not one of the above reserved names.


Code Example with Metadata

  id:              $user.ID,
  creationDate:    $user.creationDate

  planLevel:    $account.subscriptionCost,
  isFoo:        $account.isFoo

Code Example sent to Pendo

  full_name:'John Doe',

  name:'Acme, inc',

Why are my auto-tags not appearing in Pendo Feedback?

Feedback receives visitor and account tag values embedded within the Pendo snippet. To show metadata values collected from the Pendo snippet in the Feedback UI, add key value pairs for visitor and account tags in array format.

Learn more about auto-tagging in Feedback.

Code Template

visitor: {
  id:              'VISITOR-UNIQUE-ID'   // Required if user is logged in
  // email:        // Recommended if using Pendo Feedback, or NPS Email
  // full_name:    // Recommended if using Pendo Feedback
  // role:         // Optional
// tags: // Recommended if using Pendo Feedback // 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-UNIQUE-ID' // Highly recommended // name: // Optional // monthly_value:// Recommended if using Pendo Feedback // is_paying: // Recommended if using Pendo Feedback // planLevel: // Optional // planPrice: // Optional // creationDate: // Optional
// tags: // 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. }


Code Example with Metadata

visitor: {
  id:              $user.ID,
  email:           '$',
  full_name:       '$user.full_name',
  role:            '$user.accessLevel',
  creationDate:    $user.creationDate,
tags: ['$user.accessLevel','$user.creationDate'] }, account: { id: '$account.ID', name: '$', is_paying: '$account.is_paying', monthly_value:'$account.monthly_value', planLevel: $account.subscriptionCost, isFoo: $account.isFoo,
tags: ['$account.subscriptionCost','$account.isFoo'] }

Code Example sent to Pendo

visitor: {
  id:              62343,
  email:           '',
  full_name:       'John Doe',
  role:            'admin',
  creationDate:    1404326949156

account: {
  id:           17,
  name:         'Acme, inc',
  is_paying:    true,
  planLevel:    995,
  isFoo:        false