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 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.

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.
  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. The owner key is on stdin. printf '%s\n' "$OWNER_KEY" | node /tmp/analytics-agent.mjs read --host HOST