Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Pendo JavaScript library (Page/Feature events) #6150

Open
wants to merge 3 commits into
base: add/pendo-track-page-feature-events
Choose a base branch
from

Conversation

chriszarate
Copy link
Member

Description

Provide Pendo-based telemetry for client-side Pendo Page/Feature events. These events require a client library to be enqueued and configured. "Track events" can also be sent client-side, but we should avoid this and prefer the server-side implementation.

Usage requires a single static function call to enable the client-side library (Pendo::enable_javascript_library()).

Pre-review checklist

Please make sure the items below have been covered before requesting a review:

  • This change works and has been tested locally or in Codespaces (or has an appropriate fallback).
  • This change works and has been tested on a sandbox.
  • This change has relevant unit tests (if applicable).
  • This change uses a rollout method to ease with deployment (if applicable - especially for large scale actions that require writes).
  • This change has relevant documentation additions / updates (if applicable).
  • I've created a changelog description that aligns with the provided examples.

Pre-deploy checklist

  • VIP staff: Ensure any alerts added/updated conform to internal standards (see internal documentation).

Steps to Test

Copy link
Contributor

@smithjw1 smithjw1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question about how enablement is controlled. I see the edit_posts restriction, but not the other items mentioned here. As well a check to a org level opt out (synced from GOOP).

@chriszarate
Copy link
Member Author

chriszarate commented Mar 7, 2025

I see the edit_posts restriction, but not the other items mentioned here.

@smithjw1 These checks were initially separated. I updated the code and added tests In a way that should make it more obvious and reviewable.

  • ✅ Nonproduction Environments. Covered by Pendo::is_pendo_enabled_for_environment()
  • ✅ Where our plugin is installed. Not enforced by mu-plugins, but instead de facto covered by the absence of plugin code calling Pendo::enable_javascript_library()
  • ✅ Only for users with edit_posts capability
  • ⛔ On certain URLs. Per this comment I did not implement this restriction.
  • ✅ Outside of VIP. Covered by Pendo::is_pendo_enabled_for_environment()

As well a check to a org level opt out (synced from GOOP).

That is implemented in two ways:

  1. The presence of VIP_DISABLE_PENDO_TELEMETRY=true which disables all Pendo telemetry.
  2. The absence of VIP_PENDO_SNIPPET_API_KEY which disables just the snippet enqueuing.

Copy link

sonarqubecloud bot commented Mar 7, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants