Apache-2.0 licensed by Domen Kožar
This version can be pinned in stack with:mixpanel-client-0.3.0@sha256:ee01055b13dafc3d112d2b0c354b4c29beda51e0a87c2a8fa59575e58efc80b4,2658
Module documentation for 0.3.0
Depends on 11 packages
(full list with versions):
aeson,
base,
base64-bytestring,
bytestring,
http-client,
http-client-tls,
servant,
servant-client,
string-conv,
text,
time MixPanel client for Haskell
Implements major features of MixPanel HTTP API:
- [x] track
- [x] alias
- [x] engage
- [ ] import
- [ ] export
Getting started
import Data.Aeson ( (.=) )
import Data.Time.Clock ( getCurrentTime )
import GHC.Exts ( fromList )
import MixPanel ( Operation(Set), engage, track, alias
, AuthToken(..), mkEnv
-- reexports
, newManager, tlsManagerSettings)
main :: IO ()
main = do
-- setup
manager <- newManager tlsManagerSettings
let env = mkEnv (AuthToken "foobar") manager
-- track a simple event
Right () <- track env "Played Video" mempty
-- track an event with extra properties
Right () <- track env "Played Video Unique per user"
$ fromList [ "distinct_id" .= ("generated-id" :: String)
, "customProperty" .= True ]
-- alias the user
Right () <- alias env "generated-id" "[email protected]"
-- profile engagement
now <- getCurrentTime
Right () <- engage env "[email protected]"
$ Set (fromList [ "$created" .= now])
putStrLn "All good!"
Design questions
a) Why does it use Object/Array
intemediate values from Data.Aeson
?
TODO
- batch requests
- expose extra url query paramerers
- engage special properties more type safe?
- filter out null values in requests to mixpanel
- api support for tracking revenue
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog
and this project adheres to Semantic Versioning.
[Unreleased]
[0.3.0] - 2020-12-14
Fixed
- expose EngageData
- EngageData.ignoreTime should be a
Maybe Bool
- fix parsing of ignoreTime
[0.2.1] - 2019-08-26
Fixed
- 0.2.0 was a brown-paper-bag release
[0.2.0] - 2019-03-13
Changes
- #4 add servant 0.16 support @domenkozar
[0.1.1] - 2018-11-28
Changes
- ditch hpack @domenkozar
- add Show instance for MixpanelError
[0.1.0.0] - 2018-08-25
- Intial release @domenkozar