User Analytics
Introduction
This document provides guidance on utilizing GraphQL to query user analytics metrics data. It includes information on the GraphQL endpoint, the structure of the data tables, and sample queries to retrieve relevant metrics.
Table Metric Details
user_analytics_daily
| Field Name | Data Type | Dimensions | Metrics | Filters | 
|---|---|---|---|---|
| site_id | text | yes | yes | |
| users | bigint | yes | ||
| anonymous_users | bigint | yes | ||
| logged_in_users | bigint | yes | ||
| page_views | bigint | yes | ||
| attention_time | bigint | yes | ||
| period_date | text | yes | yes | |
| total_time_spent | bigint | yes | ||
| average_time_spent | bigint | yes | ||
| readability | double precision | yes | ||
| recirculation | double precision | yes | ||
| loggedin_and_visitor_ratio | double precision | yes | ||
| new_users | bigint | yes | ||
| d0_users | double precision | yes | ||
| d1_users | double precision | yes | ||
| d2_users | double precision | yes | ||
| d3_users | double precision | yes | ||
| d4_users | double precision | yes | ||
| d5_users | double precision | yes | ||
| d6_users | double precision | yes | ||
| d7_users | double precision | yes | ||
| retain_users | bigint | yes | ||
| churned_users | bigint | yes | ||
| churned_percent | double precision | yes | 
user_analytics_hourly
| Field Name | Data Type | Dimensions | Metrics | Filters | 
|---|---|---|---|---|
| site_id | text | yes | yes | |
| period_date | text | yes | yes | |
| period_hour | integer | yes | yes | |
| users | bigint | yes | ||
| anonymous_users | bigint | yes | ||
| logged_in_users | bigint | yes | ||
| page_views | bigint | yes | ||
| attention_time | bigint | yes | ||
| total_time_spent | bigint | yes | ||
| average_time_spent | bigint | yes | ||
| readability | double precision | yes | ||
| recirculation | double precision | yes | ||
| loggedin_and_visitor_ratio | double precision | yes | ||
| new_users | bigint | yes | 
user_analytics_monthly
| Field Name | Data Type | Dimensions | Metrics | Filters | 
|---|---|---|---|---|
| site_id | text | yes | yes | |
| users | bigint | yes | ||
| anonymous_users | bigint | yes | ||
| logged_in_users | bigint | yes | ||
| page_views | bigint | yes | ||
| attention_time | bigint | yes | ||
| period_month | integer | yes | yes | |
| period_year | integer | yes | yes | |
| total_time_spent | bigint | yes | ||
| average_time_spent | bigint | yes | ||
| readability | double precision | yes | ||
| recirculation | double precision | |||
| loggedin_and_visitor_ratio | double precision | yes | ||
| churned_users | bigint | yes | ||
| retain_users | bigint | yes | ||
| churned_percent | double precision | yes | ||
| new_users | bigint | yes | 
user_analytics_quaterly
| Field Name | Data Type | Dimensions | Metrics | Filters | 
|---|---|---|---|---|
| site_id | text | yes | yes | |
| users | bigint | yes | ||
| anonymous_users | bigint | yes | ||
| logged_in_users | bigint | yes | ||
| page_views | bigint | yes | ||
| attention_time | bigint | yes | ||
| period_quarter | integer | yes | yes | |
| period_year | integer | yes | yes | |
| total_time_spent | bigint | yes | ||
| average_time_spent | bigint | yes | ||
| readability | double precision | yes | ||
| recirculation | double precision | yes | ||
| loggedin_and_visitor_ratio | double precision | yes | 
user_analytics_yearly
| Field Name | Data Type | Dimensions | Metrics | Filters | 
|---|---|---|---|---|
| site_id | text | yes | yes | |
| users | bigint | yes | ||
| anonymous_users | bigint | yes | ||
| logged_in_users | bigint | yes | ||
| page_views | bigint | yes | ||
| attention_time | bigint | yes | ||
| period_year | text | yes | yes | |
| total_time_spent | bigint | yes | ||
| average_time_spent | bigint | yes | ||
| readability | double precision | yes | ||
| recirculation | double precision | yes | ||
| loggedin_and_visitor_ratio | double precision | yes | 
Sample Queries
Query to Retrieve User Analytics Daily Page Views
query {
  wral_user_analytics_daily(where: {period_date: {_eq: "2024-04-08"}}) {
    recirculation
    readability
    page_views
  }
}
Query to Retrieve Total users today
query{
  wral_user_analytics_daily(where: {period_date: {_eq: "2024-04-08"}}) {
    users
    period_date
    new_users
  }
}
Query to Retrieve User Analytics Yearly Page Views
query {
  wral_user_analytics_yearly(where: {period_year: {_eq: "2024"}}) {
    page_views
    average_time_spent
    total_time_spent
    users
    period_year
    site_id
  }
}