Client plugin (Nahnu Links Client)
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 ] );
} | Hook | Use |
|---|---|
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#
- Read
apply_filters( 'nlc_site', null ). If it’snull, do nothing. - Send
api.baseandapi.keyto your platform with your other per-site settings, and again onnlc_site_ready. - Record the click ID (from
nahnulinks:clickin the browser, orsessionStorage) with each visit. - Have your platform read links and clicks from the site API, off WordPress, and return
truefromnlc_analytics_nativeso 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.


