Hooks

Analytics

51 hooks fired by Analytics: 44 filters and 7 actions across 51 call sites.

51 hooks fired by Analytics: 44 filters and 7 actions across 51 call sites. 48 of the 51 call sites are described by a docblock, at the call or on the constant that names the hook; the rest are listed with their signature and call sites only. Paths are relative to the plugin directory.

litespeed_purge_all

Action · 0 arguments · 1 call site

do_action( 'litespeed_purge_all' )

Fired from:

  • packages/Analytics/Integrations/CacheCompat.php:304

wp_react_settings_shared_context_initial_values

Filter · 1 argument · 1 call site

applyFilters( 'wp_react_settings_shared_context_initial_values', {} )

Fired from:

  • assets/packages/analytics/admin/screens/Settings.js:228

xpac.analytics.overview.cards

Filter · 2 arguments · 1 call site

Filters the cards other plugins add to the Overview grid.

applyFilters( 'xpac.analytics.overview.cards', [], extensionCtx )
  • cards (Array) — [{ id, title, priority, wide, render }].
  • ctx (Object) — { from, to, compare, seg, query, api, navigate }.

Fired from:

  • assets/packages/analytics/admin/screens/Overview.js:1937

xpac.analytics.toolbar.actions

Filter · 2 arguments · 1 call site

Filters the icon buttons other plugins add to the end of the Overview bar.

applyFilters( 'xpac.analytics.toolbar.actions', [], extensionCtx )
  • actions (Array) — [{ id, label, icon, onClick }].
  • ctx (Object) — { from, to, compare, seg, query, api, navigate }.

Fired from:

  • assets/packages/analytics/admin/screens/Overview.js:1940

xpac_agent_tool_enabled

Filter · 2 arguments · 1 call site

Filters whether one XPAC tool may register as an ability.

XPAC Agent answers from its switches under XPAC → AI Agent → Tools, bound at priority 1. While the XPAC Agent plugin is not active nothing answers, and the default leaves every Analytics ability unregistered.

apply_filters( 'xpac_agent_tool_enabled', false, self::NAMESPACE . '/' . $name )
  • $enabled (bool) — Default false.
  • $name (string) — The full ability name, such as xpac-analytics/traffic-summary.

Fired from:

  • packages/Analytics/Abilities/Abilities.php:152

xpac_analytics_abilities

Filter · 1 argument · 1 call site

Filters which Analytics abilities are registered for AI agents.

Asked whenever Analytics reads which of its tools are on: when the Abilities API registers abilities and when Agent builds its instructions. Names are the part after xpac-analytics/, such as traffic-summary. One left out is not registered at all, so no REST route, MCP server or WordPress AI feature can call it. The default is what XPAC Agent's switches allow, which is none while Agent is switched off or not installed. One added here is registered for the Abilities API and WordPress's AI features, but Agent's chat and MCP server still offer only what its switches allow.

apply_filters( 'xpac_analytics_abilities', $allowed )
  • $abilities (string[]) — Ability names. Default the ones XPAC Agent's switches allow.

Fired from:

  • packages/Analytics/Abilities/Abilities.php:172

xpac_analytics_admin_integrations

Filter · 1 argument · 1 call site

Filters normalized Analytics admin integrations.

apply_filters( 'xpac_analytics_admin_integrations', $integrations )
  • $integrations (array<int, array<string, mixed>>) — Integrations.

Fired from:

  • packages/Analytics/Admin/Rest.php:292

xpac_analytics_allowed_events

Filter · 1 argument · 1 call site

Filters the event names the public route accepts.

apply_filters( 'xpac_analytics_allowed_events', Events::names() )
  • $names (string[]) — Catalogue names.

Fired from:

  • packages/Analytics/DataLayer.php:408

xpac_analytics_allowed_source_hosts

Filter · 1 argument · 1 call site

Filters the page hosts intake accepts as this site.

apply_filters( 'xpac_analytics_allowed_source_hosts', array_values(array_unique($allowedHosts)) )
  • $hosts (string[]) — Hostnames.

Fired from:

  • packages/Analytics/DataLayer.php:756

xpac_analytics_cache_purgers

Filter · 1 argument · 1 call site

Filters the page caches Analytics offers to purge after a tracking setting changes.

apply_filters( 'xpac_analytics_cache_purgers', $purgers )
  • $purgers (array<string,callable>) — Callbacks keyed by the cache's name.

Fired from:

  • packages/Analytics/Integrations/CacheCompat.php:333

xpac_analytics_client_ip

Filter · 1 argument · 1 call site

Filters the address first-party analytics identifies a visitor by.

