=== bugd.one – Bug Reports & Error Tracking ===
Contributors: mignutimedia, eduardditler
Tags: bug report, error tracking, crash reporting, feedback, debugging
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Let visitors report bugs with one click and get PHP and JavaScript errors from your WordPress site delivered to your bugd.one dashboard.

== Description ==

**bugd.one** is a bug tracker and crash reporter hosted in the EU. This plugin connects your WordPress site with a bugd.one project:

* **One-click setup** – "Connect with bugd.one": sign in, pick or create a project, done. The keys are stored automatically and your domain is allowed – no copying of keys.
* **Bug-report widget** – a small button on your site. Visitors describe a problem, take a screenshot of the page with one tap (password and payment fields are blacked out) or attach images, and the report lands in your bugd.one dashboard with browser, page and recent console errors. If you enable support requests or feedback for your project, visitors can also send photos and voice messages. Reporters can be notified by e-mail when the status changes.
* **PHP error tracking** – fatal errors and uncaught exceptions on your server are sent to bugd.one with a stack trace, the affected plugin or theme, and your PHP and WordPress versions. Optionally warnings and notices, too.
* **JavaScript error tracking** (optional) – unhandled browser errors on your pages are reported with the bugd.one crash reporter.
* **Environments** – staging and development sites are reported as "development" automatically (via `wp_get_environment_type()`), so they never trigger production notifications.
* **Visibility control** – show the widget to everyone, to logged-in users only, or to administrators only.
* **Privacy by design** – no cookies, no form data, no query strings and no IP addresses are sent with PHP errors; e-mail addresses and tokens in error messages are removed before sending.

The plugin never changes how WordPress or PHP handle errors: it only observes them (previously registered handlers are called as usual) and reports at most one event per error every 5 minutes and 30 events per 10 minutes, so an error loop cannot slow down your site.

