Skip to main content

The hassle-free way to integrate amplitude into any python application.

Project description

Amplitude Tracker library lets you record analytics data from your Python code to Amplitude

Getting Started

Install amplitude-tracker using pip:

pip install amplitude-tracker

Inside your app, you’ll want to set your write_key before making any analytics calls:

import amplitude_tracker as amplitude

amplitude.write_key = 'xxxxxxxxxxxxxxx'

Note: If you need to send data to multiple Segment sources, you can initialize a new Client for each write_key.

Development Settings

The default initialization settings are production-ready and queue messages to be processed by a background thread.

In development you might want to enable some settings to make it easier to spot problems. Enabling amplitude.debug will log debugging info to the Python logger. You can also add an on_error handler to specifically print out the response you’re seeing from the Amplitude’s API.

def on_error(error, items):
    print("An error occurred:", error)


analytics.debug = True
analytics.on_error = on_error

Track

track lets you record the actions your users perform. Every action triggers what we call an “event”, which can also have associated properties.

import amplitude_tracker as amplitude
amplitude.write_key = 'xxxxxxxxxxxxxxx'

amplitude.track(
    user_id="xxx",
    event_type="xxx",
    user_properties={"trait": "xxx"},
    event_properties={"attribute": "xxx"})

Batching

This library is built to support high performance environments. That means it is safe to use amplitude-tracker on a web server that’s serving hundreds of requests per second.

Every call track method does not result in an HTTP request, but is queued in memory instead. Messages are flushed in batch in the background, which allows for much faster operation.

By default, this library will flush:

  • every 100 messages (control with upload_size)

  • if 0.5 seconds has passed since the last flush (control with upload_interval)

There is a maximum of 500KB per batch request and 32KB per call.

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

amplitude-tracker-0.0.6.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

amplitude_tracker-0.0.6-py2.py3-none-any.whl (15.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file amplitude-tracker-0.0.6.tar.gz.

File metadata

  • Download URL: amplitude-tracker-0.0.6.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2

File hashes

Hashes for amplitude-tracker-0.0.6.tar.gz
Algorithm Hash digest
SHA256 c8db4b552ac90cfa33e2a4853774d710ababbbb70a235ff5290843f1e609a0ca
MD5 6201f9592b288784313e79016cd5913a
BLAKE2b-256 edbacd58e4150914bec9e64256798d6524397a98c49b57ac00048ccbee16d4a8

See more details on using hashes here.

File details

Details for the file amplitude_tracker-0.0.6-py2.py3-none-any.whl.

File metadata

  • Download URL: amplitude_tracker-0.0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2

File hashes

Hashes for amplitude_tracker-0.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4201fc3a319f23a40690fc5db34f12e27a18cfe965bb1130192a1dfa3561489e
MD5 2f105dc56fd947f48adfc5a01d215e07
BLAKE2b-256 5f235bac0057101689244ae55ed47bfcd4c55c67063941a7bf633741efeb220e

See more details on using hashes here.

Supported by

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