How it loads
On a WordPress theme, Vireo prints its tracker in the footer through wp_footer(). There’s nothing to add. For templates without a footer hook, see Install.
The tracker sends one pageview per page with navigator.sendBeacon(), after the page has loaded. A page opened in the background is counted when it becomes visible.
Views go to a small endpoint, endpoint.php in the plugin folder, which loads WordPress without plugins or a theme. If your host blocks PHP files inside wp-content, or a CDN serves the plugin from another address, Vireo uses admin-ajax.php instead. It checks again every hour. What a pageview costs, measured.
Vireo excludes its tracker from JavaScript delay and minification in WP Rocket, Perfmatters, LiteSpeed Cache and FlyingPress, so it isn’t held back until someone scrolls.
Custom events
vireo('event', name);
vireo('event', name, value);
name: what happened, such asnewsletter_signup. It’s lowercased and keeps onlya-z,0-9,_and-, up to 100 characters.value: optional, up to 100 characters, used to break an event down on its own screen.
On a WordPress theme, vireo() exists from the start of the page and queues calls until the tracker has loaded, so it’s safe to call early.
<button onclick="vireo('event', 'pricing_toggle', 'yearly')">Yearly</button>
Events appear under Top events and can be goals in Vireo Pro.
Single-page apps
| You use | Do this |
|---|---|
| Astro view transitions | Nothing. Each astro:page-load counts. |
| A router that uses the History API | Add data-spa="history" to the tracker tag. Each pushState and back or forward navigation counts. |
| Anything else | Call vireo('pageview') after the new page has rendered. |
A navigation to the same address as the last one isn’t counted twice.
Script tag attributes
Outside a WordPress theme, on a headless front end or a connected site, the tracker is a script tag you paste in. Copy it from Vireo’s settings rather than writing it by hand.
| Attribute | Meaning |
|---|---|
data-endpoint |
Where to send views. Required outside WordPress. |
data-site |
A connected site’s key. Leave it off for a headless front end. |
data-spa="history" |
Count History API navigations as pageviews. |
A headless page can also name its WordPress post with <meta name="vireo:post-id" content="123">.
What a beacon sends
A pageview sends the path, the referrer, and the post ID when there is one. An event sends its name and value. When the reader leaves the page or switches away from it, one more small request sends the path and the seconds the page was in front of them since the last report, for time on page. Nothing is stored in the browser and no cookie is set.
The headless and connected-site tag is the same script, so those sites get time on page too.
The tracker doesn’t send anything when the browser has Do Not Track or Global Privacy Control on, or when it’s an automated browser such as Playwright, Puppeteer, Cypress, PhantomJS or Nightmare.
Auto-events
The auto-events you tick under Settings, Tracking send ordinary events (download, form_submit, mailto_click, tel_click, outbound). See Events and broken links.