ExHeap v0.1.0 ExHeap View Source

ExHeap is a small wrapper for sending tracking and user data to Heap Analytic's Server-Side API.

It takes care of forming the requests, headers, etc, but mostly lets you pass through your data untouched.

Basic usage:

  iex> ExHeap.track("user@example.com", "My Heap Event", %{"extra_id" => 1234})
  {:ok, %HTTPoison.Response{...}}

  iex> ExHeap.add_user_properties("user@example.com", %{"company_name" => "MegaCorp"})
  {:ok, %HTTPoison.Response{...}}

Link to this section Summary

Link to this section Functions

Link to this function

add_user_properties(identity, properties \\ %{})

View Source

Assign customer properties to a user

https://developers.heap.io/reference#add-user-properties

Parameters

  • identity - string to identify the user (probably an email)
  • properties - arbitrary map of key/value pairs enrich user data

Examples

iex> ExHeap.add_user_properties("user@example.com", %{"key" => "value"})
{:ok, %HTTPoison.Response{...}}
Link to this function

track(identity, event, properties \\ %{})

View Source

Track a user event

https://developers.heap.io/reference#track-1

Parameters

  • identity - string to identify the user (probably an email)
  • event - event name to pass to Heap
  • properties - arbitrary map of key/value pairs to annotate event

Examples

iex> ExHeap.track("user@example.com","My Event")
{:ok, %HTTPoison.Response{...}}

iex> ExHeap.track("user@example.com","My Event", %{"custom_property" => "foo"})
{:ok, %HTTPoison.Response{...}}