1window.analytics.identify('USER_ID', { 2email: 'test@example.com', 3// Optional 4name: 'Joe Bloggs', 5avatar: 'https://avatar.com/asd809sdhoif9as10nc29.png' 6// Add anything else about the user here 7});
If you haven't installed one of the June SDKs, please do that first before implementing the .identify
method.
This document 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.
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.
1window.analytics.identify('USER_ID', { 2email: 'test@example.com', 3// Optional 4name: 'Joe Bloggs', 5avatar: 'https://avatar.com/asd809sdhoif9as10nc29.png' 6// Add anything else about the user here 7});
1analytics.identify('USER_ID',{ 2email: 'test@example.com', 3// Optional 4name: 'Joe Bloggs', 5avatar: 'https://avatar.com/asd809sdhoif9as10nc29.png' 6// Add anything else about the user here 7});
1analytics.identify({ 2userId: 'USER_ID', 3traits: { 4email: 'test@example.com', 5// Optional 6name: 'Joe Bloggs', 7avatar: 'https://avatar.com/asd809sdhoif9as10nc29.png' 8// Add anything else about the user here 9} 10});
1analytics.identify( 2user_id="USER_ID", 3traits={ 4"email": "test@example.com", 5# Optional 6"name": "Joe Bloggs", 7"avatar": "https://avatar.com/0sd9fsd8y97a0sf99asd.png", 8# Add anything else about the user here 9}, 10)
1Analytics.identify( 2user_id: 'USER_ID', 3traits: { 4email: "test@example.com" 5# Optional 6name: "Joe Bloggs", 7avatar: "https://avatar.com/d78979as8hlsa9088f.png" 8# Add anything else about the user here 9} 10)
1curl https://api.june.so/sdk/identify 2-H "Content-Type: application/json" 3-H "Authorization: Basic YOUR_WRITE_KEY" 4-X POST 5 6{ 7"userId": "USER_ID", 8"traits": { 9"email": "test@example.com", 10# Optional 11"name": "Joe Bloggs", 12"avatar": "https://avatar.com/0sd9fsd8y97a0sf99asd.png", 13# Add anything else about the user here 14}, 15"timestamp": "2012-12-02T00:31:38.208Z" 16}
If you're a B2B product, you most likely have multiple users using your product in a "workspace". This document provides guidance on using the group
method to successfully identify companies using your product.
This will allow you to track usage at the company level in June, as well as viewing individual company profiles and the users that belong to each company. 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.
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.
1window.analytics.group('GROUP_ID', { 2name: 'Acme Inc', 3// Optional 4avatar: 'https://avatar.com/asd809sdhoif9as10nc29.png 5// Add anything else about the company here 6});
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.
1analytics.group('GROUP_ID', 2{ 3name: 'Acme Inc', 4// Optional 5avatar: 'https://avatar.com/asd809sdhoif9as10nc29.png' 6// Add anything else about the company here 7});
1analytics.group({ 2userId: 'USER_ID', 3groupId: 'GROUP_ID', 4traits: { 5name: 'Acme Inc', 6// Optional 7avatar: 'https://avatar.com/asd809sdhoif9as10nc29.png' 8// Add anything else about the company here 9}, 10});
1analytics.group( 2user_id="USER_ID", 3group_id="GROUP_ID", 4traits={ 5"name": "Acme Inc", 6# Optional 7"avatar": "https://avatar.com/0sd9fsd8y97a0sf99asd.png", 8# Add anything else about the company here 9}, 10)
1Analytics.group( 2user_id: 'USER_ID', 3group_id: 'GROUP_ID', 4traits: { 5name: "Acme Inc", 6# Optional 7avatar: "https://avatar.com/d78979as8hlsa9088f.png" 8# Add anything else about the company here 9} 10)
1curl https://api.june.so/sdk/group 2-H "Content-Type: application/json" 3-H "Authorization: Basic YOUR_WRITE_KEY" 4-X POST 5 6{ 7"userId": "USER_ID", 8"groupId": "GROUP_ID", 9"traits": { 10"name": "Acme Inc" 11}, 12"timestamp": "2012-12-02T00:31:38.208Z" 13}
Once you've implemented the identify
method in your codebase, it's time to track what your users & companies are doing in your product.