apply_filters( 'xpac_analytics_client_ip', Proxy::clientIp() )
  • $ip (string) — Resolved address.

Fired from:

  • packages/Analytics/Core/Intake/Identity.php:52

xpac_analytics_delivery_summary

Filter · 3 arguments · 1 call site

Filters a delivery summary before it is stored or shown.

The add-on that produced the result words its own failures here. For an administrator's test it may add notes (sentences) and links ({label, url} pairs) that the Tools screen shows under the result.

apply_filters( 'xpac_analytics_delivery_summary', $summary, $result, $diagnostic )
  • $summary (array<string,mixed>) — Summary: status, message, httpStatus, eventID, eventTimestamp.
  • $result (mixed) — The raw result the destination returned.
  • $diagnostic (bool) — Whether this was a test event.

Fired from:

  • packages/Analytics/Admin/DeliveryHealth.php:108

xpac_analytics_digest_context

Filter · 2 arguments · 1 call site

Filters the values the traffic report email is rendered with.

apply_filters( 'xpac_analytics_digest_context', $context, $kind )
  • $context (array) — Template values, already formatted for print.
  • $kind (string) — weekly, monthly or test.

Fired from:

  • packages/Analytics/Admin/Digest.php:361

xpac_analytics_email_template

Filter · 3 arguments · 1 call site

Filters the file one Analytics email template is rendered from.

Asked after the theme and the packaged copy were looked up, so it wins over both. Names: digest, stopped and alert, each suffixed -html or -text, plus wrapper-html and wrapper-text.

apply_filters( 'xpac_analytics_email_template', $path, $name, $context )
  • $path (string) — Absolute path resolved so far.
  • $name (string) — Template name without the .php extension.
  • $context (array) — Values the template is handed.

Fired from:

  • packages/Analytics/Admin/Digest.php:757

xpac_analytics_event_catalog

Filter · 1 argument · 1 call site

Filters the provider-neutral event catalogue.

A tool adding an event should publish a label, category, description, trigger and scalar property names. The DataLayer will accept the event and its declared properties after normal validation.

apply_filters( 'xpac_analytics_event_catalog', $catalog )
  • $catalog (array<string, array<string, mixed>>) — Event definitions.

Fired from:

  • packages/Analytics/Events.php:119

xpac_analytics_event_data_keys

Filter · 1 argument · 1 call site

Filters the scalar properties kept from public event data.

apply_filters( 'xpac_analytics_event_data_keys', array_values(array_unique(array_merge(self::EVENT_DATA_KEYS, Events::propertyKeys()))) )
  • $keys (string[]) — Property names.

Fired from:

  • packages/Analytics/DataLayer.php:542

xpac_analytics_event_data_sanitizers

Filter · 1 argument · 1 call site

Filters the per-property validators applied to public event data.

Keyed by property name; each value takes ($value, $key) and returns a scalar to store, or anything non-scalar to drop the property. Only consulted for properties Core has no validator of its own for.

apply_filters( 'xpac_analytics_event_data_sanitizers', self::$sanitizers )
  • $sanitizers (array<string,callable>) — Registered validators.

Fired from:

  • packages/Analytics/DataLayer.php:555

xpac_analytics_event_route_prefixes

Filter · 2 arguments · 1 call site

Filters the per-channel settings-key prefixes for one settings page.

The add-on that owns the page names its own prefixes and the keys it protects. It may add_filter this unconditionally: an older Core never calls it.

apply_filters( 'xpac_analytics_event_route_prefixes', [], $page )
  • $routes (array{browser?:string,server?:string,protected?:string[]}) — Empty by default.
  • $page (string) — Settings page name.

Fired from:

  • packages/Analytics/Admin/SettingsRest.php:113

xpac_analytics_first_party_enabled

Filter · 1 argument · 1 call site

Whether Core keeps its own first-party record of this site's traffic.

apply_filters( 'xpac_analytics_first_party_enabled', true )
  • $enabled (bool) — Enabled.

Fired from:

  • packages/Analytics/Core/Store/Recorder.php:83

Filter · 2 arguments · 1 call site

Whether the first-party record waits for statistics consent.

apply_filters( 'xpac_analytics_first_party_requires_consent', self::requiresConsent(), $event )
  • $required (bool) — Whether consent is required.
  • $event (array<string,mixed>) — The event being recorded.

Fired from:

  • packages/Analytics/Core/Store/Recorder.php:244

xpac_analytics_first_party_write_failed

Action · 2 arguments · 1 call site

A first-party write failed and was swallowed.

