মূল কনটেন্টে যান

কোহর্ট

মানুষ কী করে বা কী, তা দিয়ে সংজ্ঞায়িত দল: প্রতিটি কোহর্ট একটি নাম ও একটি সংজ্ঞা, আর সংজ্ঞা হলো পাঠযোগ্য ধারা: এই ইভেন্ট এতবার এত দিনে, বা এই বৈশিষ্ট্য এই মানে। খালি সংজ্ঞা কাউকে বাছে না, ইচ্ছাকৃতভাবে।

The cohorts screen in the Live environment
The cohorts screen, Live environment.
The cohorts screen in the Live environment, dark theme
The cohorts screen, Live environment.

The library

Each card is one cohort: its name, whether it is active, how many people it currently selects and how fresh that answer is. A cohort whose clauses count behaviour over history is swept on a schedule and says when it was last evaluated, or that it never has been; one defined purely by current attributes is live and carries no timestamp, because a timestamp would imply a staleness it does not have. The toolbar narrows by search, kind and state, and deleting asks first, warning that analyses filtered by the cohort stop being filtered by it.

তৃতীয় একটি ধরন আছে, স্ট্যাটিক: সংজ্ঞা নয়, বরং মানুষের একটি নির্দিষ্ট তালিকা। এটি অ্যানালিটিক্স ওয়ার্কবেঞ্চের ফলাফল থেকে Save দিয়ে রাখা হয়, বা New cohort ডায়ালগে সাঁটা তালিকা থেকে বানানো হয়, এবং এটি কখনও পুনর্মূল্যায়ন হয় না, তাই যেখানে সুইপ করা কোহর্ট একটি সময়চিহ্ন দেখায় সেখানে এর কার্ড লেখে কখনও নয়, ইচ্ছাকৃতভাবে। খুললে সংজ্ঞার বদলে তালিকাটিই মেলে ধরে: কতজন মানুষ আছে, তালিকাটি কোথা থেকে এসেছে, Add people, আর প্রতিটি সারির পাশে একটি সরানোর বোতাম।

The definition editor

A cohort opened to its definition
A definition open under its card.
A cohort opened to its definition, dark theme
A definition open under its card.

Opening a card unfolds its definition in place: behavioural clauses (did an event at least so many times within so many days, with the project's own event names suggested) and state clauses (an attribute compared to a value). A cohort is named first and defined after, and an empty definition selects nobody rather than everybody, which the open row says in as many words. Opening a second card does not close the first, so two definitions can be compared side by side without losing edits.

New cohort প্রথমে নাম চায়, তারপর Membership, কারণ দুই ধরন দুইভাবে বানানো হয় এবং যে ডায়ালগ কোহর্টের নাম দেয় সেখানেই এর ধরন ঠিক হয়। Defined by rules উপরে বলা সংজ্ঞাটি দেয়। A fixed list of people খুলে দেয় ডিস্টিংক্ট আইডির একটি ঘর, প্রতি লাইনে একটি, একবারে ১০,০০০ পর্যন্ত, আর পরে আরও যোগ করা যায়; এভাবে বানানো কোহর্ট তার মানুষজন সঙ্গে নিয়েই জন্মায় এবং সঙ্গে সঙ্গে সক্রিয় থাকে।

Where cohorts are used

A cohort scopes a question in the Analytics workbench, targets a campaign in the Inbox, and gates workflow triggers on the Workflows screen. The same set of people, wherever the set is needed.

সারির উপর কপি করুন… এই বস্তুটি আগে থেকেই টিক দেওয়া অবস্থায় কনফিগারেশন কপি খোলে; দেখুন প্রকল্প, কনফিগারেশন কপি করা।

Where this meets the API

The concept behind the screen is the People and cohorts pillar; the people being selected are the People directory. On the wire: the library is the cohorts query, cohort reads one and cohortMemberCount counts its people; editing is createCohort, updateCohort, setCohortActive and deleteCohort; a static cohort is born by createStaticCohort from a pasted list or by createCohortFromResult from a result, its list moves by addCohortMembers and removeCohortMembers, and cohortMembers reads it back a page at a time (GraphQL reference).

The definition as JSON

A rules cohort's definition is one JSON object, the definition argument of createCohort and updateCohort and the definition field of the MCP tools prodantix.cohorts.create and prodantix.cohorts.update. It holds clauses, a list of at most 32, and a person is a member when every clause matches. An empty list selects nobody. A field the shape does not name is refused, so read an existing cohort with cohort or prodantix.cohorts.get before changing one.

JSON
{
  "clauses": [
    { "kind": "state", "condition": { "attribute": "plan", "op": "eq", "value": "pro" } },
    { "kind": "state", "condition": { "attribute": "country", "op": "in", "value": ["DE", "AT", "CH"] } },
    { "kind": "behavioural", "event": "purchase", "atLeast": 3, "withinDays": 30 }
  ]
}

State clauses

{ "kind": "state", "condition": { ... } }. The condition names an attribute, one of the person's properties or distinct_id, an op and, for most operators, a value. The operators are eq, neq, in, not_in, contains, gt, gte, lt, lte, is_set, is_not_set. eq, neq and contains compare as text; gt, gte, lt and lte compare as numbers; in and not_in take a list of values; is_set and is_not_set take none, and a property that is empty text counts as not set. A cohort made only of state clauses is live: a person joins or leaves the moment an event changes the property. The two cohort operators of flag targeting, in_cohort and not_in_cohort, are refused here: a cohort cannot be defined by another cohort.

Behavioural clauses

{ "kind": "behavioural", "event": "purchase", "atLeast": 3, "withinDays": 30 }: the person did the event at least atLeast times in the last withinDays days. Both are whole numbers, and a person counts only once they did the event at all, so an atLeast of 0 reads as 1. One behavioural clause makes the cohort swept: its members are worked out on a schedule rather than as events land, and the cohort says when it last was.

Static cohorts

A static cohort's definition is { "kind": "static", "clauses": [] }: its members are a list somebody wrote, not rules. Given to createCohort it makes an empty list; createStaticCohort or prodantix.cohorts.create_static makes one holding its people, and createCohortFromResult makes one from a result. An update cannot turn a rules cohort into a static one or back; make a new cohort of the kind you want.