Explore event sequences, naturally

Rich interactive visualizations for identifying patterns in user and business flows, with full visibility into underlying computation.

Barcode ViewFunnel ViewGraph View

Query how
you think

A small set of sequence operations providing full expressivity and fine-grained control in under 10 lines of code.

match View_Homepage >> * >> Add_to_Cart? >> * >> Review_Order?
  if duration(View_Homepage, Review_Order) < 1h
  and View_Homepage.ts > '2023-02-01' and Review_Order.ts < '2023-02-16'
  
  
// That's it, seriously
  
  
  

Yeah, it keeps going
with
    users_in_step_1 as (
        select distinct user_id
        from `events`
        where
            event_timestamp >= '2023-02-01 00:00:00'
            and event_timestamp < '2023-02-16 00:00:00'
            and event_name = 'View Homepage'
    ),
    candidates_in_step_2 as (
        select
            user_id,
            case
                when event_name = 'View Homepage'
                then 'A'
                when event_name = 'Add to Cart'
                then 'B'
            end as event_identifier,
            string_agg(
                case
                    when event_name = 'View Homepage'
                    then 'A'
                    when event_name = 'Add to Cart'
                    then 'B'
                end,
                ''
            ) over funnel_duration as preceding_event_identifiers
        from `events`
        where
            event_timestamp >= '2023-02-01 00:00:00'
            and event_timestamp < '2023-02-16 00:00:00'
            and ((event_name = 'View Homepage') or (event_name = 'Add to Cart'))
            and user_id in (select user_id from users_in_step_1)
        window
            funnel_duration as (
                partition by user_id
                order by
                    unix_seconds(event_timestamp) range
                    between 3600 preceding and current row
            )
    ),
    users_in_step_2 as (
        select
            user_id,
            logical_or(
                event_identifier = 'B'
                and regexp_contains(preceding_event_identifiers, 'A.*B')
            ) as made_it_to_step_2
        from candidates_in_step_2
        group by user_id
        having made_it_to_step_2 = true
    ),
    candidates_in_step_3 as (
        select
            user_id,
            case
                when event_name = 'View Homepage'
                then 'A'
                when event_name = 'Add to Cart'
                then 'B'
                when event_name = 'Review Order'
                then 'C'
            end as event_identifier,
            string_agg(
                case
                    when event_name = 'View Homepage'
                    then 'A'
                    when event_name = 'Add to Cart'
                    then 'B'
                    when event_name = 'Review Order'
                    then 'C'
                end,
                ''
            ) over funnel_duration as preceding_event_identifiers
        from `events`
        where
            event_timestamp >= '2023-02-01 00:00:00'
            and event_timestamp < '2023-02-16 00:00:00'
            and (
                (event_name = 'View Homepage')
                or (event_name = 'Add to Cart')
                or (event_name = 'Review Order')
            )
            and user_id in (select user_id from candidates_in_step_2)
        window
            funnel_duration as (
                partition by user_id
                order by
                    unix_seconds(event_timestamp) range
                    between 3600 preceding and current row
            )
    ),
    users_in_step_3 as (
        select
            user_id,
            logical_or(
                event_identifier = 'C'
                and regexp_contains(preceding_event_identifiers, 'A.*B.*C')
            ) as made_it_to_step_3
        from candidates_in_step_3
        group by user_id
        having made_it_to_step_3 = true
    )
select
    (select count(*) from users_in_step_1) as step_1_count,
    (select count(*) from users_in_step_2) as step_2_count,
    (select count(*) from users_in_step_3) as step_3_count

Tune query precision and speed

An incremental query engine to seamlessly trade between query precision, speed and cost according to your needs.

Two ways to use Motif

Individual

All the power of sequence analytics, running locally on your machine
Runs locally, up to 2M events
Data loading via CSV, JSON and Parquet files
1 user
Email and office hours support

Company

Sequence analytics at scale for teams and companies, run on the cloud
100M–10B+ events, 10M+ events/second query speeds
Connectors to major data warehouses
Unlimited users
Dedicated email & live chat support, activation & ongoing live training