do_action( 'xpac_analytics_first_party_write_failed', $error, $event )
  • $error (\Throwable) — The failure.
  • $event (array<string,mixed>) — The event.

Fired from:

  • packages/Analytics/Core/Store/Recorder.php:169

xpac_analytics_geo_database_path

Filter · 1 argument · 1 call site

Filters the IP database Analytics reads.

apply_filters( 'xpac_analytics_geo_database_path', $path )
  • $path (string) — Absolute path of a MaxMind DB format file, or '' for none.

Fired from:

  • packages/Analytics/Core/Intake/GeoDatabase.php:183

xpac_analytics_geo_download_timeout

Filter · 2 arguments · 1 call site

Filters how long the location database download may take, in seconds.

apply_filters( 'xpac_analytics_geo_download_timeout', self::TYPE_CITY === $type ? 600 : 120, $type )
  • $timeout (int) — Seconds.
  • $type (string) — country or city.

Fired from:

  • packages/Analytics/Core/Intake/GeoDatabase.php:483

xpac_analytics_geo_download_url

Filter · 3 arguments · 1 call site

Filters where the location database is downloaded from.

apply_filters( 'xpac_analytics_geo_download_url', $url, $type, $month )
  • $url (string) — A gzipped MaxMind DB format file.
  • $type (string) — country or city.
  • $month (string) — Year and month of the release, e.g. 2026-10.

Fired from:

  • packages/Analytics/Core/Intake/GeoDatabase.php:475

xpac_analytics_identity_keys

Filter · 1 argument · 1 call site

Filters the event properties dropped when statistics consent is denied.

Destination add-ons list the identifiers they contribute.

apply_filters( 'xpac_analytics_identity_keys', [] )
  • $keys (string[]) — Property names.

Fired from:

  • packages/Analytics/Modules/Privacy.php:287

xpac_analytics_index_build_threshold

Filter · 1 argument · 1 call site

Rows in any detail table above which a schema upgrade builds its indexes from cron.

apply_filters( 'xpac_analytics_index_build_threshold', Upgrade::THRESHOLD )
  • $threshold (int) — Row estimate.

Fired from:

  • packages/Analytics/Core/Database/Installer.php:341

xpac_analytics_init

Action · 0 arguments · 1 call site

Fires once Analytics is ready to be extended.

do_action( 'xpac_analytics_init' )

Fired from:

  • packages/Analytics/Bootstrap.php:588

xpac_analytics_inline_js_data

Filter · 1 argument · 1 call site

apply_filters( 'xpac_analytics_inline_js_data', [] )

Fired from:

  • packages/Analytics/Bootstrap.php:279

xpac_analytics_intake_route

Filter · 1 argument · 1 call site

Filters the per-site intake route. Return an empty array to post to xpac/v1/analytics/track instead.

apply_filters( 'xpac_analytics_intake_route', $stored ? [ 'namespace' => (string) $stored['namespace'], 'route' => (string) $stored['route'], ] : [] )
  • $route (array{namespace:string,route:string}|array{}) — Namespace and path.

Fired from:

  • packages/Analytics/DataLayer.php:199

xpac_analytics_internal_hosts

Filter · 1 argument · 1 call site

Hosts treated as this site for referrer purposes, for a site served from more than one hostname.

apply_filters( 'xpac_analytics_internal_hosts', [$home] )
  • $hosts (string[]) — Hostnames.

Fired from:

  • packages/Analytics/Core/Store/Referrers.php:153

xpac_analytics_new_rows_per_hour

Filter · 2 arguments · 1 call site

Filters how many new rows of one kind the intake may create per hour.

apply_filters( 'xpac_analytics_new_rows_per_hour', self::DEFAULT_LIMIT, $kind )
  • $limit (int) — Rows per hour.
  • $kind (string) — resources or referrers.

Fired from:

  • packages/Analytics/Core/Store/NewRows.php:46

xpac_analytics_owned_options

Filter · 1 argument · 1 call site

Options removed when the site has opted into first-party data removal.

apply_filters( 'xpac_analytics_owned_options', array_merge(self::OWNED_OPTIONS, self::OPTIONS, self::FEATURE_OPTIONS) )
  • $options (string[]) — Option names.

Fired from:

  • packages/Analytics/Core/Database/Schema.php:144

xpac_analytics_page_context

Filter · 1 argument · 1 call site

Filters page context sent with every captured event.

apply_filters( 'xpac_analytics_page_context', $resolved )
  • $context (array<string,mixed>) — Public page metadata. Avoid personal information.

Fired from:

  • packages/Analytics/Modules/Capture.php:316

