Page Views
The Page Views metric counts the total number of page loads on your site or app, regardless of user identity or session. It’s a core indicator of engagement and content reach.
Metric model
- Name
metric
- Type
- string
- Description
Always
page_views
for this metric.
- Name
value
- Type
- integer
- Description
The number of page views during the current period.
- Name
previous
- Type
- integer
- Description
The number of page views during the previous period.
- Name
change
- Type
- float
- Description
Percent change compared to previous period.
- Name
formattedValue
- Type
- string
- Description
Formatted current value (e.g.,
60.455
).
- Name
formattedPrevious
- Type
- string
- Description
Formatted previous value (e.g.,
63.793
).
- Name
period.id
- Type
- string
- Description
The selected time period (e.g.,
7d
).
- Name
period.name
- Type
- string
- Description
Display name for the period (e.g.,
Last 7 days
).
- Name
periodRange.current.start
- Type
- string
- Description
Start time of the current period (ISO 8601).
- Name
periodRange.current.end
- Type
- string
- Description
End time of the current period (ISO 8601).
- Name
periodRange.previous.start
- Type
- string
- Description
Start time of the previous period.
- Name
periodRange.previous.end
- Type
- string
- Description
End time of the previous period.
- Name
performance.duration
- Type
- float
- Description
Time it took to calculate the metric.
- Name
performance.formatted
- Type
- string
- Description
Human-readable duration (e.g.,
782 ms
).
Retrieve page views metric
This endpoint returns the number of page views for a given time period.
Optional query parameters
- Name
period
- Type
- string
- Description
Time range to filter by. Examples:
today
yesterday
7d
30d
this_month
Request
curl -G http://localhost:3000/api/metrics/page_views \
-H "Authorization: Bearer {token}" \
-d period=7d
Response
{
"metric": "page_views",
"value": 60455,
"previous": 63793,
"change": -5.23,
"formattedValue": "60.455",
"formattedPrevious": "63.793",
"period": {
"id": "7d",
"name": "Last 7 days"
},
"periodRange": {
"current": {
"start": "2025-03-16T08:50:55.029Z",
"end": "2025-03-23T08:50:55.028Z"
},
"previous": {
"start": "2025-03-09T08:50:55.029Z",
"end": "2025-03-16T08:50:55.028Z"
}
},
"performance": {
"duration": 782.17,
"formatted": "782 ms"
}
}
Use cases
- Understand which pages drive the most traffic
- Evaluate the reach of content marketing
- Track spikes from campaigns or external referrals