Applicable plans
Sprout Blossom Garden Estate Forest

What is Segment?
Segment is an integration tool which:
1. Let’s you collect customer data from various customer touch points (web, server, cloud apps or mobile)
2. Once the data is collected, Segment sends it to Freshsales (or any analytical tool they are integrated with), helping you capture all your prospects and important activities performed by the customer in Freshsales. 
Your sales reps can now prioritise these leads, reach out to them and close more deals.
Freshsales’s integration with Segment let’s you:
- Create or update leads/contacts.
- Capture the pageviews.
- Track events that you’ve asked for.
When and why is it needed?
When you’re a small company, customising your data(writing a suitable code) to integrate your website/app to a tool would not be difficult. Mainly because you might only integrate with a couple or more tools.
But as your company grows, so does the list of integration tools you deal with. Then, it becomes quite a pain to customise data to suit each tool separately.
That’s when Segment comes in handy.

All you need to do is:
1. Prepare the data you send to Segment, according to their specified format (one time preparation)
2. Segment processes the data from your website/app
3. Finally, pushes the processed data into the tools you’ve chosen
What are the different sources from which leads are captured through Segment into Freshsales?
You can either push data from,
- Client’s side (website visits, pageviews, sign ups)
- Server’s side (Payment confirmation, team inbox configuration and the likes)
To know more, refer this article.

Ex: You can treat the web and mobile platform for the same organisation as two different sources and push data into segment. Data from both the sources are pushed to all chosen tools from Segment.
What are the different methods used in this integration?

Refer this article to know more.
How to enable Segment for Freshsales?
If you use Segment to push data from your web app and website into multiple analytical tools, you can integrate your Freshsales account with Segment too. The integration is quick and easy.
Here’s how you do it,
1. Login to Freshsales as an Administrator.
2. Go to Admin Settings > Integrations > Third party integrations.

3. Enable Segment toggle button. Freshsales automatically sends a request to Segment with your API key and Subdomain name.
4. You’d be directed to Segment’s homepage. Click Login and sign into your Segment account.
5. Once you sign in, you are directed to the Send data to Freshsales window. 
6. Click Send Data when you’re done.
7. You are redirected to the Third party integrations page in Freshsales where you can find Segment enabled.

 8. All activities related to your lead/contact is updated in the activity timeline on the corresponding lead’s/contact’s detail page.

Common error: Why is Freshsales not accepting the data sent by Segment?

Reason: The Segment integration toggle in Freshsales is not enabled.
              ( If you’re already a segment user, you might have directly logged into your segment
               account and enabled Freshsales from Segment’s integrations page.)

Solution: "Log in through Freshsales and enable Segment. Do not directly sign into  

How are leads/contacts created/updated in Freshsales through the integration?

This is how your website/app’s data is processed before sending it to Freshsales.
Say, you want to capture all your website sign ups as a lead/contact. Let’s call these leads-to-be as prospects.

1. Identifying the prospect: User id & Traits
User id: Your prospect provides his/her email(email being a unique field) as the User id . Or, a primary key(DB id) from the database is associated to the prospect for identification.
Traits: All other details like prospect’s name, company name, phone number, address, etc provided by him/her before clicking the Sign-up button are the traits of the prospect.
After assimilating this information,

2. List of Freshsales’s leads/contacts are searched to match the User id inside Freshsales.

3. Once a match is found, the respective lead/contact is updated with the traits. Otherwise, a new lead is created.

4. If you want your prospects to be added as contacts directly, tweak the code.
 Declare ‘fs_contact : true’.

If DB id(primary key) is used instead of email, a lead/contact is created directly. (Existing leads or contacts are not updated)

For more details, refer this link.
Here's how you can filter leads or contacts by events pushed from Segment.