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. palmetaAnalytics('event', {name, count}) counts a name such as card_tracked. It sends no visitor id, so it counts with or without cookie consent. Calls in one turn share a write, and a name past 50 continues in the next write. Names must not identify a person. 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 setup

No 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 read

Owner 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. events lists each name's count per day and the total for the range. --host does not filter events. Add --json for the same report as JSON.

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

  1. Download the agent script. Do not clone this repo and do not use Google credentials.
  2. curl -fsSL https://analytics.palmeta.net/agent.mjs -o /tmp/analytics-agent.mjs
  3. 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.
  4. # github is true only when this repo is on GitHub. Otherwise send false. echo '{"agent":"AGENT","github":true}' | node /tmp/analytics-agent.mjs setup
  5. Commit the write key inside the snippet. Do not commit the owner key or the claim link.
  6. <script async src="https://analytics.palmeta.net/a.js" data-write-key="WRITE_KEY"></script>
  7. 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. palmetaAnalytics("event", {name, count}) counts a named event such as card_tracked. It sends no visitor id and does not read storage, so it counts with or without cookie consent. count defaults to 1. One call is at most 50, so a single call of 80 counts 50. A pending total past 50 continues in the next write, so two calls of 50 count 100. Names match ^[a-z][a-z0-9_]{0,31}$. Names must not identify a person. Do not send names such as user_12345. A shard stores at most 32 names. Eight shards means 256 name slots per UTC day. Junk names can fill all of them. Each event shard stops at 250 writes, 2,000 for the project that day, because the 20,000 write quota is shared. The client walks to the next shard when one is full. If every shard refuses, that page sends no more events. On page leave only the first request of each walk is sent, so a create or a later shard can be lost.
  8. If you can write GitHub Actions secrets, list them first. Skip the set command when ANALYTICS_OWNER_KEY is already present.
  9. gh secret list
  10. Run the set command only when ANALYTICS_OWNER_KEY is absent. Do not print the key.
  11. printf '%s' "$OWNER_KEY" | gh secret set ANALYTICS_OWNER_KEY
  12. Stored the owner key in the GitHub Actions secret ANALYTICS_OWNER_KEY.
  13. If that secret already exists, leave it unchanged and use the fallback for the new key.
  14. 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/.
  15. 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.
  16. No account is required to start.
  17. Free for one seat and up to 100,000 events a month.
  18. A second seat, or going over 100,000 events in a month, requires a paid account.
  19. One login is one person.
  20. A second active session must use its own seat.
  21. Sharing a login does not add a person for free.
  22. 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.
  23. stubbed. sign-in claim is not implemented
  24. stubbed. domain verification is not implemented
  25. node /tmp/analytics-agent.mjs read reads the last 7 UTC days. --days N asks for 1 to 60. The owner key is on stdin. printf '%s\n' "$OWNER_KEY" | node /tmp/analytics-agent.mjs read --host HOST Add --json for the same report as JSON, including referrers and suspect days. events lists each name's count per day and the total for that range. --host does not filter events. localhost, loopback, file URLs, and bots are not counted. A new session stores the referrer hostname only.