Skip to content

Added: suggested content for Privacy Policy#299

Merged
Dan0sz merged 5 commits intodevelopfrom
privacy_policy
May 5, 2026
Merged

Added: suggested content for Privacy Policy#299
Dan0sz merged 5 commits intodevelopfrom
privacy_policy

Conversation

@Dan0sz
Copy link
Copy Markdown
Collaborator

@Dan0sz Dan0sz commented May 5, 2026

Addresses #164

Summary by CodeRabbit

  • New Features
    • WordPress Privacy Policy Integration: Adds an admin-facing suggestion that can be inserted into your site's privacy policy. The suggested, localized text explains Plausible Analytics data collection (pages, referrers, device/browser, location), notes processing in the EU, and includes a link to Plausible’s data policy.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0c8c5858-210a-4ee9-94e3-9902f52650a2

📥 Commits

Reviewing files that changed from the base of the PR and between d436c29 and 1436d1a.

📒 Files selected for processing (1)
  • src/Admin/PrivacyPolicy.php

📝 Walkthrough

Walkthrough

Adds Plausible\Analytics\WP\Admin\PrivacyPolicy which hooks into WordPress admin_init to add a localized "Plausible Analytics" section to the site's Privacy Policy (sanitized and registered via wp_add_privacy_policy_content). The service is instantiated from Plugin::register_services() in admin context.

Changes

Privacy Policy Integration

Layer / File(s) Summary
Service Class Definition
src/Admin/PrivacyPolicy.php
New PrivacyPolicy class with __construct()init() registering add_suggested_content() on admin_init.
Content Addition Logic
src/Admin/PrivacyPolicy.php
add_suggested_content() checks for wp_add_privacy_policy_content, builds localized "Analytics" content (mentions usage stats, EU processing, and links to https://plausible.io/data-policy), sanitizes with wp_kses_post( wpautop(..., false) ), and registers it via wp_add_privacy_policy_content('Plausible Analytics', ...).
Service Registration
src/Plugin.php
Admin\PrivacyPolicy is instantiated within register_services() when running in admin, alongside other admin services.
Manifest
composer.json
Composer manifest present in changeset (no functional signature changes).
sequenceDiagram
    participant Plugin as Plugin (admin)
    participant Policy as Admin\PrivacyPolicy
    participant WP as WordPress Core
    Plugin->>Policy: instantiate on register_services()
    Policy->>WP: add_action('admin_init', add_suggested_content)
    WP->>Policy: trigger admin_init (admin visits)
    Policy->>WP: call wp_add_privacy_policy_content('Plausible Analytics', $html)
    WP-->>Policy: register suggested content
Loading

🐰 I hopped in code with curious delight,
I whispered "Analytics" into the night;
A gentle note of data, EU and clear,
Planted in policies for all to hear;
A tiny rabbit cheers transparency bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding suggested content for the Privacy Policy page through a new PrivacyPolicy admin integration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch privacy_policy

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 PHPStan (2.1.54)

PHPStan was skipped because the sandbox runner could not parse its output.


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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Admin/PrivacyPolicy.php`:
- Around line 41-48: The sprintf() call that appends the Plausible data-policy
URL to $content should output a clickable link and include a translators
comment: replace the bare URL placeholder value with an anchor tag string (e.g.,
'<a
href="https://plausible.io/data-policy">https://plausible.io/data-policy</a>')
so the rendered page shows a clickable link, and add a preceding /* translators:
*/ comment for the __() string containing the %s placeholder to satisfy WP i18n
tooling; update the line that calls sprintf( __( ... ),
'https://plausible.io/data-policy' ) in PrivacyPolicy.php accordingly
(wp_kses_post() already permits anchors so no downstream changes needed).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a7350383-2cb4-4371-ac63-21bdc4382c25

📥 Commits

Reviewing files that changed from the base of the PR and between 2db4fc1 and d436c29.

📒 Files selected for processing (2)
  • src/Admin/PrivacyPolicy.php
  • src/Plugin.php

Comment thread src/Admin/PrivacyPolicy.php
@Dan0sz Dan0sz merged commit c2fc480 into develop May 5, 2026
6 of 7 checks passed
@Dan0sz Dan0sz deleted the privacy_policy branch May 5, 2026 18:42
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