Customer.io CDP Analytics Python SDK

raw JSON →
0.0.2 verified Fri May 01 auth: no python

Official Python SDK for Customer.io's Data Pipelines (CDP), enabling event tracking, identify calls, and real-time data ingestion. Version 0.0.2 (last updated 2025-03-17) requires Python >=3.6. Designed for server-side and backend integration.

pip install customerio-cdp-analytics
error ModuleNotFoundError: No module named 'customerio_cdp_analytics'
cause Trying to import from the incorrect module name matching the PyPI package slug.
fix
Use 'from customerio import CustomerIOClient' instead of any import starting with 'customerio_cdp_analytics'.
error AttributeError: module 'customerio' has no attribute 'CustomerIOClient'
cause The installed package is the old 'customerio' library (pre-2025), not the new CDP SDK. The old library uses different class names.
fix
Uninstall old package and install the new one: pip uninstall customerio && pip install customerio-cdp-analytics. Then use CustomerIOClient.
gotcha The PyPI package name is 'customerio-cdp-analytics', but the correct import uses 'customerio' (without suffix). Do not import from 'customerio_cdp_analytics'.
fix Use 'from customerio import CustomerIOClient' instead of 'from customerio_cdp_analytics import ...'.
deprecated This SDK replaces the legacy 'customerio' package (customerio-python). Users of the old library must migrate to this new SDK. Old code using 'from customerio import CIO' or 'tracker.track()' will not work.
fix Replace 'from customerio import CIO' with 'from customerio import CustomerIOClient' and adjust method calls (e.g., 'cio.track()' instead of 'tracker.track()').

Initialize client with site ID and API key, then call identify() and track().

from customerio import CustomerIOClient

cio = CustomerIOClient(
    site_id=os.environ.get('CIO_SITE_ID', ''),
    api_key=os.environ.get('CIO_API_KEY', '')
)
cio.identify(user_id='12345', attributes={'name': 'Jane'})
cio.track(user_id='12345', event_name='purchase', data={'item': 'book', 'price': 9.99})