In a discussion about enhancing canned reports with SQL access, ganncamp expresses a desire to extend standard reports like ‘Consolidated Pageviews’ by accessing their underlying SQL for customization. merefield clarifies that while the report isn’t built directly in SQL, it can be reverse-engineered using the Rails model ApplicationRequest. They provide links to relevant documentation and source code, and demonstrate how to query the application_requests table — which stores metrics like page_view_logged_in, page_view_anon, and page_view_crawler — via Rails console or raw SQL. The data is pre-aggregated in a count column, simplifying further analysis. Although application_requests isn’t exposed in Data Explorer, the example SQL query shows how to filter and group by date and request type for custom reporting. This approach allows users to iterate on built-in reports without starting from scratch.
It is regular a sum and group by, so probably, you could start off with, on the Rails console:
ApplicationRequest.where(req_type:["page_view_logged_in", "page_view_anon", "page_view_crawler"]).where('date BETWEEN ? AND ?', '11/14/2022', '11/17/2022')
for example
or the SQL equivalent:
SELECT * FROM application_requests WHERE req_type IN (7, 8, 6) AND (date BETWEEN '11/14/2022' AND '11/17/2022')
Some of the aggregation is already done for you as the data is in a count column.