Business Intelligence

Segment

8min
getting started with segment the segment modules allow you to identify users and track their actions in your segment account prerequisites a segment account in order to use segment with {{product name}} , it is necessary to have a segment account if you do not have one, you can create a segment account at app segment com/signup https //app segment com/signup connecting segment to {{product name}} to connect your segment account to {{product name}} , you need to create a token 1\ log in to your segment account 2\ open settings from the bottom left corner 3\ navigate to the access management section, and click on the tokens tab 4\ click on the create token button 5\ enter the token description , select the workspace owner option, and click the create button 6\ copy the created token, and store it in a safe place 7\ go to {{product name}} , and open the segment's module create a connection dialog 8\ enter the token you have created in step 5, and click the continue button to establish the connection actions identify this module lets you tie a user to their actions and record traits about them it includes a unique user id and any optional traits you know about them segment recommends calling the identify module a single time when the user’s account is first created, and only identifying again later when their traits change connection segment docid\ ohbbibfizv3zpbr9ukl2h write key obtain the write key from the source to find a write key, you first need to create a non cloud source, such as a website, server, or mobile source 1 open sources 2 select the segment source you want to use e g , autopilot 3 copy the write key 4 insert the write key in the respective field in {{product name}} user id enter (map) the user id to identify a user from your source a user id is usually the unique identifier that you recognize a user by in your own database for example, if you’re using the autopilot app, it might look something like person d97f88ad e835 4565 ad1a 9f75c5c381f6 anonymous id enter (map) the anonymous id the anonymous id can be any pseudo unique identifier for example, on your servers, you can use a session id if you don’t have any readily available identifier, you can always generate a new random one—e g , uuids for more detailed information, please refer to the segment documentation timestamp enter the time in the iso 8601 http //en wikipedia org/wiki/iso 8601 format, if you’re importing data from the past if the event just happened, leave it out, and we’ll use the server’s time traits address street address of the user, optionally containing city , country , postalcode , state or street age age of the user avatar url to an avatar image for the user birthday user’s birthday company company the user represents, optionally containing name (a string), id (a string or number), industry (a string), employee count (a number), or plan (a string) createdat date the user’s account was first created we recommend iso 8601 date strings description description of the user email email address of the user firstname first name of the user gender gender of the user id unique id in your database for the user lastname last name of the user name full name of the user if you only pass a first and last name, we’ll automatically fill in the full name for you phone phone number of the user title title of the user, usually related to their position at their specific company example vp of engineering username user’s username this should be unique to each user, like the usernames of twitter or github website website of the user custom traits the custom trait names should not match the reserved names, as listed in the official segment documentation https //segment com/docs/spec/identify/#traits track the module allows you to record any actions your users perform, along with any properties that describe the action connection segment docid\ ohbbibfizv3zpbr9ukl2h write key obtain the write key from the source to find a write key, you first need to create a non cloud source such as a website, server, or mobile source 1 open sources 2 select the segment source you want to use e g , autopilot 3 copy the write key 4 insert the write key in the respective field in {{product name}} event name enter the name of the action that the user has performed for more detailed information about events, please refer to the segment documentation https //segment com/docs/spec/track/#event user id enter (map) the user id to identify the user from your source a user id is usually the unique identifier that you recognize a user by in your own database for example, if you’re using the autopilot app, it might look something like person d97f88ad e835 4565 ad1a 9f75c5c381f6 anonymous id enter (map) the anonymous id the anonymous id can be any pseudo unique identifier for example, on your servers you can use a session id if you don’t have any readily available identifier, you can always generate a new random one—e g , uuids for more detailed information please refer to the segment documentation timestamp enter the time in the iso 8601 http //en wikipedia org/wiki/iso 8601 format if you’re importing data from the past if the event just happened, leave it out, and we’ll use the server’s time currency enter the currency of the revenue an event resulted in this should be sent in the iso 4127 format if this is not set, we assume the revenue to be in us dollars revenue enter the amount of revenue an event resulted in this should be a decimal value, so a shirt worth $19 99 would result in a revenue of 19 99 value this is an abstract “value” to associate with an event this is typically used in situations where the event doesn’t generate real dollar revenue, but has an intrinsic value to a marketing team, like newsletter signups custom properties add custom properties properties are extra pieces of information you can tie to events you track they can be anything that will be useful while analyzing the events later we recommend sending properties whenever possible, because they give you a more complete picture of what your users are doing note the custom property names should not match the reserved names, as listed in the official segment documentation make an api call allows you to perform a custom api call uses http tracking api connection segment docid\ ohbbibfizv3zpbr9ukl2h url enter a path relative to https //api segment io for example /v1/group for the list of available endpoints, refer to the segment http api documentation method select the http method you want to use get to retrieve information for an entry post to create a new entry put to update/replace an existing entry patch to make a partial entry update delete to delete an entry headers enter the desired request headers you don't have to add authorization headers; we've already added these for you query string enter the request query string body enter the body content for your api call for the list of available endpoints, refer to the segment http api documentation https //segment com/docs/connections/sources/catalog/libraries/server/http api example of use associate a user with a group the following api call associates an identified user with a group in your segment account url /v1/group/ method post key content type value application/json key authorization value basic {{base64("your write key ")}} body {"userid" "user id of the user you want to associate to group","groupid" "target group id"} if the action is successfully completed, you can find the success true information in the module's output under bundle > body