Trying to understand pageviews

Types of requests code 11 are those made by API, and requests code 12 are made by the user API.

Activity Metrics consolidates Logged in Users (req_type: 7), Anonymous users (req_type: 8 ), and Crawlers (req_type: 6). They are the same considered in the first chart of the Admin Panel “Consolidated Pageviews”.

Below is an example of the query for the Consolidated Pageviews Report

SQL Consolidated Pageviews
-- [params]
-- date :start_date
-- date :end_date

SELECT
    ar.date::date AS "date",
    CASE 
      WHEN ar.req_type=6 THEN 'Crawlers'
      WHEN ar.req_type=7 THEN 'Logged in users'
      WHEN ar.req_type=8 THEN 'Anonymous users'
    END user_type,
    SUM(ar.count) AS views
FROM application_requests ar
WHERE req_type IN (6,7,8)
    AND ar.date::date BETWEEN :start_date AND :end_date
GROUP BY "date", user_type
ORDER BY "date"
SUM Consolidated Pageviews
-- [params]
-- date :start_date
-- date :end_date


SELECT
    ar.date::date AS "date",
    SUM(ar.count) AS pageviews
FROM application_requests ar
WHERE req_type IN (6,7,8)
    AND ar.date::date BETWEEN :start_date AND :end_date
GROUP BY "date"
ORDER BY "date" DESC
6 Likes