Basic HTTP wrapper for the Segment service.
Package can be installed by adding segment_api
to your list of dependencies in mix.exs
:
def deps do
[
{:segment_api, github: "pixelunion/elixir-segment-api", tag: "v0.4.0"}
]
end
Add the following configuration to your config.ex
config :segment_api, :api_key, "<your encoded basic auth keys>"
Uses Jason for json transcoding by default, if you want to configure it to use Poison add the following.
config segment_api, json_library, Poison
Use like
app_slug = "USO"
shopify_domain = "example.myshopify.com"
type = :customer_data_request
SegmentAPI.track(
SegmentAPI.event(app_slug, type),
shopify_domain,
%{data: %{foo: "bar"}},
%{integrations: %{All: true, Salesforce: false}}
)