Skip to main content

Opinionated Pyramid integration with Customer.io, a customer engagement platform.

Project description

Integrate your Pyramid app with Customer.io

License: MIT Built by these great folks! Talk to us in #pyramid on Libera.Chat IRC

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, since pyramid_customerio hooks into the request life-cycle and calls flush() 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


Download files

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

Source Distribution

pyramid_customerio-1.0.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

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

pyramid_customerio-1.0.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

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

Hashes for pyramid_customerio-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0883b4e2c3df9a7f9468ce2b7d9809569e1571a30c2480fee5d0f72f77b3fae6
MD5 9364695102f8dd5ea80d580432ccfcc5
BLAKE2b-256 979c2683abbd858dc86703ea7ebed03e38bd9c67e28080320d0a7b2919c888f2

See more details on using hashes here.

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

Hashes for pyramid_customerio-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee84f702ec1c2d9f9bb1b0f78fcfb51c75bc34ed6b95cb26a787fe725ad2ab2d
MD5 19ed23bf599cd64049dc5ce677c2ea55
BLAKE2b-256 90acf3e273669978b2bb0883bee0e9e15a52eb9ce377349271349dc2a4490e11

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