{"id":15650084,"url":"https://github.com/ncarlier/za","last_synced_at":"2025-10-09T09:17:23.211Z","repository":{"id":44334846,"uuid":"278480404","full_name":"ncarlier/za","owner":"ncarlier","description":"ZerØ Analytics is a Google Analytics alternative focused on privacy and simplicity.","archived":false,"fork":false,"pushed_at":"2025-01-22T19:12:11.000Z","size":669,"stargazers_count":40,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-14T10:12:01.528Z","etag":null,"topics":["analytics","golang","google-analytics","grafana","loki"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ncarlier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-07-09T22:04:28.000Z","updated_at":"2025-01-22T19:11:31.000Z","dependencies_parsed_at":"2024-01-13T11:09:55.469Z","dependency_job_id":"8d41bc1e-dedb-440b-a707-d1f79c542c03","html_url":"https://github.com/ncarlier/za","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/ncarlier/za","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncarlier%2Fza","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncarlier%2Fza/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncarlier%2Fza/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncarlier%2Fza/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ncarlier","download_url":"https://codeload.github.com/ncarlier/za/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncarlier%2Fza/sbom","scorecard":{"id":677285,"data":{"date":"2025-08-11","repo":{"name":"github.com/ncarlier/za","commit":"07304a3155ba90f708f75f5a746aa053a4cfc579"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:73: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:77: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:78: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:84: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/ncarlier/za/build.yml/master?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:4","Warn: containerImage not pinned by hash: Dockerfile:24: pin your Docker image by updating gcr.io/distroless/base-debian12:nonroot to gcr.io/distroless/base-debian12:nonroot@sha256:b2404f60e475452152f15fba531fa6ed4b6d1d412498f36a127597673eeaf68f","Warn: npmCommand not pinned by hash: .github/workflows/build.yml:39","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   7 third-party GitHubAction dependencies pinned","Info:   0 out of   2 containerImage dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU Affero General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v1.5.0 not signed: https://api.github.com/repos/ncarlier/za/releases/196186025","Warn: release artifact v1.4.2 not signed: https://api.github.com/repos/ncarlier/za/releases/171884147","Warn: release artifact v1.4.1 not signed: https://api.github.com/repos/ncarlier/za/releases/171549450","Warn: release artifact v1.4.0 not signed: https://api.github.com/repos/ncarlier/za/releases/160944027","Warn: release artifact v1.3.0 not signed: https://api.github.com/repos/ncarlier/za/releases/144596089","Warn: release artifact v1.5.0 does not have provenance: https://api.github.com/repos/ncarlier/za/releases/196186025","Warn: release artifact v1.4.2 does not have provenance: https://api.github.com/repos/ncarlier/za/releases/171884147","Warn: release artifact v1.4.1 does not have provenance: https://api.github.com/repos/ncarlier/za/releases/171549450","Warn: release artifact v1.4.0 does not have provenance: https://api.github.com/repos/ncarlier/za/releases/160944027","Warn: release artifact v1.3.0 does not have provenance: https://api.github.com/repos/ncarlier/za/releases/144596089"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/build.yml:58"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2025-3525 / GHSA-93mq-9ffx-83m2","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T21:54:40.368Z","repository_id":44334846,"created_at":"2025-08-21T21:54:40.368Z","updated_at":"2025-08-21T21:54:40.368Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001120,"owners_count":26083021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","golang","google-analytics","grafana","loki"],"created_at":"2024-10-03T12:33:16.355Z","updated_at":"2025-10-09T09:17:23.191Z","avatar_url":"https://github.com/ncarlier.png","language":"Go","funding_links":["https://www.paypal.me/nunux"],"categories":[],"sub_categories":[],"readme":"\n![Logo](zero-analytics.svg)\n\n[![Build Status](https://github.com/ncarlier/za/actions/workflows/build.yml/badge.svg)](https://github.com/ncarlier/za/actions/workflows/build.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/ncarlier/za)](https://goreportcard.com/report/github.com/ncarlier/za)\n[![Docker pulls](https://img.shields.io/docker/pulls/ncarlier/za.svg)](https://hub.docker.com/r/ncarlier/za/)\n[![Zero Analytics](https://monitoring.nunux.org/usage/badge/za.svg)](https://github.com/ncarlier/za)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/nunux)\n\nZerØ Analytics is a Google Analytics alternative with:\n\n- Zero personal data usage\n- Zero vendor lock-in\n- Zero complexity\n- And a [googol](googol) of love!\n\n## Features\n\n- Single native executable\n- Shameful copy of the Google Analytics tag\n- Multiple output support ([Loki](loki), [Elasticsearch](elastic), [Prometheus](prometheus), files, ... )\n- JSON or templatized output\n- Track visited pages, uncaught errors, [HTML ping](hyperlink_auditing), and custom events\n- Optional Time on Page support thanks to [Beacon API][beacon_api]\n- Optional GeoIP support thanks to [DB-IP](https://db-ip.com)\n- Customizable beacon image (1px or badge)\n- Usage control limitation\n\nHere an [example](./dashboard/grafana-loki_example.json) of what you can get using Grafana with Loki:\n\n![Sample Grafana dashboard](grafana.png)\n\n## Installation\n\nBy compiling from sources:\n\n```bash\n$ go get -v github.com/ncarlier/za\n```\n\n**Or** by downloading the binary regarding your architecture:\n\n```bash\n$ curl -sf https://gobinaries.com/ncarlier/za | sh\n```\n\n**Or** by using Docker:\n\n```bash\n$ docker run -d --name=zero-analytics ncarlier/za\n```\n\n## Geting started\n\nStart the server:\n\n```bash\n# init and customize the configuration file\nza init-config -f config.toml\n# start server\nza -c config.toml serve\n```\n\n## Configuration\n\nThe configuration is a TOML file structured like this:\n\n```toml\n# ZerØ Analytics configuration file\n\n[log]\n## Log level\nlevel = \"info\"\n## Log format\nformat = \"text\"\n\n[http]\n## HTTP listen address\nlisten_addr = \":8080\"\n\n[geo-ip]\n## Geo IP database\ndatabase = \"./var/dbip-country-lite.mmdb\"\n\n[global]\n[global.tags]\n  dc = \"eu-west-1\"\n  user = \"$USER\"\n\n# List of trackers\n[[trackers]]\n## Tracking ID\ntracking_id = \"UA-XXXX-Y\"\n## Only HTTP request from this origin will be collected\norigin = \"http://localhost:8000\"\n## Badge configuration (\u003ctitle\u003e|\u003clabel\u003e|\u003ccolor\u003e)\nbadge = \"zero|analytics|#00a5da\"\n\n# Outputs configuration\n[[outputs.file]]\n  ## Files to write to, \"stdout\" is a specially handled file.\n  files = [\"stdout\"]\n  ## Data format to output\n  data_format = \"json\"\n  ## Condition to use this output\n  ## See syntax here: https://expr-lang.org/docs/language-definition\n  condition == 'tid == \"UA-XXX-Y\"'\n```\n\nA complete and documented [example](./pkg/config/defaults.toml) can be generated with `za init-config` command.\n\n## Outputs\n\nZerØ Analytics is able to format and write collected events to multiple outputs:\n\n### File\n\nThis output is usefull if you want to process events by an external toolchain.\n\n```toml\n[[outputs.file]]\n  ## Files to write to, \"stdout\" is a specially handled file.\n  files = [\"/tmp/events.log\"]\n```\n\nNote: `stdout` is a special keyword used to write events to the process standard output (stdout).\n\n### HTTP\n\nThis output is usefull if you want to process events by an external service.\n\n```toml\n[[outputs.http]]\n  ## URL is the address to send events to\n  url = \"http://localhost:8081\"\n  ## Timeout for HTTP message\n  timeout = \"2s\"\n  ## HTTP method, one of: \"POST\" or \"PUT\"\n  method = \"POST\"\n  ## HTTP Basic Auth credentials\n  #  username = \"username\"\n  #  password = \"pa$$word\"\n  ## Compress body request using GZIP\n  gzip = true\n```\n\n### Loki\n\n*[Loki](loki) is a horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by Prometheus.*\n\n```toml\n[[outputs.loki]]\n  ## Loki URL\n  url = \"http://localhost:3100\"\n  ## Timeout\n  timeout = \"2s\"\n  ## Batch size\n  batch_size = 10\n  ## Batch interval\n  batch_interval = \"10s\"\n```\n\n### Prometheus\n\n*[Prometheus](prometheus) collects and stores its metrics as time series data, i.e. metrics information is stored with the timestamp at which it was recorded, alongside optional key-value pairs called labels.*\n\n```toml\n[[outputs.prom]]\n  ## Address to listen on\n  listen = \":9213\"\n  ## Path to publish the metrics on.\n  path = \"/metrics\"\n  ## Metric prefix name\n  prefix = \"za_\"\n  [[outputs.prom.metrics]]\n    ## Metric name\n    name = \"pageview_total\"\n    ## Filter on specific event type\n    ## Values: \"pageview\", \"exception\", \"link\" or \"event\"\n    type = \"pageview\"\n    ## Metric labels can be specified here in key=\"value\" format where value is the event property name (see below).\n    [outputs.prom.metrics.labels]\n      tid = \"tid\"\n      page = \"path\"\n```\n\n#### Condition\n\nAn output can be used depending on the result of a conditional expression.\nThe expression used the [Expr Lang](https://expr-lang.org/docs/language-definition) syntax.\n\nExample:\n\n```toml\n[[outputs.file]]\n  ## Write events to STDOUT\n  files = [\"stdout\"]\n  ## Writes events only coming from Firefox\n  condition = 'browser == \"Firefox\"'\n```\n\nSee below for available event properties.\n\n#### Data format\n\nSome outputs are able to send formated events.\nThis is the case for `Loki`, `HTTP`, and `File`.\nBy default they format the event data as `JSON`:\n\n```json\n{\n  \"tid\": \"UA-XXXX-Y\",\n  \"browser\":\"Chrome\",\n  \"os\":\"Linux x86_64\",\n  \"tags\": {\"dc\":\"eu-west-1\",\"user\":\"nicolas\"},\n  \"timestamp\": \"2020-09-27T22:01:58.623366267Z\",\n  \"language\": \"en-US\",\n  \"hostname\": \"http://localhost\",\n  \"path\": \"/classic.html\",\n  \"referer\": \"\"\n}\n```\n\nYou can also format data as a string by using [Go Template](https://golang.org/pkg/text/template/).\nBy default the template is the [Common Log Format](https://en.wikipedia.org/wiki/Common_Log_Format).\n\nAdd this to your output configuration in order to specify data format:\n\n```toml\n  ## Data format to output (\"json\" or \"template\")\n  data_format = \"template\"\n  ## Go template used by the template data format. By defaut \"Common Log Format\".\n  data_format_template = \"{{.client_ip}} {{.hostname}} - [{{.timestamp}}] \\\"GET {{.path}} {{.protocol}}\\\" 200 1 \\\"{{.referer}}\\\" \\\"{{.user_agent}}\\\"\"\n```\n\nSee below for available event properties.\n\n#### Event properties\n\nThe following event properties are available:\n\n| Property name | Decsription              | pageview | exception | ping | event |\n|-------------|----------------------------|---|---|---|---|\n| tid         | Event ID                   | ✓ | ✓ | ✓ | ✓ |\n| client_ip   | Client IP                  | ✓ | ✓ | ✓ | ✓ |\n| user_agent  | User Agent                 | ✓ | ✓ | ✓ | ✓ |\n| country     | Decoded country (if found) | ✓ | ✓ | ✓ | ✓ |\n| os          | Decoded operating system   | ✓ | ✓ | ✓ | ✓ |\n| browser     | Decoded browser            | ✓ | ✓ | ✓ | ✓ |\n| tags        | Tags                       | ✓ | ✓ | ✓ | ✓ |\n| timestamp   | Timestamp                  | ✓ | ✓ | ✓ | ✓ |\n| protocol    | HTTP verb                  | ✓ | - | - | - |\n| language    | Browser language           | ✓ | - | - | - |\n| hostname    | URL hostname               | ✓ | - | - | - |\n| path        | URL path                   | ✓ | - | - | - |\n| referer     | HTTP Referer               | ✓ | - | - | - |\n| new_visitor | Is new visitor             | ✓ | - | - | - |\n| new_session | Is new session             | ✓ | - | - | - |\n| top         | Time on page               | ✓ | - | - | - |\n| msg         | Error message              | - | ✓ | - | - |\n| line        | Error line                 | - | ✓ | - | - |\n| column      | Error column               | - | ✓ | - | - |\n| url         | Error URL                  | - | ✓ | - | - |\n| error       | Error                      | - | ✓ | - | - |\n| from        | Click from URL             | - | - | ✓ | - |\n| to          | Click to URL               | - | - | ✓ | - |\n| payload     | Event custom payload       | - | - | ✓ | ✓ |\n\n\n## Add ZerØ Analytics to your site\n\nTo start tracking pageviews, copy the following tracking snippet to all pages of the website you want to track.\n\n```html\n\u003c!-- Zero Analytics script --\u003e\n\u003cscript\u003e\n  (function(i, s, o, g, r, a, m){\n    s[r]=s[r]||function(){\n      (s[r].q=s[r].q||[]).push(arguments)\n    };\n    a=i.createElement(o),\n    m=i.getElementsByTagName(o)[0];\n    a.async=1; a.src=g; a.id='za-script';\n    m.parentNode.insertBefore(a,m)\n  })(document, window, 'script', 'http://localhost:8080/za.js', 'za');\n  za('create', 'UA-XXXX-Y', 'auto');\n  za('send', 'pageview');\n\u003c/script\u003e\n\u003c!-- End Zero Analytics script --\u003e\n```\n\n### Alternative async snippet\n\nWhile the snippet described before ensures the script will be loaded and executed asynchronously on all browsers,\nit has the disadvantage of not allowing modern browsers to preload the script.\n\nThis alternative async snippet adds support for preloading:\n\n```html\n\u003c!-- Zero Analytics script --\u003e\n\u003cscript\u003e\n  window.za = window.za||function(){(za.q=za.q||[]).push(arguments)};za.l=+new Date;\n  za('create', 'UA-XXXX-Y', 'auto');\n  za('send', 'pageview');\n\u003c/script\u003e\n\u003cscript async src='http://localhost:8080/za.js' id=\"za-script\"\u003e\u003c/script\u003e\n\u003c!-- End Zero Analytics script --\u003e\n```\n\n### Tracked event types\n\nThe analytics script is able to track 3 kinds of events: **page views**, **errors** and **custom events**:\n\n#### Page views\n\n```html\n\u003c!-- Zero Analytics script --\u003e\n\u003cscript\u003e\n  ...\n  za('send', 'pageview'/*, {top: true}*/);\n\u003c/script\u003e\n\u003c!-- End Zero Analytics script --\u003e\n```\n\nAs soon the page is loaded, the analytics script will send page hit to the collector endpoint.\n\nAlternatively you can measure the time spent on a page (Time on Page) by activating the option `Time on Page` (`{top: true}`).\nThis will use the [Beacon API](beacon_api) of the browser instead of the usual tracking method.\n\n#### Errors\n\n```html\n\u003c!-- Zero Analytics script --\u003e\n\u003cscript\u003e\n  ...\n  za('send', 'error');\n\u003c/script\u003e\n\u003c!-- End Zero Analytics script --\u003e\n```\n\nAs soon a uncaught error is thrown, the analytics script will catch and send the error to the collector endpoint.\n\n#### Custom events\n\n```js\n// Somewhere in your site\nza('send', 'event', {\"foo\": \"bar\"});\n```\n\nThe analytics script will send the event payload to the collector endpoint.\n\n## Badge\n\nZerØ Analytics is able to create tracked badges, which can easily be included in GitHub readmes or any other web page.\n\nBy default the badge will be: ![Using Zero Analytics](badge.svg)\n\nYou can customize the badge using the tracker section configuration.\n\nThen you can insert the badge into your web page:\n\n```html\n\u003c!-- Somewere in your site --\u003e\n\u003cimg src=\"http://localhost:8080/badge/UA-XXXX-Y.svg\" /\u003e\n```\n\nNote that a badge hit will produce a [custom event](#custom-events). This means that you are able to send a JSON base64 encode payload by using query parameters:\n\n```html\n\u003c!-- Somewere in your site --\u003e\n\u003cimg src=\"http://localhost:8080/badge/UA-XXXX-Y.svg?d=eyJmb28iOiJiYXIifQ%3D%3D\" /\u003e\n```\n\n#### Link clicks\n\n```html\n\u003c!-- Somewere in your site --\u003e\n\u003ca href=\"https://example.org\" ping=\"http://localhost:8080/ping/UA-XXXX-Y\"\u003eMy tracked link\u003c/a\u003e\n```\n\nThe browser will send the event to the collector endpoint if someone click on this link.\n\n***\n\n## License\n\nZerØ Analytics is provided under the [GNU Affero General Public License Version 3 (AGPLv3)](https://github.com/ncarlier/za/blob/master/LICENSE).\n\n```text\nZerØ Analytics is a Google Analytics alternative focused on privacy and simplicity.\n\nCopyright (C) 2020 Nicolas Carlier\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as\npublished by the Free Software Foundation, either version 3 of the\nLicense, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License\nalong with this program.  If not, see \u003chttps://www.gnu.org/licenses/\u003e\n```\n\n---\n\n[googol]: https://en.wikipedia.org/wiki/Googol\n[loki]: https://grafana.com/oss/loki/\n[Prometheus]: https://prometheus.io/\n[elastic]: https://www.elastic.co/\n[beacon_api]: https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API\n[hyperlink_auditing]: https://html.spec.whatwg.org/multipage/links.html#hyperlink-auditing","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncarlier%2Fza","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fncarlier%2Fza","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncarlier%2Fza/lists"}