xpac_analytics_pre_geo

Filter · 2 arguments · 1 call site

Short-circuits the location lookup for a new visit.

Return an array with country (ISO 3166-1 alpha-2) and optionally region, city and source to use it, or null to look it up.

apply_filters( 'xpac_analytics_pre_geo', null, $timeZone )
  • $location (array|null) — Null to let Analytics look it up.
  • $timeZone (string|null) — The browser's time zone, when sent.

Fired from:

  • packages/Analytics/Core/Intake/Geo.php:164

xpac_analytics_privacy_policy_content

Filter · 1 argument · 1 call site

Filters the privacy policy text Analytics suggests under Settings → Privacy.

apply_filters( 'xpac_analytics_privacy_policy_content', $text )
  • $text (string) — Suggested HTML.

Fired from:

  • packages/Analytics/Modules/Privacy.php:448

xpac_analytics_rate_limit

Filter · 1 argument · 1 call site

Filters how many intake requests one address and user agent may make per window; 0 disables the limit.

apply_filters( 'xpac_analytics_rate_limit', 300 )
  • $limit (int) — Default 300.

Fired from:

  • packages/Analytics/DataLayer.php:839

xpac_analytics_rate_limit_address

Filter · 1 argument · 1 call site

Filters how many intake requests one address may make per window, whatever the user agent; 0 disables this limit. Raise it for a site whose visitors share one address that Proxy cannot see past.

apply_filters( 'xpac_analytics_rate_limit_address', 1500 )
  • $limit (int) — Default 1500.

Fired from:

  • packages/Analytics/DataLayer.php:847

xpac_analytics_rate_window

Filter · 1 argument · 1 call site

Filters the rate-limit window in seconds.

apply_filters( 'xpac_analytics_rate_window', MINUTE_IN_SECONDS )
  • $seconds (int) — Default 60.

Fired from:

  • packages/Analytics/DataLayer.php:853

xpac_analytics_redact

Filter · 1 argument · 1 call site

Filters a value on its way into first-party storage.

apply_filters( 'xpac_analytics_redact', trim($value) )
  • $value (string) — Redacted value.

Fired from:

  • packages/Analytics/Core/Intake/Redact.php:56

xpac_analytics_referrer_spam

Filter · 2 arguments · 1 call site

Filters whether a referring host counts as referrer spam, whose visits are not recorded.

apply_filters( 'xpac_analytics_referrer_spam', $listed, $host )
  • $listed (bool) — Whether the host or a domain above it is on the list.
  • $host (string) — The referring host, lower case.

Fired from:

  • packages/Analytics/Core/Store/ReferrerSpam.php:621

xpac_analytics_remove_data_on_uninstall

Filter · 1 argument · 1 call site

Filters whether uninstalling Analytics deletes its own settings and cached state.

True by default. The first-party report tables answer to xpac_analytics_remove_reports_on_uninstall instead. Add the filter from an mu-plugin: the plugin is already deactivated when this runs.

apply_filters( 'xpac_analytics_remove_data_on_uninstall', true )
  • $remove (bool) — Whether to delete the settings and cached state.

Fired from:

  • packages/Analytics/Bootstrap.php:485

xpac_analytics_remove_reports_on_uninstall

Filter · 1 argument · 1 call site

Whether uninstall deletes Core's first-party tables.

Separate from xpac_analytics_remove_data_on_uninstall, which governs the shared settings row.

apply_filters( 'xpac_analytics_remove_reports_on_uninstall', $optedIn )
  • $remove (bool) — Whether to drop the tables and options.

Fired from:

  • packages/Analytics/Core/Retention.php:99

xpac_analytics_reports_pruned

Action · 2 arguments · 1 call site

A retention pass finished.

do_action( 'xpac_analytics_reports_pruned', $removed, $cutoff )
  • $removed (array<string,int>) — Table => rows removed.
  • $cutoff (string) — The visit-details window's oldest kept timestamp, '' when kept forever.

Fired from:

  • packages/Analytics/Core/Retention.php:237

xpac_analytics_reserved_event_names

Filter · 1 argument · 1 call site

Filters the event names refused because a destination keeps a setting under that suffix.

apply_filters( 'xpac_analytics_reserved_event_names', ['id', 'enabled'] )
  • $names (string[]) — Lower-case suffixes.

Fired from:

  • packages/Analytics/Events.php:148

xpac_analytics_schema_installed

Action · 1 argument · 1 call site

The first-party schema is present and current.

do_action( 'xpac_analytics_schema_installed', $synced )
  • $synced (string[]) — Columns and indexes added to existing tables.

