Relatude Help

14 Page-view analytics

Analytics records every page view in the database, with no cookie and no stored IP address. Turn it on in the admin UI under CMS › Analytics › Record page views. It needs nothing beyond AddRelatudeCMS() and UseRelatudeCMS(), but the order of the middleware matters:

app.UseForwardedHeaders();        // behind a proxy: first, so the visitor's own address is used
app.UseResponseCompression();     // if used: before the CMS, which adds its script only to uncompressed HTML
app.UseRelatudeCMS();             // before the site's pages and static files

Page views are recorded in the background, a few seconds after the page is sent (LookupDelaySeconds), so visitors never wait for analytics.

  • What counts as a page view — A page view is a GET answered with 200 and text/html. These never count: the admin UI (/relatude.db by default) and /-info/, where the bot check is served from; paths that start with one of ExcludedPaths; prefetches…
  • No cookie and no address — Each visitor is a daily visitor hash: SHA-256 of the IP address, user agent and Accept-Language, with a random salt that changes every day (UTC). The salt lives in memory only, so a hash cannot be traced back to an…
  • Bots and visitor lookups — With InjectBotCheck on, a small script is added to every HTML page, before its last </body>. It tells the server whether the browser is driven by a bot. The script is written into the page. If your…
  • The log — Page views go to the custom log cms-pageviews, shown as Page views under Logs in the admin UI, with graphs of its statistics. Its daily files are kept for 400 days, up to 2,000 MB in all.
  • Testing and replacing the database side — Everything analytics reads from or writes to the database goes through IAnalyticsHost (namespace Relatude.DB.CMS.Web.Analytics): the settings, the custom logs, the storage, the IP lookup and the reserved paths. The…