Here is a small daily habit. You open your analytics tool. You log in. You wait for it to load. You click around to find one number. Then you forget to do it for a week.
Or maybe the tool is so slow and confusing that you stop looking at all. Many people feel this way about Google Analytics.
Let us fix that. In this tutorial you will make a workflow that posts a short message in Slack every morning. It will say how many people visited your site yesterday, and how that compares with the day before. You do not have to log in to anything.
You will use three things:
- n8n, a tool that connects apps and runs steps on a schedule. You can host it yourself or use their cloud.
- Privatus Analytics, a cookieless web analytics tool. The free plan gives you 10,000 events a month and up to 3 sites. No card is needed.
- Slack, where the message will land.
If you already use Zapier or Make, the idea is the same. There are Privatus Analytics apps for those too. This guide uses n8n.
Step 1: Install the community node
A "community node" is an add-on made by someone outside the n8n team. The package is called n8n-nodes-privatus-analytics and you can find it on npm.
In n8n:
- Open Settings, then Community Nodes.
- Click Install.
- Type
n8n-nodes-privatus-analyticsand confirm.
If you host n8n yourself, you can also run this in your n8n folder (~/.n8n/nodes):
npm install n8n-nodes-privatus-analytics
Restart n8n, and the new nodes show up in the node list.
Step 2: Make an API token
The node needs permission to read your numbers. That permission is called an API token. Think of it like a key card for software.
- In Privatus Analytics, open Workspace settings, then API tokens.
- Create a token and give it a name like "n8n".
- Copy it. It starts with
pat_. You only see it once, so paste it somewhere safe right away.
The node's README suggests keeping all permissions, choosing every site, and setting no expiry, so that every operation works. This workflow only reads numbers. So you can try a token with only the analytics.read permission, and see if the credential test in the next step passes. A smaller key is safer. Tokens are explained on the authentication page.
Step 3: Add the credential in n8n
In n8n, create a new credential called Privatus Analytics API and paste your token. n8n tests it when you save. A green check means it works.
A token belongs to one workspace. If you have two workspaces, make two credentials.
Step 4: Build the workflow
You need three nodes in a row.
Node 1: Schedule Trigger
Add a Schedule Trigger. Set it to run every day at 8:00. Check the timezone setting in your n8n so "8:00" means your morning.
Node 2: Privatus Analytics
Add the Privatus Analytics node and set:
- Resource: Stats
- Operation: Get Overview
- Site: pick your site from the list
- Period: Yesterday (if it is not in the list, pick a custom range of one day)
- Additional Fields, Compare With: Previous Period
The list of sites loads from your workspace, so there is nothing to type.
After you run this node, look at its output. You will see a metrics part with numbers like visitors, pageviews, bounce_rate and more. The change part shows the percent change since the comparison period. If there was nothing to compare to, a change can be null, which means "no value".
Node 3: Slack
Add the Slack node. Connect your Slack account the way n8n shows you. Then set it to send a message to a channel, for example #general or a private #stats channel.
For the message text, use an expression. An expression is a bit of code inside {{ }} that n8n swaps for real data:
Good morning! Yesterday your site had {{ $json.metrics.visitors }} visitors and {{ $json.metrics.pageviews }} page views.
Visitors changed by {{ $json.change.visitors ?? 'n/a' }}% compared with the day before.
The ?? 'n/a' part says "if there is no value, write n/a". It keeps the message clean on the first day, when there is nothing to compare.
Click Execute workflow once. Check Slack. You should see your message right away.
Step 5: Switch it on
Click the Active toggle at the top of the workflow. From now on it runs on its own each morning.
No community node? Use the REST API
Maybe your n8n does not allow community nodes. Or you like to keep things basic. The same data is available over plain HTTP. Replace Node 2 with an HTTP Request node:
- Method: GET
-
URL:
https://privatusanalytics.com/sites/pa_YOURSITEID/stats/aggregate.json -
Query parameters:
period=yesterday, andcompare=previous_period -
Header:
Authorization=Bearer pat_YOUR_TOKEN
You can test it first in a terminal:
curl "https://privatusanalytics.com/sites/pa_YOURSITEID/stats/aggregate.json?period=yesterday&compare=previous_period" \
-H "Authorization: Bearer $PRIVATUS_TOKEN"
The reply looks like this:
{
"data": {
"metrics": { "visitors": 8120, "pageviews": 24871 },
"change": { "visitors": 9.6 }
}
}
(The real reply has more fields. This is a short version.) The numbers are inside data, so in Slack you would write {{ $json.data.metrics.visitors }} instead. The stats API page lists every field and what it means. For example, bounce_rate is a percent and visit_duration is in milliseconds.
Ideas to make it better
-
A weekly report. Change the period to
7dand the schedule to Monday at 8:00. - Top pages. Add a second Privatus Analytics node with the Get Top Values operation, to list your best pages. Merge it into the same Slack message.
- Alerts when something breaks. The package also has a Trigger node. It starts a workflow when an event happens, such as an uptime check going down. Send those to a different channel, so a real emergency does not get lost in a daily message.
- Thank happy customers. Trigger on a new 5-star testimonial and send a thank-you email.
The trigger checks a signature on every delivery, so a fake request from a stranger is rejected. Details are in the package README on GitHub.
What you get
- A Slack message with yesterday's numbers every morning, with no login
- A comparison with the day before, so you can see the trend at a glance
- Numbers with bots filtered out, so they reflect real people
- A workflow you can change into weekly reports, alerts and more
- Data that stays between your own tools, not sent to Google
- A free plan with 10,000 events a month and up to 3 sites, no card needed
Try it
If you do not have a Privatus Analytics account yet, the free plan is at privatusanalytics.com. See the pricing page for the paid plans. Set up the script on your site first, wait a day, and then build this workflow. Your first Slack message will be ready the next morning.
Top comments (0)