1window.analytics.track('Signed In', { 2browser: 'chrome' 3});
If you haven't implemented the .identify
call, please do that first before implementing the .track
method.
This guide will teach you how to successfully track how your users are using your product.
Once you've identified them, you can track what they are doing, which features they use, how often and much more. You can use the track
method to track events on behalf of your users. Add this code snippet to basic features like "signed up", "logged in" and any additional events that may track the core features of your product.
For June, one of our core features is when a user loads and creates a report. Therefore, we have a "loaded report" and "created report" event.
Replace USER_ID
with your own unique identified, ideally the user ID from your database. Passing additional information is possible using the properties
object.
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.track('Signed In', { 2browser: 'chrome' 3});
1analytics.track('Signed In', { 2browser: 'chrome' 3});
1analytics.track({ 2userId: 'USER_ID', 3event: 'Signed In', 4properties: { 5browser: 'chrome' 6} 7});
1analytics.track( 2user_id="USER_ID", 3event="Signed In", 4properties={"browser": "chrome"}, 5)
1Analytics.track( 2user_id: 'USER_ID', 3event: 'Signed In', 4properties: { 5browser: 'chrome' 6} 7)
1curl https://api.june.so/sdk/track 2-H "Content-Type: application/json" 3-H "Authorization: Basic YOUR_WRITE_KEY" 4-X POST 5 6{ 7"userId": "USER_ID", 8"event": "Signed in", 9"properties": { 10"browser": "chrome", 11}, 12"timestamp": "2012-12-02T00:31:38.208Z" 13}
If you haven't implemented the .group
call, please do that first before implementing the .track
method for companies.
This guide will teach you how to successfully track how your companies are using your product. It's almost identical to tracking user behaviour with the exception of one change.
When triggering track events for a company, you should pass the unique ID (GROUP_ID
) for the company in the context
object of the .track
method. See the code example below.
Note: If you have already implemented the .track
call for users, you can just add the
context
object with the GROUP_ID
. There is no need to add additional .track
calls for companies.
Replace USER_ID
& GROUP_ID
with your own unique identified, ideally the user and workspace ID from your database.
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.track('Signed In', { 2browser: 'chrome' 3}, { 4// Add the GROUP_ID here to track this event on behalf of a company 5context: { groupId: 'GROUP_ID' } 6});
1analytics.track('Signed In', { 2browser: 'chrome' 3}, { 4// Add the GROUP_ID here to track this event on behalf of a company 5context: { groupId: 'GROUP_ID' } 6});
1analytics.track({ 2userId: 'USER_ID', 3event: 'Signed In', 4properties: { 5browser: 'chrome' 6}, 7// Add the GROUP_ID here to track this event on behalf of the company 8context: { 9groupId: 'GROUP_ID' 10} 11});
1analytics.track( 2user_id="USER_ID", 3event="Signed In", 4properties={"browser": "chrome"}, 5# Add the GROUP_ID here to track this event on behalf of the company 6context={"groupId": "GROUP_ID"}, 7)
1Analytics.track( 2user_id: 'USER_ID', 3event: 'Signed In', 4properties: { 5browser: 'chrome' 6}, 7# Add the GROUP_ID here to track this event on behalf of the company 8context: { 9groupId: 'GROUP_ID' 10} 11)
1curl https://api.june.so/sdk/track 2-H "Content-Type: application/json" 3-H "Authorization: Basic YOUR_WRITE_KEY" 4-X POST 5 6{ 7"userId": "USER_ID", 8"event": "Signed in", 9"properties": { 10"browser": "chrome", 11}, 12"context": { 13"groupId": "GROUP_ID", 14}, 15"timestamp": "2012-12-02T00:31:38.208Z" 16}
Once you've implemented the .identify
, .group
and .track
method and are sending track events, you're ready to jump into June.