Filters and the data layer reference
In the plugin: Tracking Nexus → Platforms → Google Tag Manager
On this page
This is the complete list of hooks Tracking Nexus fires, followed by what it pushes to the data layer. Hook names start with tracking_nexus_. Anything not listed here isn't a supported extension point.
Actions
| Hook | Arguments | What it does |
|---|---|---|
tracking_nexus_track |
string $name, array $params = array() |
Your code fires it to send a custom event. See Track custom events in code. Available when the Custom events feature is on. |
tracking_nexus_consent_saved |
string $id, array $saved |
Fires after a visitor's consent decision is stored or changed. $id is the hashed context identifier and $saved the stored row. |
Filters
| Filter | Arguments | Returns and effect |
|---|---|---|
tracking_nexus_consent_plugins |
string[] $found |
The active plugins treated as cookie banners, as folder/file.php. Remove one that isn't a banner; more than one pauses tracking. |
tracking_nexus_exclude_user |
bool $excluded, WP_User $user |
Whether a signed-in user is left out of tracking. Starts true when one of their roles is excluded. |
tracking_nexus_is_bot |
bool $bot, string $agent |
Whether a user agent counts as a bot (never tracked). |
tracking_nexus_environment |
string $type |
The environment type used to pause tracking outside production. Starts as wp_get_environment_type(). |
tracking_nexus_feature_missing |
string $missing, string $feature |
The name of a plugin a feature still needs, or an empty string when it can run. |
tracking_nexus_dev_site |
bool $dev, string $host |
Whether the site counts as a staging or development site for the licence. It can only turn that off: a live address never becomes a development site. |
tracking_nexus_trusted_proxies |
array $ranges (empty) |
Extra proxy or CDN address ranges in CIDR form, such as 192.0.2.0/24, so request limits count the visitor they forward and not the proxy. |
tracking_nexus_rate_limit |
int $limit, string $bucket |
A request limit of the public tracking routes. A value of 0 or less refuses everything in that bucket. Buckets: new_context_conn, new_context_ip, new_context, context, collect_ip, collect_conn, prepare_ip, prepare_conn, prepare, converting_ip, converting_conn, converting. |
tracking_nexus_new_context_limit |
int $limit |
Applied after the filter above, only for the site-wide new_context bucket (new visitors per minute). Kept for sites that set it before. |
tracking_nexus_visitor_country |
string $country |
The visitor's country as an ISO 3166-1 alpha-2 code, or an empty string when unknown. Starts from a Cloudflare or CloudFront header. |
tracking_nexus_hide_other_notices |
bool $hide (true) |
Return false to let other plugins' admin notices show on Tracking Nexus pages. |
// Raise the per-address new-visitor limit (default 120 a minute).
add_filter( 'tracking_nexus_rate_limit', function ( $limit, $bucket ) {
return 'new_context_ip' === $bucket ? 400 : $limit;
}, 10, 2 );
Browser API
| Name | Use |
|---|---|
TrackingNexus.track( name, params ) |
Sends a custom event; returns the event ID or ''. |
TrackingNexus.consent( choice ) |
Reports a visitor's choice when consent is set to My own code. |
TrackingNexus.status() |
Returns { ready, analytics, marketing, ad_user_data, ad_personalization }. |
window.tnq.push( [ name, params ] ) |
The same as track(); usable before the script has loaded. |
tracking-nexus:lead (window event) |
Fired once a lead has been sent from the browser. event.detail holds event_id, form_id and source. |
The data layer
With the Data layer feature on, the plugin pushes to dataLayer (or the name you chose on the Google Tag Manager page; if the page already uses that name for something that isn't an array, dataLayer is used). Each group is switched on separately on that page, and nothing is pushed before the visitor allows analytics or advertising.
Groups
| Group | What it adds |
|---|---|
| Page | type, id, post_type, title, language |
| Categories and tags | terms (up to 10), or term on an archive |
| Author | author (off by default) |
| Dates | published, modified as YYYY-MM-DD (off by default) |
| Site search | search, search_results; a term that looks like an email address or phone number is dropped |
| Visitor | logged_in, role |
| Campaign | campaign and first_campaign: UTM tags, landing page and referrer. Click IDs only when advertising matching is allowed. |
| Product (WooCommerce) | ID, SKU, name, price, currency, stock status and category on product pages |
| Customer (WooCommerce) | orders and total_spent for signed-in customers, after analytics consent (off by default) |
| Hashed email | email_hash: a signed-in visitor's SHA-256 hashed email, only when advertising matching is allowed (off by default) |
| Events | Every tracked event, as below |
| Leads and purchases | tn_lead and the GA4-style purchase event |
What is pushed
| Push | Shape |
|---|---|
| Page facts | { event: 'tn_page', event_id, tn_page: { …page facts } } once per page |
| Signed-in visitor | { event: 'tn_visitor', tn_visitor: { customer: { orders, total_spent }, email_hash } }, fetched after consent and never printed in the page |
| Lead | { event: 'tn_lead', value, currency, form_id, source, lead_type, event_id, details?, fields? }. details holds what the form's details setting gives. fields appears only when you chose field names or values for that form. A lead sent through Tag Manager also has tn_routes. |
| Purchase and shop events | A { ecommerce: null } push, then { event: 'purchase' (or 'view_item', 'add_to_cart', …), event_id, ecommerce: { … } } |
| Other tracked events | { event: 'tn_scroll' (the event key with a , after a { tn: null } push. Your own custom events use your name with no prefix. |
Questions
Which filters does Tracking Nexus offer?
Eleven filters and two actions, all listed above. Hooks not on this page are not supported.
How do I stop a plugin being treated as a cookie banner?
Tick it under Do these plugins show a cookie banner? in Consent & privacy, or remove it in the tracking_nexus_consent_plugins filter.
Why is nothing in my data layer?
The Data layer feature must be on, the group must be selected on the Google Tag Manager page, and the visitor must have allowed analytics or advertising.
How do I let a CDN's visitors be counted separately?
List the CDN's address ranges with the tracking_nexus_trusted_proxies filter. The plugin already knows Cloudflare and Amazon CloudFront.
Last updated 27 November 2026