{"id":14820002,"url":"https://github.com/lalabuy948/PhoenixAnalytics","last_synced_at":"2025-09-17T03:31:21.710Z","repository":{"id":255646670,"uuid":"843400835","full_name":"lalabuy948/PhoenixAnalytics","owner":"lalabuy948","description":"📊 Plug and play analytics for Phoenix applications.","archived":false,"fork":false,"pushed_at":"2025-09-07T12:14:05.000Z","size":2852,"stargazers_count":420,"open_issues_count":12,"forks_count":25,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-09-07T14:21:00.948Z","etag":null,"topics":["analytics","dashboard","elixir","liveview","phoenix"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lalabuy948.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-16T12:38:28.000Z","updated_at":"2025-09-07T12:12:34.000Z","dependencies_parsed_at":"2024-09-13T01:29:38.796Z","dependency_job_id":"165bea2a-5409-42e4-8332-ef2c6f59000b","html_url":"https://github.com/lalabuy948/PhoenixAnalytics","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"6b94e9d5970371c097413f0fbe4cf388a3523cba"},"previous_names":["lalabuy948/phoenixanalytics"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/lalabuy948/PhoenixAnalytics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lalabuy948%2FPhoenixAnalytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lalabuy948%2FPhoenixAnalytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lalabuy948%2FPhoenixAnalytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lalabuy948%2FPhoenixAnalytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lalabuy948","download_url":"https://codeload.github.com/lalabuy948/PhoenixAnalytics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lalabuy948%2FPhoenixAnalytics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274126035,"owners_count":25226530,"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-09-08T02:00:09.813Z","response_time":121,"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","dashboard","elixir","liveview","phoenix"],"created_at":"2024-09-18T18:00:38.818Z","updated_at":"2025-09-17T03:31:21.700Z","avatar_url":"https://github.com/lalabuy948.png","language":"JavaScript","funding_links":[],"categories":["Tools Powered by DuckDB"],"sub_categories":[],"readme":"# 📊 Phoenix Analytics\n\n\u003cp align=\"center\"\u003e\n  \u003ca title=\"GitHub CI\" href=\"https://github.com/lalabuy948/PhoenixAnalytics/actions\"\u003e\u003cimg src=\"https://github.com/lalabuy948/PhoenixAnalytics/actions/workflows/tests.yml/badge.svg\" alt=\"GitHub CI\" /\u003e\u003c/a\u003e\n  \u003ca title=\"Latest release\" href=\"https://hex.pm/packages/phoenix_analytics\"\u003e\u003cimg src=\"https://img.shields.io/hexpm/v/phoenix_analytics.svg\" alt=\"Latest release\" /\u003e\u003c/a\u003e\n  \u003ca title=\"View documentation\" href=\"https://hexdocs.pm/phoenix_analytics\"\u003e\u003cimg src=\"https://img.shields.io/badge/hex.pm-docs-blue.svg\" alt=\"View documentation\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003e [!IMPORTANT]\n\u003e **Version 0.4.0 Breaking Changes**: The 🦆 duck has been removed. Users who prefer the duckdb version should use the maintained fork: [**PhoenixAnalyticsDuck**](https://github.com/lalabuy948/PhoenixAnalyticsDuck)\n\n![](https://raw.githubusercontent.com/lalabuy948/PhoenixAnalytics/master/github/hero.png)\n\n![](https://raw.githubusercontent.com/lalabuy948/PhoenixAnalytics/master/github/screenshot.png)\n\nPhoenix Analytics is embedded plug and play tool designed for Phoenix applications. It provides a simple and efficient way to track and analyze user behavior and application performance without impacting your main application's performance and database.\n\nKey features:\n- ⚡️ Lightweight and fast analytics tracking\n- 🗄️ Flexible database support (PostgreSQL, SQLite3, MySQL)\n- 🔌 Easy integration with Phoenix applications\n- 📊 Minimalistic dashboard for data visualization\n- 🎨 12 customizable color themes\n- 🌙 Full dark mode support across all themes\n\n\u003e Phoenix Analytics now supports multiple database backends using Ecto, allowing you to choose the database that best fits your deployment environment and requirements. Whether you're using PostgreSQL in production, SQLite3 for development, or MySQL in your infrastructure, Phoenix Analytics will work seamlessly.\n\n## Installation\n\nIf [available in Hex](https://hex.pm/packages/phoenix_analytics), the package can be installed\nby adding `phoenix_analytics` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:phoenix_analytics, \"~\u003e 0.4\"}\n  ]\nend\n```\n\n### Configuration\n\nPhoenix Analytics uses your existing Ecto repository, making setup incredibly simple:\n\n```elixir\n# config/dev.exs\nconfig :phoenix_analytics,\n  repo: MyApp.Repo,\n  app_domain: System.get_env(\"PHX_HOST\") || \"example.com\",\n  cache_ttl: System.get_env(\"CACHE_TTL\") || 60\n```\n\n### Migration\n\nCreate the analytics table in your existing database:\n\n```sh\nmix ecto.gen.migration add_phoenix_analytics\n```\n\n```elixir\ndefmodule MyApp.Repo.Migrations.AddPhoenixAnalytics do\n  use Ecto.Migration\n\n  def up, do: PhoenixAnalytics.Migration.up()\n  def down, do: PhoenixAnalytics.Migration.down()\nend\n\n# indexes, no sqlite support\ndefmodule MyApp.Repo.Migrations.AddPhoenixAnalyticsIndexes do\n  def change do\n    PhoenixAnalytics.Migration.add_indexes()\n  end\nend\n```\n\n```sh\nmix ecto.migrate\n```\n\n\u003e **Alternative**: If you don't use migrations, you can run the migration directly:\n\u003e \n\u003e ```elixir\n\u003e iex -S mix\n\u003e PhoenixAnalytics.Migration.up()\n\u003e ```\n\nAdd plug to enable tracking to `endpoint.ex`, ‼️ add it straight after your `Plug.Static`\n\n```elixir\nplug PhoenixAnalytics.Plugs.RequestTracker\n```\n\nAdd dashboard route to your `router.ex`\n\n```elixir\nuse PhoenixAnalytics.Web, :router\n\nphoenix_analytics_dashboard \"/analytics\"\n```\n\n\u003e [!WARNING]\n\u003e ‼️ Please test thoroughly before proceeding to production!\n\n## Documentation\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm/phoenix_analytics). Once published, the docs can\nbe found at \u003chttps://hexdocs.pm/phoenix_analytics\u003e.\n\nShortcuts:\n\n- `t` -\u003e today\n- `ctrl+t` -\u003e yesterday\n- `w` -\u003e last_week\n- `m` -\u003e last_30_days\n- `q` -\u003e last_90_days\n- `y` -\u003e last_12_month\n- `ctrl+w` -\u003e previous_week\n- `ctrl+m` -\u003e previous_month\n- `ctrl+q` -\u003e previous_quarter\n- `ctrl+y` -\u003e previous_year\n- `a` -\u003e all_time\n\n### Development\n\nIf you would like to contribute, first you would need to install deps, assets and then compile css and js.\nI put everything under next mix command:\n\n```sh\nmix setup\n```\n\nThen you would need some database with seeds. Here is command for this:\n\n```sh\n# For SQLite3\nmix run priv/repo/seeds.exs sqlite 10000\n\n# For PostgreSQL\nmix run priv/repo/seeds.exs postgres\n\n# For MySQL\nmix run priv/repo/seeds.exs mysql 10000\n```\n\n\u003e [!NOTE]\n\u003e Move database with seeds to example project which you going to use.\n\nLastly you can use one of example applications to start server.\n\n```sh\ncd examples/sqlite/\n\nmix deps.get\n\nmix phx.server\n```\n\nYou can navigate to `http://localhost:4000/dev/analytics`\n\n## Performance test\n\nI performed [vegeta](https://github.com/tsenart/vegeta) test on basic Macbook Air M2, to see if plug will affect application performance.\nScript can be found here: `vegeta/vegeta.sh`\n\n| With plug              | Without                |\n| ---------------------- | ---------------------- |\n| ![with](/github/vegeta-with.png) | ![without](/github/vegeta-without.png) |\n\n## For whom this library\n\n- [x] Single instance Phoenix app (any supported database)\n- [x] Multiple instances of Phoenix app **without** auto scaling group (any supported database)\n- [x] Multiple instances of Phoenix app **with** auto scaling group (PostgreSQL or MySQL)\n\n### Heavily inspired by\n\n- [error-tracker](https://github.com/elixir-error-tracker/error-tracker)\n- [plausible.io](https://plausible.io)\n\n### Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=lalabuy948/PhoenixAnalytics\u0026type=Timeline)](https://www.star-history.com/#lalabuy948/PhoenixAnalytics\u0026Timeline)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flalabuy948%2FPhoenixAnalytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flalabuy948%2FPhoenixAnalytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flalabuy948%2FPhoenixAnalytics/lists"}