N Docs
← Back to site

Client plugin (Nahnu Links Client)

2 min readUpdated November 23, 2026

For analytics plugins on a client’s site. The filters answer null when the client plugin isn’t installed or connected, so there’s nothing to check first.

$nl = apply_filters( 'nlc_site', null );
if ( $nl ) {
    $links = apply_filters( 'nlc_site_api', null, 'links', [ 'updated_after' => $last_sync ] );
}
HookUse
nlc_site (filter)This website’s details: version, site, click_param, bridge, bridge_url, track_event, api (base and key), or null.
nlc_site_api (filter)null, $path, $query. Calls the site API ('', 'links', 'clicks', 'click/{id}') with this website’s key and gives the answer, a WP_Error, or null. A refused key is replaced once by itself.
nlc_site_ready (action)$site, when the website gets its site key.
nlc_analytics_native (filter)Return true when your plugin records short link visits itself, so the bridge doesn’t call NahnuAnalytics.track() too.
nlc_site_domain (filter)The website’s domain, without www.
nlc_bridge_enabled (filter)Return false to leave the bridge script off a page.
nlc_bridge_attributes (filter)The bridge <script> tag’s attributes.
{ "version": "1.0.0", "site": "shop.com", "click_param": "nlc", "bridge": true, "bridge_url": "https://api.yourbrand.com/_nl/bridge.js", "track_event": null, "api": { "base": "https://api.yourbrand.com", "key": "nlsk_…" } }

When to use these#

Use these hooks when your plugin runs on a client’s website, next to Nahnu Links Client. For code on your own dashboard site, use the Nahnu Links functions instead.

A native integration in four steps#

  1. Read apply_filters( 'nlc_site', null ). If it’s null, do nothing.
  2. Send api.base and api.key to your platform with your other per-site settings, and again on nlc_site_ready.
  3. Record the click ID (from nahnulinks:click in the browser, or sessionStorage) with each visit.
  4. Have your platform read links and clicks from the site API, off WordPress, and return true from nlc_analytics_native so the bridge stops sending its own event.

The client plugin includes a full guide at docs/nahnu-analytics-integration.md. See also Developer hooks in the client docs.