Fired from:

  • packages/Analytics/Core/Database/Installer.php:113

xpac_analytics_segment_cap

Filter · 1 argument · 1 call site

Filters how many visits a filter may match before its report refuses the range; the default is 250,000.

The number compared is the estimate counted in _sessions before any view or event is copied, so the cap bounds the temporary tables every segment read builds: the filtered dashboard, a details table under a filter or of a detail-only dimension, the filtered visits log (which refuses what the dashboard refuses for the same chip, even where it reads in place) and the goal report under a filter. Above it the route answers xpac_analytics_cap (400) with the suggest_days the cap would allow. Raise it when the database copies a larger segment well inside the 5 s statement budget; lower it to refuse sooner on a small one. Values below 1 read as 1.

apply_filters( 'xpac_analytics_segment_cap', self::CAP )
  • $cap (int) — Visits. Default 250000 (Segment::CAP).

Fired from:

  • packages/Analytics/Core/Reports/Segment.php:326

xpac_analytics_tables_renamed

Action · 1 argument · 1 call site

Analytics tables were moved off the old xpac_analytics_ prefix.

do_action( 'xpac_analytics_tables_renamed', $moved )
  • $tables (string[]) — Tables renamed, by their new name.

Fired from:

  • packages/Analytics/Core/Database/Legacy.php:38

xpac_analytics_track

Action · 1 argument · 1 call site

Fires once an event passed validation. Destinations schedule delivery from here.

do_action( 'xpac_analytics_track', $event )
  • $event (array<string,mixed>) — Validated event.

Fired from:

  • packages/Analytics/DataLayer.php:524

xpac_analytics_track_event

Filter · 2 arguments · 1 call site

Filters a validated analytics event before provider extensions receive it.

apply_filters( 'xpac_analytics_track_event', $event, $request )
  • $event (array<string,mixed>) — Validated event.
  • $request (WP_REST_Request) — Source request.

Fired from:

  • packages/Analytics/DataLayer.php:514

xpac_analytics_track_visitor

Filter · 1 argument · 1 call site

Filters whether the Analytics runtime is loaded for this request.

apply_filters( 'xpac_analytics_track_visitor', $allowed )
  • $allowed (bool) — Whether the visitor is tracked.

Fired from:

  • packages/Analytics/Bootstrap.php:368

xpac_analytics_trusted_proxies

Filter · 1 argument · 1 call site

Networks whose forwarded-for headers may be believed; anything not listed is treated as a visitor.

apply_filters( 'xpac_analytics_trusted_proxies', array_merge(self::CLOUDFLARE, self::configuredRanges()) )
  • $ranges (string[]) — CIDR ranges.

Fired from:

  • packages/Analytics/Core/Intake/Proxy.php:318

On this page

litespeed_purge_allwp_react_settings_shared_context_initial_valuesxpac.analytics.overview.cardsxpac.analytics.toolbar.actionsxpac_agent_tool_enabledxpac_analytics_abilitiesxpac_analytics_admin_integrationsxpac_analytics_allowed_eventsxpac_analytics_allowed_source_hostsxpac_analytics_cache_purgersxpac_analytics_client_ipxpac_analytics_delivery_summaryxpac_analytics_digest_contextxpac_analytics_email_templatexpac_analytics_event_catalogxpac_analytics_event_data_keysxpac_analytics_event_data_sanitizersxpac_analytics_event_route_prefixesxpac_analytics_first_party_enabledxpac_analytics_first_party_requires_consentxpac_analytics_first_party_write_failedxpac_analytics_geo_database_pathxpac_analytics_geo_download_timeoutxpac_analytics_geo_download_urlxpac_analytics_identity_keysxpac_analytics_index_build_thresholdxpac_analytics_initxpac_analytics_inline_js_dataxpac_analytics_intake_routexpac_analytics_internal_hostsxpac_analytics_new_rows_per_hourxpac_analytics_owned_optionsxpac_analytics_page_contextxpac_analytics_pre_geoxpac_analytics_privacy_policy_contentxpac_analytics_rate_limitxpac_analytics_rate_limit_addressxpac_analytics_rate_windowxpac_analytics_redactxpac_analytics_referrer_spamxpac_analytics_remove_data_on_uninstallxpac_analytics_remove_reports_on_uninstallxpac_analytics_reports_prunedxpac_analytics_reserved_event_namesxpac_analytics_schema_installedxpac_analytics_segment_capxpac_analytics_tables_renamedxpac_analytics_trackxpac_analytics_track_eventxpac_analytics_track_visitorxpac_analytics_trusted_proxies