Activities

Business logic as code

Activities are building blocks that represent your business

Activities are SQL queries that represent a single customer action.

A series of these activities around one customer create an Activity Stream

They make a semantic layer that is simple to understand and use.

Diagram showing a single table (the activity stream) with plots depending on it
Diagram showing a single table (the activity stream) with the customer column highlighted

Activities are centered around one "customer"

A customer is the entity that is doing the actions or the actions are being done on. Customer can be a person, scooter, car, company, etc..

SINGLE MODELING LAYER

Simple SQL

Use only really really simple SQL

Diagram showing a single table (the activity stream) with plots depending on it

How to create a good activity

The Activity Schema was designed assuming that data is messy: foreign keys don't exist, duplication in the source, multiple identifiers, etc...

Good Names

Use the same language that people are using in your business

Don't embed data from other activities

Activities should have data that is self- sufficient.

You need one or two streams

Raw data goes into the Activity Stream and then that is used to generate any table. Everything you need is built on top of this one table making data more reliable and trusted.

Simple Actions

Don't model everything, or don't have just a couple of activities. This makes sense later when you learn how to query the Activity Stream

Example activities

Stripe

  • Started subscription
  • Received invoice
  • Paid invoice

Shopify

  • Purchased product
  • Shipped product
  • Completed order

Salesforce

  • Submitted lead
  • Opportunity created
  • Received contract

Internal Database

  • Received Referral
  • Signed up
  • Added product review

Mixpanel

  • Logged in
  • Viewed paywall
  • Submitted search

Iterable

  • Bounced email
  • Opened email
  • Unsubscribed email

Xero

  • Made payment
  • Received invoice
  • Paid invoice

Zendesk

  • Rated support experience
  • Submitted ticket
  • Closed ticket

Pardot

  • Bounced email
  • Clicked email
  • Opened email