You need a bugd.one account and a project (https://bugd.one). New accounts can try all Pro features free for 7 days, no credit card required; afterwards Pro (€9.90/month) or Team (€29.90/month) keeps the project accepting reports. The project provides two keys:

* the **project key** (publishable key, `bk_live_…`) for the widget and JavaScript errors – public by design;
* the **server key** (`bk_server_…`, optional) for PHP errors – a secret that is stored in your database and never printed on your pages.

The settings page guides you: connect with one click (or paste the keys by hand), a status card shows which keys are set, and two test buttons check the widget key (including the allowed domains) and send a PHP test error.

== External services ==

This plugin connects to the service **bugd.one**, operated by Mignuti Media, Germany (https://bugd.one). Data is stored with Cloudflare, Inc. under EU jurisdiction. The plugin does nothing until you connect it or enter your keys on Settings → bugd.one.

**0. "Connect with bugd.one" (only when an administrator clicks it)**
The administrator's browser is sent to `https://bugd.one/connect/wordpress` with your site's address (origin), the site name and a random one-time value. After the administrator signs in at bugd.one and confirms, bugd.one sends the browser back to your site's `wp-admin/admin-post.php` with a one-time code. Your server then sends this code and your site's origin to `https://bugd.one/api/v1/connect/exchange` and receives the project key, the project name and, if the administrator chose it, a new server key. If the bugd.one project keeps a list of allowed domains, your site's domain is added to it.

**1. Bug-report widget (script loaded from bugd.one)**
When the widget is enabled and a publishable key is set, the plugin loads `https://bugd.one/widget.umd.js` on the front end of your site. The script contacts `https://bugd.one/api/` to load its configuration and to submit reports. If bot protection is enabled for bugd.one, it additionally loads Cloudflare Turnstile (https://challenges.cloudflare.com) when a report is submitted. On submission the following is sent: the text the visitor enters, anything the visitor chooses to attach (a screenshot of the visible page, taken in the browser only when the visitor taps "Take screenshot", with password and payment fields blacked out; images; and – only if support requests or feedback are enabled for the project – photos and voice messages), an optional e-mail address (only if the visitor enters it and consents), the page address without query string and fragment, browser and operating system, recent browser console errors and failed requests (with e-mail addresses, tokens and query strings removed), the environment, and the release string of your site. Like any web request, loading the script and calling the API exposes the visitor's IP address to the bugd.one servers; bugd.one uses it only in a hashed form for rate limiting and does not store it in the report.

**2. JavaScript error tracking (optional, off by default)**
When enabled, the plugin loads `https://bugd.one/crash-reporter.umd.js` for all visitors. When a JavaScript error occurs in a visitor's browser, the error message, a stack trace, the page address without query string and fragment, browser and operating system and the release string are sent to `https://bugd.one/api/crash`.

**3. PHP error tracking (on by default, but only active once a server key is saved)**
When a fatal PHP error or an uncaught exception occurs (and optionally a warning or notice), the plugin sends it from your server to `https://bugd.one/api/v1/crashes` with the server key as authorization. Sent: error message and type, a stack trace with file paths relative to your WordPress folder (no arguments), the page path without query string, request method, PHP and WordPress versions, the active theme, the plugin the error occurred in, whether the request is an admin request, the environment and the release string. Not sent: cookies, POST data, query strings, user names or IP addresses. E-mail addresses, tokens, API keys, passwords in connection strings and home-directory names found in messages are replaced by placeholders.

**4. Test buttons on the settings page**
"Send PHP test error" sends one sample error (as in 3) when an administrator clicks it. "Check widget key" makes one request from your server to `https://bugd.one/api/widget-config` with your publishable key and your site's address (origin) to verify the key and the allowed domains; the answer contains only the project name. Both run only when an administrator clicks the button.

Terms of service: https://bugd.one/agb
Privacy policy: https://bugd.one/datenschutz

If you use the widget or error tracking, mention bugd.one in your privacy policy. The plugin adds suggested text under Settings → Privacy → Policy Guide.

== Installation ==

1. Upload the `bugdone` folder to `/wp-content/plugins/` or install the plugin from the Plugins screen, then activate it.
2. Open Settings → bugd.one and click "Connect with bugd.one". Sign in (or create an account – 7-day free trial), pick or create a project and confirm. Tick "Capture PHP errors" to also receive PHP errors.
3. Click "Check widget key" and, if PHP errors are on, "Send PHP test error". The test crash appears in your bugd.one dashboard under Crashes (filter: development).
4. If you use a page-cache plugin, clear its cache.

Manual setup instead: copy the publishable key and the server key from Project → Settings in bugd.one, paste them on Settings → bugd.one and save. If the check then says "Domain not allowed", add your site's domain under "Allowed domains" in the bugd.one project settings.

== Frequently Asked Questions ==

= Do I have to copy keys? =

No. "Connect with bugd.one" sets up the keys automatically. It works when your admin area runs on the same address as your site; otherwise paste the keys by hand.

= Connecting replaced my server key – why? =

A bugd.one project has one server key. If you tick "Capture PHP errors" for a project that already has a server key, a new one is created and the old one stops working (bugd.one warns you before). Other servers that used the old key need the new one – or leave the option unticked and paste the existing key by hand.

= Where do I find the keys? =

In your bugd.one dashboard under Project → Settings. The publishable key starts with `bk_live_`, the server key with `bk_server_`. Keys are shown once when created; rotate them if you lost one.

= The check says "Domain not allowed". What now? =

In bugd.one open your project → Settings → "Allowed domains" and add your site's domain (for example `https://example.com`). Leave the list empty to allow every domain.

= Which languages does the widget support? =

German, English, French, Spanish, Italian, Portuguese, Dutch and Polish. The widget uses your site language and falls back to English.

= How do I hide the widget on some pages? =

Under Settings → bugd.one → Advanced, enter one path per line (for example `/checkout`). Paths are matched by prefix.

= Is the server key safe? =

It is stored in the WordPress options table like other plugin settings, is never output to the front end and is masked in the settings form. Anyone with database access or administrator rights on your site can read it, so use a dedicated project for each site and rotate the key if you suspect a leak.

= Will this slow down my site? =

No work is done in the normal request path except registering error handlers. Reports are sent only when an error occurs, at the end of the request (after the page has been delivered where the server supports it), with a 2-second timeout, and each error is rate-limited locally.

= Does it work with Query Monitor, Sentry or other error handlers? =

Yes. The plugin chains to previously registered exception and error handlers and never changes WordPress' own error handling.

= Which environment is reported? =

"Automatic" maps `wp_get_environment_type()`: production stays production; staging, development and local are reported as development. You can override it in the settings. Only production events trigger e-mails, webhooks and chat notifications on bugd.one.

= What about page caching? =

If you show the widget only to logged-in users or administrators, make sure your caching plugin does not serve a cached page to other visitors (or exclude logged-in users from the cache).

= Can I use a self-hosted or test endpoint? =

Add `define( 'BUGDONE_API_HOST', 'https://example.com' );` to `wp-config.php` (scheme, host and optional port only). Plain `http://` is accepted only for local development hosts such as `http://localhost:8787`. By default `https://bugd.one` is used.

= How do I remove all data? =

Deleting the plugin removes its settings and temporary data from your database (on multisite from every site of the network). Reports and crashes stored at bugd.one are managed in your bugd.one account.

== Screenshots ==

1. The settings page with status card, connection settings and test buttons.
2. The bug-report widget on your site.
3. A PHP error in the bugd.one dashboard with stack trace and affected plugin.

== Changelog ==

= 1.0.4 =
* New: "Connect with bugd.one" – one-click setup without copying keys. Sign in, pick or create a project, optionally create a server key for PHP errors; your domain is added to the project's allowed domains if the project keeps such a list. Disconnect at any time.
* The status card shows the connected project; a reminder to clear the cache when a page-cache plugin is active.
* Widget (loaded from bugd.one): "Take screenshot" of the visible page with automatic blacking-out of password and payment fields; support requests with photos and voice messages when enabled for the project.
* Privacy policy suggestion and the "External services" section now mention screenshots, photos and voice messages, the connect flow and the data processing agreement.
* Operator name corrected to Mignuti Media.

= 1.0.3 =
* Preparation for the WordPress.org directory: removed the manual translation loader (translations are delivered via translate.wordpress.org), contributor and license metadata.

= 1.0.2 =
* Onboarding: dismissible notice while no project key is set, and a status card with three steps on the settings page showing which keys are set and whether PHP capture is active.
* New "Check widget key" button (verifies the key and the allowed domains) next to "Send PHP test error", with spinner, clear error messages and a link to the dashboard. Tests are disabled while there are unsaved changes.
* A rejected key stays in the field after saving (with an error state).
* Settings: environment, release, position, color, button text moved into a collapsible "Advanced" section; larger touch targets on mobile; shorter descriptions.
* The widget now speaks all eight supported languages (de, en, fr, es, it, pt, nl, pl) based on the site language.
* New options: button style and "Hide widget on these pages".
* Hint when no privacy policy page is set.


= 1.0.1 =
* Error reports are now sent at the end of the request instead of while the page is generated (warnings no longer slow down page rendering).
* Fatal errors are reported before WordPress closes the object cache, so local rate limiting also works with Redis/Memcached.
* Fatal "out of memory" errors can now be reported.
* Better redaction: passwords in connection strings (e.g. mysql://user:pass@host), Authorization headers, well-known API keys and home-directory names; class names like Auth::check are no longer mangled.
* Very long error messages with special characters are no longer rejected by the API.
* Settings: validation notices were shown twice; backslashes in the button text and release were removed; short colors like #fff are now accepted by the widget.
* BUGDONE_API_HOST must be https (http only for local development hosts).
* The "Send test error" button can be used at most every 10 seconds.
* Uninstall on multisite removes the data of every site.

= 1.0.0 =
* First release: bug-report widget, PHP error tracking, optional JavaScript error tracking, environment detection, German translation.

== Upgrade Notice ==

= 1.0.4 =
One-click "Connect with bugd.one", updated privacy texts (screenshots, photos, voice messages).

= 1.0.3 =
Maintenance release, no functional changes.

= 1.0.2 =
Guided setup with status card and connection test, more widget languages and options.

= 1.0.1 =
Reports are sent after the page is delivered, improved redaction and several small fixes.

= 1.0.0 =
First release.
