Web Analytics Processing and Reporting

Using a User Session class we can collect data for analysis, once the data is collected we need to analyze and store the relevant data to provide useful reports, that can be used for marketing, SEO and other functions.

Storing the Data

To store the data I decided to use several tables, this covered:

  • Hourly
  • Daily
  • Weekly
  • Monthly
  • Location – By City/Month
  • Sales – By City/Month
  • Page View – By Month

Further breakdown’s could be made, almost certainly on page view’s by day or week, however, this level of data could have increased the database size exponentially, especially so if the website contains hundreds of product pages.

General Data

For hourly, daily, weekly and monthly data, the tables all contained the following fields:

  • Total Visits
  • Human visits
  • Mobile Visits
  • Bot Visits
  • Bounced visits
  • Total Pages Viewed
  • Total Sales amount
  • Number of conversions
  • Number of mobile conversions
  • Unknown Referrer
  • Direct Referrer
  • Referral
  • Organic Referral
  • Bing Referral
  • Google Referral
  • Yahoo Referral
  • Facebook Referral
  • Twitter Referral

Also included were individual fields for the type, for instance monthly contained a month and a year etc.

Processing the numbers

The actual processing of the user session data is done in stages, it must pass each stage before it reaches the end of the process and can be deleted or archived.

The individual stages are:

  1. Stage 1 – Extract hourly data.
  2. Stage 2 – Update initial referrer counts.
  3. Stage 3 – Extract page data.
  4. Stage 4 – Update monthly sales data.
  5. Stage 5 – Update location data.
  6. Stage 6 – Update daily data.
  7. Stage 7 – Update monthly data.
  8. Stage 8 – Update weekly data.
  9. Stage 9 – Delete data that is completely processed and one year old

Final Reports

The range of reports producible from the above data collecton is many-fold, below are a few reports found on a basic report page.