Skip to main content

No project description provided

Project description

Dark/Light mode logos

PRIVACY-FRIENDLY ANALYTICS TOOL

PyPI Software License PyPI - Python Version

Usermaven Python

This module is compatible with Python 3.6 and above.

Installing

pip3 install usermaven

Usage

from usermaven import Client
client = Client(api_key='your_workspace_api_key', server_token="your_workspace_server_token")
client.identify(user={'email': 'user@domain.com','id': 'lzL24K3kYw', 'created_at': '2022-01-20T09:55:35'})
client.track(user_id='lzL24K3kYw', event_type='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='your_workspace_api_key', server_token="your_workspace_server_token")

Create a Usermaven user profile

client.identify(user={'email': 'user@domain.com','id': 'lzL24K3kYw', 'created_at': '2022-01-20T09:55:35'})

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(user={
    # Required attributes of user object
    'email': 'user@domain.com', 'id': 'lzL24K3kYw', 'created_at': '2022-01-20T09:55:35',
    
    # Recommended attributes - First name and last name are shown on people pages.
    'first_name': 'John', 'last_name': 'Smith',
    
    # Optional attributes (you can name attributes what you wish)
    'custom': {'plan_name': 'premium'}
    }, 
    
    # If your product is used by multiple users in a company, we recommend to pass the Company attributes.
    company={
        # Required attributes of company object
        'name': 'Usermaven', 'id': 'uPq9oUGrIt', 'created_at': '2022-01-20T09:55:35',
        
        # Optional attributes such as industry, website, employee count etc.
        'custom': {'plan': 'enterprise', 'industry': 'Technology', 'website': 'https://usermaven.com', 
                   'employees': '20'}
    })

Track a custom event

client.track(user_id='lzL24K3kYw', event_type='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.

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

client.track(
    user_id='lzL24K3kYw', # Unique ID for the user in database. (Required)
    event_type='plan_purchased', # Event name to be tracked (Required)
    
    # Optional attributes
    company={
        # Required attributes of company object
        'name': 'Usermaven', 'id': 'uPq9oUGrIt', 'created_at': '2022-01-20T09:55:35',
        
        # Optional attributes such as industry, website, employee count etc.
        'custom': {'plan': 'enterprise', 'industry': 'Technology', 'website': 'https://usermaven.com', 
                   'employees': '20'}
        },
    
    event_attributes={
        'plan_name': 'premium',
        'plan_price': '100',
        'plan_currency': 'USD'
        }
    )

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.1.tar.gz (53.8 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.1-py3-none-any.whl (53.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: usermaven-0.1.1.tar.gz
  • Upload date:
  • Size: 53.8 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.1.tar.gz
Algorithm Hash digest
SHA256 003533056ea8f91660be3f1caa2c7b43bb201c92202b09e053e846b37f3fddd9
MD5 d04173d31e1ffc0b2caaaa352af0c56e
BLAKE2b-256 438e693ce86f8fcf4981bb392eaaa67caef17f23bb2b5312d98cd7d45e264322

See more details on using hashes here.

File details

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

File metadata

  • Download URL: usermaven-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 53.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 161b1f26feefb09a5d4a90b287ebd10feaa6b6e48ded0895cae2a508ffbbea1b
MD5 cb075cc1a05458a7299208a3bd875c69
BLAKE2b-256 fa7a4d027c588c0711213168b460451754e7ead8c7d1b3ec6ad039590262ea5b

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