Track Pageviews

Pageviews are used to track what pages a visitor is browsing across your site. A visitor can visit any number of pages during a browsing session, and these will be automatically tracked using the JavaScript tracker so long as it is installed on every page.


The page URL and page title can be modified. Other parameters (such as user-agent, screen dimension etc.) are all detected internally when the pageview is tracked.

URLThe URL of the page to track. This will be resolved relative to the current URL.Stringwindow.location.href
TitleThe title of the page to track.Stringdocument.title



  // false here tells the tracker not to
  // automatically track a pageview
  _gs('your-project-token', false);

  // do some stuff, for example loading an AJAX web app
  // using 'setTimeout' to mimic the delay in loading external scripts
  setTimeout(function() {
    // our app has loaded, lets track a pageview now!
  }, 1000);

  _gs('track', '/custom-path', 'Custom title');
  _gs('track', '', 'Custom domain + path');