py-KISSmetrics documentation

Contents:

class KISSmetrics.Client(key, trk_host='trk.kissmetrics.com', trk_scheme='http')

Interface to KISSmetrics tracking service

alias(person, identity, path='a')

Map person to identity; actions done by one resolve to other.

Parameters:
  • person (str or unicode) – consider as same individual identity; the source of the alias operation
  • identity (str or unicode) – consider as an alias of person; the target of the alias operation
  • path – HTTP endpoint to use; defaults to KISSmetrics.ALIAS_PATH
Returns:

an HTTP response for the request

Return type:

urllib3.response.HTTPResponse

Note the direction of the mapping is person to identity (so “person is also known as identity” or “person => identity” when looking at it as “<source> => <target>”)

When consulting the Aliasing documentation, person corresponds to query_string.PERSON_PARAM and identity corresponds to query_string.ALIAS_PARAM.

Aliasing is not a reversible operation. When aliasing to an identity, take care not to use a session identifier or any other value that is not relatively stable (a value that will not change per request or per session).

For more information see the API Specifications on Aliasing.

record(person, event, properties=None, timestamp=None, path='e')

Record event for person with any properties.

Parameters:
  • person – the individual performing the event
  • event – the event name that was performed
  • properties (dict) – any additional data to include
  • timestamp – when the event was performed; optional for back-dating
  • path – HTTP endpoint to use; defaults to KISSmetrics.RECORD_PATH
Returns:

an HTTP response for the request

Return type:

urllib3.response.HTTPResponse

set(person, properties=None, timestamp=None, path='s')

Set a property (or properties) for a person.

Parameters:
  • person – individual to associate properties with
  • properties (dict) – key-value pairs to associate with person
  • timestamp – when the event was performed; optional for back-dating
  • path – HTTP endpoint to use; defaults to KISSmetrics.SET_PATH
Returns:

an HTTP response for the request

Return type:

urllib3.response.HTTPResponse

class KISSmetrics.ClientCompat(key, host=None, http_timeout=None, logging=True)

Compatibility interface to KISSmetrics tracking service

Warning

Interface only exists for compatibility and will not be supported in the future.

alias(name, alias_to, path='a', resp=False)

Map name to alias_to; actions done by one resolve to other.

Parameters:
  • name – consider as same individual as alias_to
  • alias_to – consider an alias of name
  • path – endpoint path; defaults to KISSmetrics.ALIAS_PATH
  • resp (boolean) – indicate whether to return response
Returns:

an HTTP response for request if resp=True

Return type:

urllib3.response.HTTPResponse

Raises :

Exception if either identity or key not set

identify(identity)

Define identity for subsequent calls.

Parameters:identity (str or unicode) – identifying info (email, user-id, anonymous-id)
log_file()

Retrieve path to log file.

Note

Will log to '/tmp/kissmetrics_error.log'; cannot be modified.

record(action, props=None, path='e', resp=False)

Record event for identity with any properties.

Parameters:
  • action – event performed
  • props (dict) – any additional data to include
  • resp (boolean) – indicate whether to return response
Returns:

an HTTP response for request if resp=True

Return type:

urllib3.response.HTTPResponse

Raises :

Exception if either identity or key not set

reset()

Reset identity and key attributes.

Warning

After calling this method, further calls to record, set, & alias will raise an Exception. You will need to set the API key again via key attribute and call identify.

set(data, path='s', resp=False)

Set a properties provided in data for identity.

Parameters:
  • data (dict) – key-value pairs to associate with identity
  • path – endpoint path; defaults to KISSmetrics.SET_PATH
  • resp (boolean) – indicate whether to return response
Returns:

an HTTP response for request if resp=True

Return type:

urllib3.response.HTTPResponse

Raises :

Exception if either identity or key not set

Indices and tables

Read the Docs v: ajl-fix-docs-copyright
Versions
latest
ajl-fix-docs-copyright
v1.0.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.