This article describes how to insert a custom code snippet into an application you control the code for, or can write JavaScript in, to configure Visitor IDs and metadata. This method is an alternative to the standard IT-controlled deployment, and identifies your visitors from a webpage through JavaScript code instead of registry keys.
Prerequisites
To identify visitors through browser scripting, you must:
- Be an Admin user for the Pendo subscription. For information, see Roles and permissions.
- Have the Pendo Launcher extension installed on your browser. Any browser that supports the extension is eligible. For information, see the IT guide to deploying the Pendo Launcher.
- Have an application that allows you to inject a JavaScript snippet, such as an internally built application or a SaaS application that allows JavaScript injection, such as MS Dynamics or Salesforce.
Process overview
After setup, visitors are initially set as anonymous. The first time they visit an application where the browser extension (herein, Pendo Launcher) runs, the Pendo Launcher opens a window for the URL of the application you have set up browser scripting with. If the URL you’ve provided can’t automatically identify the visitor, for instance, if it opens a login page, then the visitor must provide their credentials, after which the screen closes.
After the Pendo Launcher browser extension has identified the visitor, the visitor is then forwarded to the URL you provided as part of the setup process. This process only happens once.
Step 1. Configure the Pendo Launcher
First, you must enable the functionality required for identifying visitors and metadata with browser scripting:
- In Pendo, navigate to Settings > Subscription Settings.
- Under Extension settings select the Set visitor metadata through browser scripting.
- In Identification app URL, enter the URL of the application you’re setting up browser scripting for. You only need to configure this in one place for your entire subscription.
- Optionally, add a privacy message. Select Show privacy awareness banner and add the text you want to include in your message to explain why the visitor is being asked to identify themselves.
- Select Save configuration.
Step 2. Enable identification for browser scripting
- In Pendo, navigate to Settings > Subscription Settings.
-
Open the Applications tab and open the application that matches the entry for Identification App URL in Step 1. For example, if the Identification a4pp URL is
https://company.example.com/apps
you select the application with the Websites field that includescompany.example.com
. -
Select Inject visitor identification function for browser scripting. This controls where the
window.__pendoIdentifyVisitor
function (found in the code shown Step 3) is injected.
Step 3. Insert the identification JavaScript snippet
Next, insert a JavaScript snippet into an application that you control to identify visitors to the application.
- In Pendo, navigate to Settings > Subscription Settings.
- Ensure Set visitor metadata through browser scripting under Extension settings > Advanced settings is selected. This reveals more options and information, including the script that you need to modify.
-
Copy and paste the script into a plain text editor and edit the code to replace
VISITOR-UNIQUE-ID
with code that identifies the visitor in the application. - Insert the edited code into your application at the URL that matches the entry for Identification App URL in Step 2.