Docs
← Back to site

Events, filters and actions

2 min readUpdated November 11, 2026

Record your own events from PHP or the browser, and change or drop what the connector sends with filters.

From PHP#

Records an event for the current visitor. From a webhook or cron, pass ip and user_agent too.

nahnu_analytics_track( 'Lead won', array(
	'props'   => array( 'plan' => 'pro' ),
	'revenue' => array( 'amount' => 490, 'currency' => 'USD' ),
) );

// The same, without checking that the plugin is active:
do_action( 'nahnu_analytics_track', 'Lead won', array( 'props' => array( 'plan' => 'pro' ) ) );

The event shows in the website’s Goals & events card with its revenue; pick a property under Properties to break it down.

A server-side Lead won event with its revenue in Goals & events, broken down by its plan property

In the browser#

In markup#

data-k-event="Name" on a link or button, with data-k-p-<prop>="value" for properties.

Filters#

FilterUse it to
nahnu_analytics_connector_eventChange or drop any event before it is sent
nahnu_analytics_connector_inline_jsAdd your own form plugin’s success event (f(name, options) records one)
nahnu_analytics_connector_skipLeave a request out: no snippet, no events
nahnu_analytics_connector_consent_essentialReturn false to ask consent tools for consent first
nahnu_analytics_connector_stats_capWho sees the Stats item (default manage_options)
nahnu_analytics_connector_purchaseThe WooCommerce Purchase event
nahnu_analytics_connector_surecart_purchase, nahnu_analytics_connector_surecart_testSureCart’s Purchase event; count test mode
nahnu_analytics_connector_store_purchase, nahnu_analytics_connector_store_testFluentCart and Easy Digital Downloads: the Purchase event (null leaves it out); count test mode
nahnu_analytics_connector_store_currencyAn order’s revenue in the store’s currency, for another multi-currency plugin
nahnu_analytics_connector_trust_proxy, nahnu_analytics_connector_is_proxy, nahnu_analytics_connector_client_ipWhich forwarding headers are believed; whether the connecting address is a trusted proxy; the visitor address sent
nahnu_analytics_connector_upstreamWhere forwarded visits and the script come from
nahnu_analytics_connector_indexnow_public, nahnu_analytics_connector_indexnow_endpointWhether this site’s address may go to IndexNow; the IndexNow address
nahnu_analytics_connector_history_jetpackGive Jetpack Stats’ answers instead of asking WordPress.com

Example: a form plugin of your own.

Action#

nahnu_analytics_connector_event_sent fires after each event is sent.

Goals, funnels and journeys are set up in Nahnu Analytics (or its REST API), not in the connector.

Was this helpful?