Description
This plugin is an alternative to the subdomain CNAME (custom_collection_domain, configured via
aat_console) for clients whose Content-Security-Policy blocks aat.newad.com.br. Instead of
depending on the client’s own DNS team, the plugin runs inside WordPress itself: it injects the
nwd_aat_tag.js tag pointing to the site’s own REST routes and proxies collection
server-to-server to Newad’s real service. Since the visitor’s request never leaves the client’s
domain, no CSP rule applies to it.
The plugin does not replace the tag — nwd_aat_tag.js is fetched from the upstream at runtime
and served verbatim, cached. Funnel classification stays entirely on Newad’s backend; the plugin
is a pure byte proxy.
REST routes created (namespace newad-aat/v1):
GET /wp-json/newad-aat/v1/collect— relaysd/debugto/v1/collectupstream.GET /wp-json/newad-aat/v1/tag.js— servesnwd_aat_tag.js, cached (1-hour transient plus a
persistent “last good” fallback).GET /wp-json/newad-aat/v1/banner.js— serves the Newad Consent Manager cookie notice,
cached, only when enabled in the plugin’s settings.GET /wp-json/newad-aat/v1/proof— relays the visitor’s consent choice upstream, only when
the Newad Consent Manager is enabled.
All four routes are public and unauthenticated — the same public surface the real upstream
endpoints already have (they don’t require authentication either, since that’s a hard
requirement for working as a tracking tag/pixel).
Admin screen (Settings Newad AdTracking):
- Required “Site code” field (the advertiser’s code at Newad) — while it’s empty, no tag is
injected. collect_alltoggle (mirrorswindow.nwdAatConfig.collect_all).- “Test installation” button — confirms server-side whether a collection event has arrived.
- “Scan this site” button — looks for an old, hand-pasted Newad tag on the homepage and in the
active theme’s files, and reports the file and line. Read-only; it never modifies the site. - Read-only catalog of suggested selectors for WooCommerce, Contact Form 7 and Gravity Forms
(plus a notice for Elementor), to paste as a scenario in the Newad console.
External services
This plugin is the transport layer for the Newad AAT tag — it only exists to talk to Newad’s
service at https://aat.newad.com.br (operated by Newad, hired by this site’s administrator).
The destination is hard-coded in the plugin: no setting, URL parameter or filter can change it.
The plugin makes 4 calls to that service, all through wp_remote_get():
- On every site visit (public route
GET /wp-json/newad-aat/v1/collect, triggered by the
tag in the visitor’s browser): relays the event payload the tag already generated — page
visited, referrer, campaign parameters (UTM/click) and a pseudonymous visitor identifier
(nwd_uid, generated by the tag itself; never a name, email or ID document). The plugin does
not read or alter this payload, it only retransmits it. - When the tag script and the cookie notice load (
/tag.jsand/banner.jsroutes, cached
for up to 1 hour): fetches the files published by Newad. The only data sent is the “Site code”
filled in on the plugin’s settings screen — it identifies the client’s account at Newad, not
the visitor. - When a choice is recorded on the cookie notice (
/proofroute, only when the Newad
Consent Manager is enabled): relays the visitor’s choice (accepted/rejected categories and
notice version) as proof of consent. - The “Test installation” button (admin screen, triggered manually by whoever administers
the site) queries the upstream to confirm whether a collection event has arrived.
Privacy policy: https://aat.newad.com.br/privacy/advanced-adtracking
Terms of use: https://aat.newad.com.br/terms/advanced-adtracking
Installation
- Upload the
.zipfile under Plugins Add New Upload Plugin. - Activate the plugin.
- Go to Settings Newad AdTracking and paste the site code from Newad’s installation guide.
- Use the “Test installation” button after a real visit to the site.
FAQ
-
There’s already a Newad tag pasted into the theme. Do I need to remove it before installing the plugin?
-
No. The plugin publishes
window.nwdAatConfigas a locked property: the old tag can no longer
override the collection endpoint and becomes inert (no duplicate events). Use “Scan this site” to
see where it lives and remove it whenever convenient. An old tag living inside a Google Tag
Manager container stays in the container and the plugin can’t see it. -
Does this replace the `nwd_aat_tag.js` tag?
-
No. The tag is fetched from the upstream at runtime and served verbatim — the plugin only
changes the transport (same-origin instead of cross-origin), never the tag’s content or
behavior. -
Does the plugin decide what counts as consent?
-
No. Consent decisions are made by the Newad Consent Manager, when it’s enabled, or by the site’s
own CMP — the tag reads Google Consent Mode v2 fromdataLayeron its own. The plugin only
relays the cookie notice script and the visitor’s resulting choice; it never interprets or
decides what is or isn’t allowed. -
Does it work with `/v1/imp` (publisher impression pixel)?
-
That’s not this plugin’s use case —
/v1/impis for the publisher’s page (RTB), not for the
advertiser’s WordPress site.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“Newad Advanced AdTracking” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Newad Advanced AdTracking” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.2.1
- Settings screen: the JavaScript now ships as a static file loaded with
wp_enqueue_script()
instead of an inline<script>block. - Plugin header: the description is a single, complete line.
1.2.0
- Newad Consent Manager: relays the cookie notice and the proof of choice through the site
itself.
1.1.0
- The tag’s config is now published locked (
Object.defineProperty): an old manual snippet,
before or after the plugin, no longer overrides the collection endpoint. - New “Scan this site” button: finds the old tag in the HTML and theme files (read-only) and
runs on its own the first time the admin screen opens after activation.
1.0.0
- Initial release: automatic tag injection, same-origin proxy for
/v1/collectand
nwd_aat_tag.js, installation diagnostics and a suggested selector catalog.