TrackingPageviews

Tracking

Pageviews and single-page apps

What odo counts as a visit and a pageview, how it follows single-page apps, time on page and scroll depth, who counts as online, and what never counts.

On this page

Once the script is on a page, odo counts each pageview, the visit it belongs to, and where that visit came from. There’s nothing to call.

Visitors and visits#

A visitor is a browser, recognized by its odo_vid id (on a cookieless site, within a day). A visit is their time on your site, from the page they land on to the page they leave from. With each pageview odo keeps the page, where the visit came from (a referrer, a tagged link or an ad click), the country, region and city, the device, browser and system, and the language.

Single-page apps#

Apps that change pages without reloading work as they are. odo follows history.pushState and replaceState, the back and forward buttons, and pages the browser restores from its back/forward cache. For an app that routes with #/paths, add data-hash to the tag.

To count a page yourself:

JavaScript
odo('pageview')

A page counts when its path changes, so calling this again on the same page does nothing.

Time and scroll#

Time on a page counts only while the tab is in front of someone. When a page is left, odo notes how long it was read and how far down it was scrolled. Bounce rate, engaged time and scroll depth on the dashboard come from these. A page’s heatmap goes further: how far down each share of its visitors got, per screen size, and which of its parts they saw.

Online now#

While a page is in front of someone, the script tells odo they’re still there once a minute, for up to 30 minutes on one page. Online means active in the last 3 minutes, so closing a tab drops someone within 3 minutes, and someone reading (or glancing at another tab) stays counted.

What never counts#

  • Automated browsers: headless Chrome, Lighthouse, Cypress, PhantomJS, and any browser that says a program is driving it.
  • Pages a browser prerenders that nobody sees.
  • Browsers you left out with ?odo=ignore.
  • Paths you leave out in the website’s settings, like /admin/*.
  • localhost and .local hosts, unless the tag has data-local.

Very busy sites#

Dashboard queries run beside the app, so it stays quick while they work. A range with more than about 300,000 visits is worked out from a sample of whole visitors, scaled back up, and the dashboard marks it Estimated. Shorter ranges are exact.

This page as markdownllms.txt