This is an example of how the Pendo Agent can be loaded using its npm package to be included in a MV3 compatible Chrome Extension. This particular example uses React and Vite with TypeScript. It has a simple index page that can be reached by clicking the extension's icon in the list of extensions.
Make sure you have Node.js (version 18+ or 20+) installed on your machine.
-
Install the dependencies:
npm install
-
Setup environment variables for building. The
pendo-prebuild
command uses two environment variables to download your configuration file and the designer files. You will need to setup those variables to use it as is:export PENDO_API_KEY={your_api_key_here} export PENDO_ENVIRONMENT=io
-
Create a .env file with your pendo api key and environment like below
VITE_PENDO_API_KEY={your_api_key_here} VITE_PENDO_ENVIRONMENT=io
To build the extension run the below command:
npm run build
This will run the Pendo prebuild steps and generate the build files in the build
directory.
- Open Chrome and navigate to
chrome://extensions/
. - Enable "Developer mode" using the toggle switch in the top right corner.
- Click "Load unpacked" and select the
build
directory.
Your React app should now be loaded as a Chrome extension!
public/
: Contains static files and themanifest.json
.src/
: Contains the React app source code.vite.config.ts
: Vite configuration file.tsconfig.json
: TypeScript configuration file.package.json
: Contains the project dependencies and scripts.
This project is licensed under the MIT License.