snippet
analytics
<script async src="https://analytics.palmeta.net/a.js" data-write-key="WRITE_KEY"></script>Replace WRITE_KEY with write_key from setup. Query strings are not stored. History changes count. No cookie is set. The default writes one sessionStorage key per tab per UTC day and counts that session. It does not count a user. data-visitors="off" stores nothing. After a cookie banner, call palmetaAnalytics.setVisitors('persistent'). That does not send a pageview. The next pageview counts the session as consented once and counts the user. data-visitors="persistent" also stores a visitor id in localStorage. The id is not sent. setVisitors('session') or setVisitors('off') deletes that visitor id. off also clears the session marker. analytics.palmeta.net
setup
curl -fsSL https://analytics.palmeta.net/agent.mjs -o /tmp/analytics-agent.mjs# github is true only when this repo is on GitHub. Otherwise send false.
echo '{"agent":"AGENT","github":true}' | node /tmp/analytics-agent.mjs setupNo clone and no Google account. Stdin JSON only: agent, github. github is true only when the repo is on GitHub. A retry creates a new project. Spark safety cap: 24 new projects per UTC day, and 8,000 pageviews per project per UTC day. The Firebase project shares 20,000 document writes a day. The owner key was not stored in GitHub. is the fallback sentence when the GitHub secret cannot be written.
read
node /tmp/analytics-agent.mjs readOwner key on stdin. No Google credentials. Pageviews, sessions, consented sessions, consent rate, consented users, and an estimated total users, per host and per UTC day, plus top paths, for the last 7 days. The estimate is consented users divided by the consent rate. It is marked unreliable below 10 consented sessions. Add --host HOST to keep one host.
terms
- account
- No account is required to start.
- free
- Free for one seat and up to 100,000 events a month.
- paid
- A second seat, or going over 100,000 events in a month, requires a paid account.
- login
- One login is one person.
- session
- A second active session must use its own seat.
- share
- Sharing a login does not add a person for free.
- script
- https://analytics.palmeta.net/a.js
- ingest
- firestore daily rollup
- read
- node /tmp/analytics-agent.mjs read
- claim
- stubbed. sign-in claim is not implemented
- verify
- stubbed. domain verification is not implemented
- host
- analytics.palmeta.net
- dns
- owner connects the domain
agent
- Download the agent script. Do not clone this repo and do not use Google credentials.
- curl -fsSL https://analytics.palmeta.net/agent.mjs -o /tmp/analytics-agent.mjs
- Run setup once. Stdin is JSON with agent and github only. github is true only when the repo is on GitHub. A retry creates a new project.
- # github is true only when this repo is on GitHub. Otherwise send false. echo '{"agent":"AGENT","github":true}' | node /tmp/analytics-agent.mjs setup
- Commit the write key inside the snippet. Do not commit the owner key or the claim link.
- <script async src="https://analytics.palmeta.net/a.js" data-write-key="WRITE_KEY"></script>
- Query strings are not stored. History changes count. No cookie is set. data-visitors defaults to session: one sessionStorage key, a.s.<writeKey>, holding day.shard for the UTC day and shard already counted. That counts every session and does not count a user. A later consent write returns to that shard. data-visitors="off" stores nothing. After the site consent banner, call palmetaAnalytics.setVisitors("persistent"). That does not send a pageview. The next pageview counts the session as consented once and counts the user, on the same write. setVisitors("session") or setVisitors("off") deletes a.u.<writeKey> and every a.c.<writeKey> key. off also deletes the session marker. Users are consented users. estimated_users extrapolates by the consent rate and is unreliable below 10 consented sessions. data-visitors="persistent" also stores a localStorage visitor id, a.u.<writeKey>, for 400 days. The id is not sent.
- If you can write GitHub Actions secrets, list them first. Skip the set command when ANALYTICS_OWNER_KEY is already present.
- gh secret list
- Run the set command only when ANALYTICS_OWNER_KEY is absent. Do not print the key.
- printf '%s' "$OWNER_KEY" | gh secret set ANALYTICS_OWNER_KEY
- Stored the owner key in the GitHub Actions secret ANALYTICS_OWNER_KEY.
- If that secret already exists, leave it unchanged and use the fallback for the new key.
- Fallback: say "The owner key was not stored in GitHub." Print the owner key once, write it to .analytics/owner-key with mode 600, and gitignore .analytics/.
- Print the claim link. If you open a pull request, put the claim link in the description. You may also write it to .analytics/claim-link. Do not commit it.
- No account is required to start.
- Free for one seat and up to 100,000 events a month.
- A second seat, or going over 100,000 events in a month, requires a paid account.
- One login is one person.
- A second active session must use its own seat.
- Sharing a login does not add a person for free.
- Spark safety cap: 24 new projects per UTC day, and 8,000 pageviews per project per UTC day. The Firebase project shares 20,000 document writes a day.
- stubbed. sign-in claim is not implemented
- stubbed. domain verification is not implemented
- node /tmp/analytics-agent.mjs read reads the last 7 UTC days. The owner key is on stdin. printf '%s\n' "$OWNER_KEY" | node /tmp/analytics-agent.mjs read --host HOST