Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

wecounsel/rudder

Repository files navigation

Rudder

Elixir package for interacting with RudderStack HTTP API

Installation

If available in Hex, the package can be installed by adding rudder to your list of dependencies in mix.exs:

def deps do
  [
    {:rudder, "~> 0.1.0"}
  ]
end

Create a client

client = Rudder.Client.new(write_key: "abc123", data_plane_url: "https://example.com")

Identify

Rudder.identify(client, %Rudder.Identity{
  user_id: "123",
  context: %{ip: '10.81.20.10'},
  traits: %{email: user.email }
})

See Docs

Track

Rudder.track(client, %Rudder.Event{
  user_id: "123",
  name: "Item Sold",
  properties: %{revenue: 9.95, shipping: 'Free'}
})

See Docs

Page

Rudder.page(client, %Rudder.Page{
  user_id: "123",
  name: "Page View",
  properties: %{title: "Home", path: "/"}
})

See Docs

Screen

Rudder.screen(client, %Rudder.Screen{
  user_id: "123",
  name: "Screen View",
  properties: %{prop1: "5"}
})

See Docs

Group

Rudder.group(client, %Rudder.group{
  user_id: "123",
  group_id: "group-a",
  traits: %{
    name: "Company",
    industry: "Industry",
    employees: 123
  },
  context: %{
    ip: "14.5.67.21"
  }
})

See Docs

Alias

Rudder.alias(client, %Rudder.Alias{
  user_id: "123",
  previous_id: "456",
  context: %{
    traits: %{
      trait1: "new-val"
    },
    ip: "14.5.67.21"
  }
})

See Docs

Merge

Rudder.merge(client, %Rudder.Merge{
  user_id: "123",
  merge_properties: [
    %{type: "email", value: "someone@example.com"},
    %{type: "mobile", value: "+15555552263"}
})

See Docs

Batch

Rudder.batch(client, %Rudder.Batch{
  items: [
    %Rudder.Identity{
      user_id: "123",
      context: %{ip: '10.81.20.10'},
      traits: %{email: user.email }
    },
    %Rudder.Page{
      user_id: "123",
      name: "Page View",
      properties: %{title: "Home", path: "/"}
    }
  ]
)

See Docs

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/rudder.

About

A RudderStack Client for Elixir

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages