Skip to content

feat: add setting to disable PID URL tracking parameters#1196

Merged
danieliser merged 3 commits into
developfrom
feat/disable-pid-url-params
Apr 4, 2026
Merged

feat: add setting to disable PID URL tracking parameters#1196
danieliser merged 3 commits into
developfrom
feat/disable-pid-url-params

Conversation

@danieliser
Copy link
Copy Markdown
Member

@danieliser danieliser commented Apr 3, 2026

Summary

  • Adds a "Disable URL tracking parameters?" checkbox under Settings > Privacy
  • When enabled, internal links inside popups no longer get ?pid= appended to their URLs
  • Link clicks fall back to browser beacon tracking (sendBeacon / image pixel) — the same method already used for external, mailto, and tel links
  • When the existing "Disables popup open tracking?" setting is on, all tracking is now skipped (pid params, beacons, and click handlers) — previously the URL tracking module didn't respect this setting

Changes

File Change
classes/Admin/Settings.php New disable_pid_url_params checkbox in Privacy tab
classes/Site/Assets.php Pass disable_url_params to frontend pum_vars
assets/js/src/site/plugins/pum.js Default disable_url_params: false
assets/js/src/site/plugins/pum-url-tracking.js Respect both disable_tracking and disable_url_params flags

Test plan

  • Default behavior: no settings changed → internal links still get ?pid=X appended
  • Enable new setting → internal links stay clean, clicking fires a beacon
  • Enable "Disables popup open tracking?" → no pid params, no beacons, no click handlers
  • External links always use beacon regardless of new setting
  • JS builds successfully

Summary by CodeRabbit

  • New Features
    • Added a privacy setting to stop appending popup tracking parameters to links; when enabled, link clicks are tracked via browser beacons instead.
    • Client-side now exposes a related toggle and respects the new setting and a global disable-tracking option.
  • Bug Fixes
    • Fixed link-tracking logic to honor the global disable-tracking setting.
  • Other
    • Minor robustness improvements to asset metadata handling.

Add "Disable URL tracking parameters?" checkbox under Settings > Privacy.
When enabled, internal links inside popups no longer get ?pid= appended.
Instead, link clicks are tracked via browser beacons (sendBeacon/image
pixel), the same method already used for external links.

When analytics are fully disabled via the existing "Disables popup open
tracking?" setting, no tracking of any kind is applied — no pid params,
no beacons, no click handlers.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 3, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9812315c-286e-4d45-88d1-8b312b28854a

📥 Commits

Reviewing files that changed from the base of the PR and between 71f7183 and 6d1e371.

📒 Files selected for processing (1)
  • CHANGELOG.md

Walkthrough

Adds a privacy setting to disable adding popup ID URL parameters to links. When enabled, internal popup links use beacon-based click tracking instead of appended PID query params. The setting is exposed in admin, localized into site JS, and honored by the popup link processing script.

Changes

Cohort / File(s) Summary
Tracking Logic
assets/js/src/site/plugins/pum-url-tracking.js
processPopupLinks now returns early when pum_vars.disable_tracking is true; for internal links, it conditionally appends popup ID query param only if pum_vars.disable_url_params is false, otherwise attaches beacon/click-tracking handlers. External/special link beaconing remains unchanged.
JS Defaults
assets/js/src/site/plugins/pum.js
Adds new default flag disable_url_params: false to window.pum_vars.
Localization / Site Assets
classes/Site/Assets.php
Localizes disable_url_params into the popup-maker-site script from pum_get_option('disable_pid_url_params') (cast to boolean).
Admin Settings UI
classes/Admin/Settings.php
Adds disable_pid_url_params checkbox to the Privacy settings to toggle URL-parameter injection for popup links.
Developer Utility
includes/functions/developers.php
pum_get_asset_group_meta() now casts the required file to an array only when the file exists, avoiding unconditional casting when the file is missing.
Changelog
CHANGELOG.md
Documents the new privacy setting and related bugfixes (tracking suppression when analytics disabled; PHP operator precedence fix).

Sequence Diagram(s)

sequenceDiagram
  participant Admin as rgba(40, 116, 166, 0.5) Admin UI
  participant PHP as rgba(34, 139, 34, 0.5) Backend (Settings & Localization)
  participant Browser as rgba(178, 34, 34, 0.5) Client (Site JS)
  Admin->>PHP: Toggle disable_pid_url_params
  PHP->>PHP: Save option
  PHP->>Browser: Localize pum_vars { disable_url_params }
  Browser->>Browser: processPopupLinks(href)
  alt disable_url_params == false
    Browser->>Browser: Append popup ID query param (pid) to internal links
  else disable_url_params == true
    Browser->>Browser: Attach beacon/click-tracking handler to internal links
  end
  Browser->>Server: Click beacon or navigation with pid param
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main feature: adding a setting to disable PID URL tracking parameters. It directly corresponds to the primary changes across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/disable-pid-url-params

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

`(array) file_exists($file) ? require $file : []` parses as
`((array) file_exists($file)) ? require $file : []` — since
`(array) false` yields `[false]` (truthy), the file_exists guard
never actually prevented the require. Move the cast after the
ternary so the guard works correctly.
@danieliser danieliser merged commit 84b7abf into develop Apr 4, 2026
15 of 17 checks passed
@danieliser danieliser deleted the feat/disable-pid-url-params branch April 4, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant