hissmetrics-0.1.1: Unofficial API bindings to KISSmetrics.

Safe HaskellSafe-Infered

Web.KISSmetrics

Description

This module is meant to be imported qualified:

 import qualified Web.KISSmetrics as KISSmetrics

Synopsis

Documentation

type APIKey = AsciiSource

Your KISSmetrics API key.

type SimpleText = AsciiSource

KISSmetrics names and identities are limited to at most 255 characters and all commas (,) and colons (:) are changed to spaces ( ). Nothing is checked by this Haskell library, so be careful =).

type Property = (SimpleText, Text)Source

A KISSmetrics property. The property names needs to follow the rules outlined on SimpleTexts documentation. The property value, on the other hand, are only limited to 8 KiB and don't have any other restrictions.

data Timestamp Source

A timestamp used only to ignore duplicated events.

Constructors

Automatic

Use KISSmetrics' servers time as the timestamp.

Manual UTCTime

Use given time as the timestamp.

data CallType Source

Constructors

Record

Record an event.

Fields

eventName :: SimpleText

Name of the event being recorded.

identity :: SimpleText

Identity of the person you're aliasing.

Identity of the person whose properties will to be changed.

Identity of the person doing the event.

timestamp :: Timestamp

See Timestamp.

See Timestamp.

properties :: [Property]

Properties to be set.

Any additional properties you may want.

SetProps

Set user properties without recording an event.

Fields

identity :: SimpleText

Identity of the person you're aliasing.

Identity of the person whose properties will to be changed.

Identity of the person doing the event.

timestamp :: Timestamp

See Timestamp.

See Timestamp.

properties :: [Property]

Properties to be set.

Any additional properties you may want.

Alias

Alias two identities as the same one.

Fields

identity :: SimpleText

Identity of the person you're aliasing.

Identity of the person whose properties will to be changed.

Identity of the person doing the event.

identity' :: SimpleText

Other identity you want to alias.

callSource

Arguments

:: Manager

HTTP connection manager (cf. newManager).

-> APIKey

Your KISSmetrics API key.

-> CallType

Which call you would like to make.

-> IO () 

Call KISSmetrics' API. See CallType for documentation about which calls you may make.

Note that official KISSmetrics' APIs provide many functions (usually four) while we provide just this one and a sum data type. This function alone does the work of record, set, identify and alias.

TODO: Currently there's no support for automatically retrying failed request, you need to retry yourself.