Opinionated Pyramid integration with Customer.io, a customer engagement platform.
Project description
Integrate your Pyramid app with Customer.io
Opinionated Customer.io integration
The reason this package exists is to provide sane defaults when integrating with Customer.io. Instead of chasing down event name typos and debugging why tracking does not work, you can focus on building meaningful customer relationships.
- You never have typo-duplicated events in Customer.io, because every event name comes from a dataclass, never from a string that can be miss-typed by mistake.
- Same for properties. Like events, properties are hardcoded as dataclasses.
- All "special" and "reserved" events and properties are already provided, no need to chase them down in various Customer.io docs.
- Your app never stops working if Customer.io is down, but you still get errors in your logs so you know what is going on.
- You never forget to call
flush()on the events buffer, sincepyramid_customeriohooks into the request life-cycle and callsflush()at the end of the request processing. - You defer sending events until the entire request is processed successfully, i.e. never send events like "User added a thing" if adding the thing to DB failed at a later stage in the request life-cycle.
Getting started
Install the package:
pip install pyramid_customerio
Or if you're using Poetry:
poetry add pyramid_customerio
Include the package in your Pyramid app configuration:
config.include('pyramid_customerio')
Configure your Customer.io credentials:
customerio.tracking.site_id = <your-site-id>
customerio.tracking.api_key = <your-api-key>
customerio.tracking.region = us # or 'eu'
Start tracking events and identifying users:
def my_view(request):
# Track an event
request.customerio.track(
request.customerio.events.user_signed_up,
{request.customerio.event_properties.path: request.path}
)
# Identify a user
request.customerio.identify({
request.customerio.profile_properties.email: 'user@example.com',
request.customerio.profile_properties.name: 'John Doe'
})
Development
This project uses Nix for development environment management and Poetry for Python dependency management.
Setup
# Enter the Nix development shell
nix-shell
# Install dependencies
make install
Running tests
# Run all tests with coverage
make test
# Run only unit tests
make unit
# Run specific tests
make unit filter="test_name"
Code quality
# Run linting
make lint
# Run type checking
make types
# Format code
make format
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyramid_customerio-1.0.0.tar.gz.
File metadata
- Download URL: pyramid_customerio-1.0.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.10 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0883b4e2c3df9a7f9468ce2b7d9809569e1571a30c2480fee5d0f72f77b3fae6
|
|
| MD5 |
9364695102f8dd5ea80d580432ccfcc5
|
|
| BLAKE2b-256 |
979c2683abbd858dc86703ea7ebed03e38bd9c67e28080320d0a7b2919c888f2
|
File details
Details for the file pyramid_customerio-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyramid_customerio-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.10 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee84f702ec1c2d9f9bb1b0f78fcfb51c75bc34ed6b95cb26a787fe725ad2ab2d
|
|
| MD5 |
19ed23bf599cd64049dc5ce677c2ea55
|
|
| BLAKE2b-256 |
90acf3e273669978b2bb0883bee0e9e15a52eb9ce377349271349dc2a4490e11
|