Skip to main content

For developers

JavaScript​

window.UnysonPlusVI is available on tracked pages.

CallWhat it does
goal( key, value )Counts a goal. Add it first as a custom event goal; unknown keys are ignored. value is optional.
grant()The visitor accepted anonymous statistics: start tracking.
grantStatistics()The visitor accepted statistics: also allows new and returning visitors.
revoke()Withdraw that consent.
optOut() / optIn()Set or clear the visitor's opt-out in this browser.
grantRecording()The visitor accepted session recording.
stopRecording( forget )Stop recording. forget = true deletes the recording too.
module( fn )Add a tracker module. fn receives an API with push(), on(), onFlush(), docHeight(), visible() and itemOk().
// Count a finished calculator, worth 25.00.
UnysonPlusVI.goal('calculator-done', 25);

// Your own consent banner.
acceptButton.addEventListener('click', () => UnysonPlusVI.grant());

Filters and actions​

HookUse
fw_ext_visitor_insights_view_capThe capability needed to see the reports. Default manage_options.
fw_ext_visitor_insights_recordings_capThe capability needed to watch recordings.
fw_ext_visitor_insights_navThe sidebar groups and their views.
fw_ext_visitor_insights_channel_hostsThe site lists that decide the Search, Social and AI assistants channels.
fw_ext_visitor_insights_purge_cacheAction fired when pages should be cleared from a cache. Hook your own cache here.
// Let editors see the reports.
add_filter( 'fw_ext_visitor_insights_view_cap', function () {
return 'edit_pages';
} );

Shortcodes​

[visitor_insights_optout] and [visitor_insights_recording]. See Privacy and consent.

CSS classes for recordings​

ClassEffect
up-vi-maskHides the element's text in recordings
up-vi-blockLeaves the element out of recordings

REST API​

Namespace fw-visitor-insights/v1.

RouteUseAccess
POST /collectThe tracker's fallback collectorPublic, with a page token
GET /heatmap?path&device&days&chHeatmap data for a pageReport viewers
GET /livePage views in the last five minutesReport viewers

How data flows​

  1. The tracker batches events and sends them to a small standalone collector that does not load WordPress, so visits cost your server almost nothing. If that is blocked, it uses POST /collect.
  2. Events wait in per-minute files.
  3. A job every minute sums them into daily tables. Reports only ever read those tables.
  4. A nightly job deletes days past the retention setting and destroys the visitor salt.

The tables are never dropped when the extension is deactivated. For more detail, the AI Dev Kit reference at docs/extensions/visitor-insights.md covers the wire format, the tables and each module.