Actions7
- Site Actions
- Stats Actions
Overview
The Plausible - Stats: Aggregate node in n8n allows you to aggregate website analytics data from the Plausible API for a specified site. This is useful for retrieving summarized metrics such as pageviews, visitors, bounce rate, and more over customizable time periods. Common scenarios include generating reports, monitoring traffic trends, or triggering workflows based on aggregated web analytics.
Practical examples:
- Automatically generate weekly traffic summaries for your website.
- Trigger alerts if visitor numbers drop below a threshold.
- Compare current period metrics with previous periods for trend analysis.
Properties
| Name | Type | Meaning |
|---|---|---|
| Site ID | String | Domain of your site in Plausible (e.g., n8n.io). Required to specify which site's stats to aggregate. |
| Additional Fields | Collection | Optional fields to refine aggregation. See below for details. |
| └ Period | Options | Time range for aggregation (e.g., Day, 7 Days, 30 Days, This Month, etc.). |
| └ Date | String | Custom date range in ISO-8601 format, e.g., 2023-01-01,2023-02-01. Used when Period is set to Custom. |
| └ Metrics | MultiOptions | List of metrics to aggregate (Bounce Rate, Events, Pageviews, Visit Duration, Visitors, Visits). |
| └ Compare | Boolean | Whether to compare against the same time length from the previous period. |
| └ Filters | String | Filter expression to narrow down results. More info |
Output
The output will be a JSON object containing the aggregated statistics for the specified site and parameters. The structure typically includes:
{
"results": {
"visitors": 1234,
"pageviews": 5678,
"bounce_rate": 50.2,
"visit_duration": 120,
"events": 42,
"visits": 1000,
// ...other requested metrics
},
"comparison": {
// Present only if 'Compare' is enabled; contains previous period's values
}
}
- The exact fields in
resultsdepend on the selected metrics. - If comparison is enabled, a
comparisonobject with similar structure is included.
Dependencies
- External Service: Requires access to the Plausible Analytics API.
- API Key: You must configure valid Plausible API credentials (
plausibleApi) in n8n. - Environment Variables: None specific, but ensure your n8n instance can reach the Plausible API endpoint.
Troubleshooting
Invalid Credentials:
Error: Authentication failed or unauthorized.
Resolution: Check that your Plausible API key is correct and has sufficient permissions.Site Not Found:
Error: 404 or similar error indicating the site does not exist.
Resolution: Verify the "Site ID" matches your domain in Plausible.Invalid Date Format:
Error: API returns an error about date parsing.
Resolution: Ensure custom dates are inYYYY-MM-DD,YYYY-MM-DDformat.No Data Returned:
Possible Cause: No analytics data for the selected period or filters too restrictive.
Resolution: Adjust the period, metrics, or remove filters.