For teams with apps on a cloud engine.
A cloud engine is a subnet of Internet Computer nodes that runs your team's apps as canisters, managed from the engine console. This suits a team that already runs its app on a cloud engine and wants visitor numbers without sending them to another company.
Why not Plausible or Google Analytics?
No third-party domain in your policy
The script-src and connect-src of your Content Security Policy only name your own two canisters.
No account with another company
There is nothing to sign up for. You install the app on your engine and sign in with your engine account.
No bill outside cycles
It runs on your engine and is paid in cycles, like your other canisters.
Your team owns the data
It stays in a canister that your team controls, and you can delete the data of a site.
What the script takes from a visitor.
It counts a visit and forgets the person. The canister hashes the IP with a salt that changes each day, and never stores the IP.
- Cookies0
- Identifiers kept in the browser0
- IP addresses stored0
- Companies that receive the data0
- Size of the scriptgzipped, one request1.5kB
Four steps, then real numbers.
The app runs on your engine. Each page view is one small request to it.
You need:
- git
- Node.js
- the icp CLI
- an engine admin account, because only an engine admin can create canisters
- the subnet ID, from the Settings page of the engine
-
Install the app on your engine
This creates two canisters, the backend and the dashboard. The engine console shows them as one app, "Analytics". The first deploy builds the tracker, the dashboard and the canister, so it takes a few minutes.
git clone https://github.com/yhabib/cloud-engine-analytics cd cloud-engine-analytics git checkout "$(git tag --list 'v*' --sort=-v:refname | head -n 1)" icp identity link web <name> --app <engine-console-host> icp identity default <name> icp deploy -e ic --subnet <subnet-id> -
Make yourself an owner
Open your dashboard with the "Open" button of the app in the engine console and sign in. A new install has no owners, so the dashboard shows your principal. Run this command once from the repo folder, with the identity that deployed (a controller). Then click "Check again".
icp canister call -e ic analytics add_owner '(principal "<your-principal>")' -
Add your site
In the dashboard, add a site and list the origins that can send data.
-
Add the script tag
Put it in the head of each page. It tracks the first load and each route change.
<script defer src="https://<your-dashboard-id>.icp.net/tracker.js" data-site-id="<your-site-id>" data-canister-url="https://<your-backend-id>.icp.net"> </script>
What you can read.
Traffic
- Visitors for each day
- Page views
- Sessions
- Views per session
Content
- Top pages
- Custom events
- 12 months of history
Sources
- Referrers
- Campaigns from UTM tags
- Direct visits
Audience
- Countries
- Browsers and systems
- Device types
- Languages
What it cannot do.
Countries are approximate
They come from the time zone of the browser, not from the IP address.
Numbers are estimates
A visitor who blocks scripts is not counted, as with each script-based tool.
The IP passes through
The nodes of your engine see the request. The canister hashes the IP and never stores it.
100000 visitors a day per site
One site counts at most 100000 distinct visitors per UTC day. After that, page views are still counted, but not as new visitors or sessions.
What it costs.
One page view
It costs about 66 million cycles.
One million page views
They cost about 66 trillion cycles. 1 trillion cycles is 1 XDR, a fixed rate.
No other bill
Your engine pays in cycles, like your other canisters.
Measured on an application subnet
A subnet with more nodes costs more.