Skip to Content
TrackingPageviews

Pageviews

Understanding how Ghost Metrics tracks pageviews automatically.

Automatic Tracking

When you install the Ghost Metrics tracking code, pageviews are tracked automatically. Every time a visitor loads a page, data is captured and sent to your dashboard — no additional configuration required.

What’s Captured

For each pageview, Ghost Metrics automatically records:

Page Information

  • Page URL — The full URL of the page visited
  • Page Title — The HTML <title> of the page
  • Referrer — The previous page or external source

Visitor Information

  • Browser — Chrome, Firefox, Safari, Edge, etc.
  • Operating System — Windows, macOS, iOS, Android, etc.
  • Device Type — Desktop, mobile, or tablet
  • Screen Resolution — Visitor’s screen size
  • Language — Browser language setting

Location

  • Country — Determined from IP address
  • Region — State or province (when available)
  • City — Approximate city (when available)

IP addresses are anonymized and not stored in their complete form.

Timing

  • Timestamp — When the page was viewed
  • Time on Page — How long the visitor spent on each page
  • Page performance timings — Network, server, and page-rendering times that make up the average page load time

Viewing Pageview Data

Find your pageview data in several reports:

Behavior → Pages

All pages ranked by pageviews. See:

  • Total pageviews
  • Unique pageviews
  • Average time on page
  • Bounce rate
  • Exit rate

Behavior → Entry Pages

The first page visitors see when they arrive at your site. Useful for understanding which pages attract new visitors.

Behavior → Exit Pages

The last page visitors see before leaving. High exit rates on important pages may indicate problems.

Behavior → Page Titles

Pages grouped by their HTML title rather than URL. Helpful when URLs are complex or dynamic.

Customizing Pageview Tracking

Once the Ghost Metrics container has loaded on a page, the JavaScript tracking API is available through the _paq queue. Push commands before the pageview is tracked to affect it.

Custom Page Titles

By default, Ghost Metrics uses your page’s HTML <title> tag. You can override this if needed:

var _paq = window._paq = window._paq || []; _paq.push(['setDocumentTitle', 'Custom Page Title']);

This is useful when:

  • Page titles are dynamically generated and unhelpful
  • You want to group similar pages under one title
  • Your CMS produces duplicate or generic titles

A handy pattern for multi-subdomain sites is prefixing the domain: _paq.push(['setDocumentTitle', document.domain + "/" + document.title]);

Single-Page Applications and Virtual Pageviews

For single-page applications or AJAX-loaded content, the URL changes without a full page load, so you track each route change yourself. The order of calls matters:

// on each route change: _paq.push(['setReferrerUrl', previousUrl]); // the URL you navigated away from _paq.push(['setCustomUrl', newUrl]); // the new virtual URL _paq.push(['setDocumentTitle', 'New View Title']); _paq.push(['deleteCustomVariables', 'page']); // clear page-scoped variables from the previous view _paq.push(['trackPageView']); // after your new content is in the DOM: _paq.push(['enableLinkTracking']); // re-scan so outlinks/downloads keep working

Alternatively, if your pageview tracking is configured through the Ghost Metrics Tag Manager container, you can re-fire the container’s pageview triggers on each route change:

window._mtm = window._mtm || []; window._mtm.push({'event': 'mtm.PageView'});

The container can also be configured with a History Change trigger to detect route changes automatically — contact support if you’d like help setting that up.

Excluding Pages from Tracking

There may be pages you don’t want to track, such as admin areas or internal tools.

Option 1: Don’t Install Tracking Code

Simply don’t include the tracking code on pages you want to exclude.

Option 2: Conditional Loading

Use server-side logic to conditionally include the tracking code:

<?php if (!is_admin_page()): ?> <!-- Ghost Metrics tracking code here --> <?php endif; ?>

Option 3: Site-Level Exclusions

Site settings support excluding specific IP addresses (e.g., your office), URL query parameters, and user agents from tracking. There’s no page-path exclusion setting, so for whole pages use options 1 or 2. See Managing Websites or contact support for help with exclusions.

Understanding Metrics

Pageviews vs Unique Pageviews

  • Pageviews — Total number of times a page was viewed (including repeat views in a single session)
  • Unique Pageviews — Number of sessions that included a view of that page

Bounce Rate

The percentage of visits where the visitor left after viewing only one page. A “bounce” means they didn’t interact further with your site.

Exit Rate

The percentage of pageviews that were the last in a session. Unlike bounce rate, this includes visits with multiple pageviews.

Average Time on Page

How long visitors typically spend viewing a page before navigating away or leaving the site.

Next Steps

Last updated on