Log in

Identify your users & companies

See which users & companies are using your product

Have you installed the June SDK?

If you haven't installed one of the June SDKs, please do that first before implementing the .identify method.

See how to install the June SDK →

Users

Overview

This section provides guidance on using the identify method to successfully identify your product's users. This will show you which users are triggering events in June. It is recommended to include this code snippet in the section of your code where user sign-ups, logins, or account details updates are handled.

Code

Replace USER_ID with a unique identifier, preferably the user ID from your database. Including the user's email is also suggested, along with any additional "traits" like avatar, name, role, etc. This information will appear on the user's profile and can be used to filter users in reports.

1
window.analytics.identify('USER_ID', {
2
email: 'test@example.com',
3
// Optional
4
name: 'Joe Bloggs',
5
avatar: 'https://avatar.com/asd809sdhoif9as10nc29.png'
6
// Add anything else about the user here
7
});

Companies

Overview

If you're a B2B product, you most likely have actual businesses, known as "companies", using your product. Luckily, June creates them automatically for you by simply implementing an .identify call with an "email" trait from the previous step.

We use the user's email trait and automatically create companies based on the domain of the email, e.g. "jeff@amazon.com" would create a company called "amazon.com". This allows you to view your analytics at the company level. However, if you wish to add additional traits to these companies, you must send a .group call. Below is how you can achieve that.

Code

In order to send traits to one of the automatically generated companies in June, you need to send a .group call with an id as the domain of the company you wish to enrich and a group_type: "company" as a trait, along with any additional traits. Here's an example:

1
window.analytics.group('amazon.com', {
2
group_type: 'company',
3
// Add anything else about the company here
4
...
5
});

Groups

Overview

If you're a B2B product, you most likely have groups of users using your product, e.g. "workspaces", "organisations" etc. This section provides guidance on using the group method to successfully identify workspaces, organisations or any other type of user grouping which you may want to capture.

This will allow you to track usage at the "workspace" level in June, as well as viewing individual "workspace" profiles and the users that belong to each workspace. It is recommended to include this code snippet in the section of your code next to your identify call, i.e. where users sign up or login.

Code

Replace USER_ID and GROUP_ID with a unique identifier, preferably the user ID and workspace ID from your database. Including the company's name is also suggested, along with any additional "traits" like avatar, company_size etc. This information will appear on the companies profile and can be used to filter companies in reports.

In the following example, it's important to call the .identify call before the .group call, because the .group call will attach the current identified user.

1
window.analytics.group('GROUP_ID', {
2
name: 'Acme Inc',
3
// Optional
4
avatar: 'https://avatar.com/asd809sdhoif9as10nc29.png'
5
// Add anything else about the company here
6
});

Next: Track user & company behaviour

Once you've implemented the identify method in your codebase, it's time to track what your users & companies are doing in your product.

See how to track user & companies behaviour →