{"id":13509584,"url":"https://github.com/novabyte/pathway","last_synced_at":"2025-10-20T12:02:44.363Z","repository":{"id":22468588,"uuid":"25807405","full_name":"novabyte/pathway","owner":"novabyte","description":"An Erlang/Elixir client library for the Trak.io REST API.","archived":false,"fork":false,"pushed_at":"2014-11-06T09:26:34.000Z","size":184,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T05:36:35.900Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://hexdocs.pm/pathway/","language":"Elixir","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/novabyte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-27T07:13:26.000Z","updated_at":"2022-08-26T09:42:09.000Z","dependencies_parsed_at":"2022-08-20T16:50:57.662Z","dependency_job_id":null,"html_url":"https://github.com/novabyte/pathway","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novabyte%2Fpathway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novabyte%2Fpathway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novabyte%2Fpathway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novabyte%2Fpathway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/novabyte","download_url":"https://codeload.github.com/novabyte/pathway/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248155436,"owners_count":21056638,"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","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":[],"created_at":"2024-08-01T02:01:09.936Z","updated_at":"2025-10-20T12:02:44.252Z","avatar_url":"https://github.com/novabyte.png","language":"Elixir","funding_links":[],"categories":["Third Party APIs"],"sub_categories":[],"readme":"Pathway\n=======\n\nAn Erlang/Elixir client for the Trak.io [REST API](http://docs.trak.io/).\n\n[Trak.io](http://trak.io/) is a service that allows you to save details about your users (people) and their behaviour (events). The service can take in different types of customer data, such as feature usage, payments, support tickets and email history, and then automatically segment users based on that data.\n\nPathway is created and maintained by Chris Molozian (@novabyte) and contributors.\n\u003cbr/\u003e\nCode licensed under the [Apache License v2.0](http://www.apache.org/licenses/LICENSE-2.0).\n Documentation licensed under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0/).\n\n## Download ##\n\nPathway is available on [Hex.pm](https://hex.pm/packages/pathway).\n\nAdding Pathway to your application takes two steps:\n\n1. Add `pathway` to your `mix.exs` dependencies:\n\n    ```elixir\n    def deps do\n      [{:pathway, \"~\u003e 0.1\"}]\n    end\n    ```\n\n2. Add `:pathway` to your application dependencies:\n\n    ```elixir\n    def application do\n      [applications: [:pathway]]\n    end\n    ```\n\n## Usage ##\n\nYou'll need an API key to use the Trak.io service so you must create an account before you can configure the client.\n\n### Configuration ###\n\nThe client can be configured in the usual way by adding these settings to your `config.exs` file:\n\n```elixir\nconfig :pathway,\n  apikey: \"a Trak.io apikey\",\n  timeout: 3000 # optional\n  retries: 2    # optional\n```\n\nOnly the __apikey__ is a required configuration property. The other properties are initialised with default values.\n\n### Example ###\n\nThe client creates a connection to the Trak.io API server on `Pathway.Client.start_link`. The `Pathway.Client` is a `GenServer` whose process is linked to the connection's `pid`. If the connection dies the `Pathway.Client` will also die. For this reason it's recommended to supervise the client in your application:\n\n```elixir\n  # within your Application start callback\n  children = [\n    worker(Pathway.Client, [[]])\n  ]\n  opts = [strategy: :one_for_one, name: YourApp.Supervisor]\n  Supervisor.start_link(children, opts)\n```\n\nAlternatively, if you don't want to supervise the client or you're experimenting in the iex console you can manually start the client:\n\n```\n{:ok, _pid} = Pathway.Client.start_link()\n```\n\nSee [Supervisor and Application](http://elixir-lang.org/getting_started/mix_otp/5.html) and [`Application`](http://elixir-lang.org/docs/stable/elixir/Application.html) for more information.\n\n### Sending Events ###\n\nOnce the client has been initialised you can start making requests to the Trak.io API. For example, let's assume you have a signup function that gets called when a user signs up, this would be a good opportunity to create an __identity__ for the new user.\n\n```elixir\n# create a map of whatever properties you want to associate\n# with the user's identity\nuser = %{name: \"Some User\", email: \"user@email.com\", id: \"a new user's ID\"}\nPathway.identity(user.id, user)\n\n# you might also want to send an event for the action\nPathway.track(user.id, \"user signed up\")\n```\n\nFor more detailed examples on using Pathway check out the [documentation](http://hexdocs.pm/pathway/) and Trak.io's [API documentation](https://docs.trak.io/).\n\n__Note__: This client is complete but under development, any feedback and bug reports are welcome.\n\n### Usage with Erlang ###\n\nElixir code compiles down directly to BEAM bytecode and is completely compatible with Erlang without requiring a \"translation layer\", runtime introspection or any kind of compatibility layer.\n\nWorking with this library from Erlang is as simple as remembering the module prefix created by the Elixir compiler and calling the module's function.\n\nAn equivalent Erlang example to the one above:\n\n```erlang\nUser = #{\"name\" =\u003e \u003c\u003c\"Some User\"\u003e\u003e, \"email\" =\u003e \u003c\u003c\"user@email.com\"\u003e\u003e, \"id\" =\u003e \u003c\u003c\"a new user's ID\"\u003e\u003e}\nUserId = maps:get(User, \"id\")\n'Elixir.Pathway':identify(UserId, User)\n'Elixir.Pathway':track(UserId, \u003c\u003c\"user signed up\"\u003e\u003e)\n```\n\n## Developer Notes ##\n\nThis codebase uses [`fusco`](https://github.com/esl/fusco) to make HTTP requests to the Trak.io API and [`poison`](https://github.com/devinus/poison) to handle JSON serialization.\n\n### Errors ###\n\nIf you see a `GenServer` error message like (or similar):\n\n```\n** (exit) exited in: GenServer.call(Pathway.Client, [\"...\"], 5000)\n    ** (EXIT) no process\n     (elixir) lib/gen_server.ex:356: GenServer.call/3\n    (pathway) lib/pathway/client.ex:43: Pathway.Client.request/2\n```\n\nIt means the `Pathway.Client` process has died or was not started. See [here](#usage) for how to supervise the client.\n\n### Contribute ###\n\nAll contributions to the documentation and the codebase are very welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovabyte%2Fpathway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnovabyte%2Fpathway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovabyte%2Fpathway/lists"}