Skip to content

APIv2: Behavioral filtering #66

Open
@dev-shah7

Description

@dev-shah7

Changes

This PR adds support for behavioral filtering by adding two new operators has_done and has_not_done to APIv2.

These operators can be used to filter whether users have completed (or not completed) a given at any point in their session. This can be used to exclude goals or check whether a user has done an additional action in their session.

In the following example, we could pageviews and visitors on /pricing page, but only by users who have opened support chat but have not registered or logged in either before or after visiting the page.

{
  "site_id": "dummy.site",
  "metrics": ["visitors", "pageviews"],
  "date_range": "7d",
  "filters": [
    ["is", "event:page", ["/pricing"]],
    ["has_done", ["is", "event:goal", ["Open Support Chat"]]],
    ["has_not_done", ["is", "event:goal", ["Register", "Login"]]]
  ]
}

Docs PR: plausible/docs#575 The operators are currently internal-only.
Basecamp ref: https://3.basecamp.com/5308029/buckets/26383192/card_tables/cards/7793417773

What's to be done

I'll open another PR to add support for users checking whether user has not done a goal. This turned out to be a bigger rabbit hole due to UI issues hence the split.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions