Documentation · Use
Reporting from your own code
The plugin sees WordPress, WooCommerce, the form plugins, the HTTP API and the error handler. It cannot see a React form posting to your own REST route, an import job, a call made through a vendor SDK, or an exception you caught. Six ordinary WordPress actions tell it. They are do_action calls, so nothing happens, and nothing breaks, when the plugin is inactive. They are safe to leave in production code.
// A custom form: listed on the Forms tab, placed on its page, monitored and baselined like any form.
// `page_id` or `page` says where it lives when the handler is a REST or AJAX route.
do_action( 'operanse_form_submitted', 'onboarding', array( 'label' => 'Onboarding', 'page_id' => 42 ) );
// The visitor's input was refused: a rejection, never alerted on.
do_action( 'operanse_form_failed', 'onboarding', array( 'error_class' => 'validation', 'errors' => 2 ) );
// The form broke: a failure, which form monitors alert on.
do_action( 'operanse_form_failed', 'onboarding', array( 'error_class' => 'crm_unavailable' ) );
// A business event, with an optional number and a status. Shows on the "Your events" tab.
do_action( 'operanse_event', 'lead.created', array( 'value' => 149.0, 'label' => 'Lead created' ) );
do_action( 'operanse_event', 'quote.requested', array( 'failed' => true ) );
// How long something took, in milliseconds.
do_action( 'operanse_timing', 'import.products', 2350, array( 'failed' => false ) );
// A call to another service the HTTP API did not see: the Integrations tab, by host.
do_action( 'operanse_integration', 'api.stripe.com', 320, array( 'ok' => true, 'status' => 200 ) );
do_action( 'operanse_integration', 'api.acme-crm.com', 10000, array( 'error_class' => 'timeout', 'ok' => false ) );
// A failure you caught, counted with the site's errors. A string or a Throwable.
do_action( 'operanse_error', $exception, array( 'component' => 'acme-crm', 'level' => 'error' ) );What leaves the site is a name, a status, a number, a host, a level and a redacted message: the same things the plugin's own event families carry. Only the arguments listed below are read; nothing else in the array is looked at. The limits are fifty calls per request and fifty custom forms per site. A name reported often enough is proposed as a monitor in the dashboard, which a person confirms.
These are PHP actions, called on the server. A front-end form cannot call them directly: report from the WordPress endpoint that receives its submission.
Names
Form keys, event and timing names and component are lower-cased, every run of characters outside a-z 0-9 . _ : - becomes -, and they are cut to 64 characters, so Lead Created! arrives as lead-created. A name that is empty after that is ignored, and so is the call.
operanse_form_submitted
do_action( 'operanse_form_submitted', string $form_key, array $args = array() );One submission of a form your own code handles. It is listed on the Forms tab, placed on its page, and can be monitored and baselined like a WPForms or Gravity Forms form. Up to five pages per form are remembered.
| Argument | Type | Accepted values | If omitted or invalid |
|---|---|---|---|
$form_key | string | A stable name for the form, such as onboarding. | Required; the call is ignored. After fifty forms a new key still counts site-wide but gets no series of its own. |
'label' | string | Any text, up to 120 characters; redacted. Shown as the form's title. | The key is shown. |
'page_id' | int | The id of the page or post the form is on. | Falls back to 'page'. |
'page' | string | A path (/contact/) or a full address on this site; WordPress resolves it to a page. | The page being served when the hook fires. A REST, AJAX or cron handler serves none, so pass 'page_id' or 'page' there. |
operanse_form_failed
do_action( 'operanse_form_failed', string $form_key, array $args = array() );A submission that did not go through. error_class decides how it counts:
- A rejection: the form refused the visitor's input and is working as intended. Counted as rejected, never baselined or alerted on.
- On the WooCommerce checkout, a declined payment (
payment): counted as a declined payment and watched through payments, never as a form failure. - Anything else: the form accepted the submission and could not process it. Counted as failed, which is what form monitors alert on.
Report the attempt with operanse_form_submitted as well, so the failure rate has a denominator.
| Argument | Type | Accepted values | If omitted or invalid |
|---|---|---|---|
$form_key | string | The same key as operanse_form_submitted. | Required; the call is ignored. |
'error_class' | string | Rejections: validation, validation_failed, acceptance_missing, spam, captcha, honeypot, and any class that starts with validation_, ends in _required or _invalid, or contains captcha, honeypot, turnstile or akismet. Failures: any other name you choose, such as crm_unavailable or mail_failed. Reduced like a name. | validation, a rejection. |
'errors' | int | How many fields failed, at least 1. | 1 |
'label', 'page_id', 'page' | As for operanse_form_submitted. |
operanse_event
do_action( 'operanse_event', string $name, array $args = array() );Something that happened in your business: a lead, a quote, a sync. Counted by name on the "Your events" tab, with its failure share and the sum of its values.
A name that fails at least 90 % of at least 10 times in 30 minutes alerts on its own, like an integration that is down. Once it has 20 reports in a week, the "Your events" tab offers it an importance: marked critical, it alerts at 50 % of at least 5 in 15 minutes; marked ignore, never. For a sync to another service, report every attempt, ok or failed, so the failure share means something. A name that stops being reported altogether is caught by the volume monitor proposed for it, not by this rule.
| Argument | Type | Accepted values | If omitted or invalid |
|---|---|---|---|
$name | string | Such as lead.created. | Required; the call is ignored. |
'value' | number | Any finite number: money, items, rows. Summed per name. | No value is recorded; the event still counts. |
'label' | string | Any text, up to 120 characters; redacted. Shown in place of the name. | The name is shown. |
'failed' | bool | true counts the event as failed, false as ok. Wins over 'status'. | Falls back to 'status'. |
'status' | string | 'failed' or 'ok'. | Any other value, or none, is ok. |
operanse_timing
do_action( 'operanse_timing', string $name, int|float $duration_ms, array $args = array() );How long something of yours took. Shown on the "Your events" tab by name, with its average and slowest duration and failure share.
| Argument | Type | Accepted values | If omitted or invalid |
|---|---|---|---|
$name | string | Such as import.products. | Required; the call is ignored. |
$duration_ms | number | Milliseconds, zero or more. Rounded to 0.1 ms. | Required; a negative, non-numeric or infinite value ignores the call. |
'label', 'failed', 'status' | As for operanse_event. |
operanse_integration
do_action( 'operanse_integration', string $host, int|float $duration_ms, array $args = array() );A call to another service that did not go through the WordPress HTTP API: a vendor SDK, raw cURL, a socket. Recorded exactly like the calls the plugin sees itself, so it appears on the Integrations tab under its host.
| Argument | Type | Accepted values | If omitted or invalid |
|---|---|---|---|
$host | string | A host name (api.stripe.com) or a URL, which is reduced to its host. Nothing else of a URL leaves the site. | Required; anything that is not a valid host name ignores the call. |
$duration_ms | number | Milliseconds, zero or more. | Recorded as 0; the call still counts. |
'status' | int | The HTTP status code. 4xx and 5xx are counted as such. | 0: no response, or not HTTP. |
'ok' | bool | false marks the call failed. | Derived: ok unless 'status' is 400 or more. |
'error_class' | string | Why a call with no HTTP error status failed: timeout, dns, connect, tls or other. Read only when 'ok' is false and 'status' is below 400. | other, including any value not in this list. |
operanse_error
do_action( 'operanse_error', string|Throwable $message, array $args = array() );A failure you caught and handled, counted with the site's other PHP errors.
| Argument | Type | Accepted values | If omitted or invalid |
|---|---|---|---|
$message | string or Throwable | A message, or an exception (recorded as ClassName: message). Redacted and cut to 256 characters. | Required; an empty message ignores the call. |
'level' | string | error, warning or notice. | error, including any value not in this list. |
'component' | string | Which part of your code failed, such as acme-crm; shown where a plugin name would be. | No component. |