Companies are a concept which let you group users together. A company can be an organization, account, project, team or any other grouping is relevant for you.
Grouping users together into a company can help you unlock company level analytics to answer questions like:
How many companies signed up last month
How many companies are using your product daily
How many companies are retaining week over week
To get started with company level analytics in June, you need to send us information about the companies using your product.
1. Group call
The GROUP call is similar to the identify call, the only difference being that it helps you identify companies inside of your product instead of individual users.
An example from our SDK docs:
# python
analytics.group(
user_id="019mr8mf4r",
group_id="56",
traits={
"avatar": "http://ac1.googleusercontent.com",
"name": "Acme",
"description": "Entertainment"
},
)
Here, the user_id
and group_id
are unique identifiers of a user and a company in your database.
You can also send us traits with a GROUP call, which we use to populate that company's profile in June:
If your users can belong to only one company, then a GROUP call is all you need to use company analytics in June, and you can stop reading here.
Read further if your users can belong to multiple companies.
If your users can belong to multiple companies (for example, if your product is similar to Slack or GitHub), you'll need to tie their events to the company in which they're performing them.
2. Group context
If users can belong to multiple groups (e.g., multiple workspaces like "test" and "production" environments), standard group calls aren't enough for June to identify which group the user's actions belong to.
This situation applies to most B2B SaaS companies. In such cases, you must use group context to ensure events performed by a user are tied to a specific group or workspace.
What is Group Context?
Group context links an event to a specific object (e.g., a company or workspace) by including the unique identifier of that group.
How to implement Group Context
To set this up, include the unique group identifier (e.g., the company or workspace ID) as a groupId
in the context of your Track calls.
analytics.track('User Signed Up', {
plan: 'Pro',
context: {
groupId: 'company_12345' // Unique identifier for the group
}
});
By implementing group context, June can accurately attribute user actions to the correct group, ensuring your analytics remain clear and actionable.
2. Enable group context in your settings
Once you start sending group context, head to your object settings and enable the "Use Group Context" toggle.
Why should this toggle be turned off?
Keep this toggle off if you're doing a group identify with a custom object but haven’t implemented group context in your tracking events.
In this suboptimal scenario, June will attempt to help by running proxy queries to approximate group-level analytics. While this can provide some insights, it's not as accurate as fully implementing group context in your events.
For the best results, ensure group context is set up correctly in your tracking implementation!
That's it! With the GROUP call and the Group context, you're all set to harness the power of company analytics in June.