Skip to main content

No project description provided

Project description

PRIVACY-FRIENDLY ANALYTICS TOOL

Usermaven-python

This module is compatible with Python 3.6 and above.

Installing

pip3 install usermaven-python

Usage

from usermaven import Client
client = Client(api_key='api_key', server_token="server_token")
client.identify({'email': 'john@gmail.com','id': '123', 'created_at': '2022'})
client.track('user_id', 'signed_up')

Instantiating usermaven-python's client object

Create an instance of the client with your Usermaven workspace credentials.

from usermaven import Client
client = Client(api_key="api_key", server_token="server_token")

Create a Usermaven user profile

client.identify({'email': 'john@gmail.com','id': '123', 'created_at': '2022'})

Required arguments

user: The user object is the only required argument for identify call. email, id and created_at are required fields for the user object. Recommended fields for the user object are first_name and last_name. Additionally you can pass any custom properties in the form of dictionary to your user object.

Optional arguments

You can also pass optional arguments to the identify method.

company: A company object for which the user belongs to. It is optional but if it is passed, it must contain name, id and created_at fields. You can also submit custom properties in the form of dictionary for the company object. Example:

client.identify({'email': 'john@gmail.com','id': '123', 'created_at': '2022'}, 
                company={'name': 'usermaven', 'id': '5', 'created_at': '2022',
                         'custom': {'plan': 'enterprise', 'industry': 'Technology'}})

Track a custom event

client.track('user_id', 'plan_purchased')

Required arguments

user_id: For the track call, you must pass the user_id of the user you want to track the event for.

event_type: For track call, event_type is a required argument and you must pass a value to the event_type. We recommend using [verb] [noun], like goal created or payment succeeded to easily identify what your events mean later on.

Optional arguments

You can also pass optional arguments to the track method.

company: A company object for which the user belongs to. It is optional but if it is passed, it must contain name, id and created_at fields. You can also submit custom properties in the form of dictionary for the company object. Example:

client.track('user_id', 'signed_up', company={'name': 'usermaven', 'id': '5', 'created_at': '2022',
                                              'custom': {'plan': 'enterprise', 'industry': 'Technology'}})

event_attributes: This can contain information related to the event that is being tracked. Example:

client.track('user_id', 'video_watched', event_attributes={'video_title': 'demo', 'watched_at': '2022'})

Local Setup for Development

For local development, you can clone the repository and install the dependencies using the following commands:

git clone "https://github.com/usermaven/usermaven-python.git"
poetry install

Running tests

Changes to the library can be tested by running python -m unittest -v from the parent directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

usermaven-0.1.0.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

usermaven-0.1.0-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file usermaven-0.1.0.tar.gz.

File metadata

  • Download URL: usermaven-0.1.0.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.6 Linux/5.15.0-57-generic

File hashes

Hashes for usermaven-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e620dbc500047b1590787364ce963e0f6ebbb1f0c1a3c1f51b35972d47073aad
MD5 942540e5bf6c6803efe929ed01c02a52
BLAKE2b-256 5162135bd8fdb079bb7c0372803178cdef4a302f23cef725633cd84215e398e3

See more details on using hashes here.

File details

Details for the file usermaven-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: usermaven-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.6 Linux/5.15.0-57-generic

File hashes

Hashes for usermaven-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e617625138bb45260c1a7092379b386e77f3a5e273288213e1935ca0f814472
MD5 40db702f86985cb982d02bc551be1060
BLAKE2b-256 0d117dccd9297fcd52a99d597cee8a9acdf9f778e29254b42963e9219a06e115

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page