Article summary

        Segment simplifies the process of collecting data, allowing you to spend more time using that data and less time trying to collect it. For example, you can use Segment to track when a potential customer visits your website or signs up for your newsletter, bringing that information directly into Close (explore many other data sources). 

        This integration will allow you to Create/Update Leads and Contacts with the information your customers provide on your data source.

        Getting Started

        You will need the following:

        • A website, newsletter, mobile app, or another source you want to track information from;
        • A Segment account. You can sign up for a free Segment account here;
        • Your Close API Key.

        Optionally, this integration can also use Custom Fields in Close to store data and look up Leads/Contacts that may already exist in your Close database (if this is not used, we will default to look up Leads/Contacts that already exist by email address).

        Storing a "Company ID"

        Head to Settings > Custom Fields and create a Lead Custom Field titled Company ID. This Custom Field must be a text-type Custom Field. This Custom Field will store a Company ID (a unique identifier) when a new Lead is created or look up this identifier when updating the Lead (this will also prevent duplicates).

        Storing a "User ID"

        Head to Settings > Custom Fields and create a Contact Custom Field for the User ID. This must also be a text-type Custom Field. The Segment integration will use this field to store a User ID (a unique identifier) when a new Contact is created or look up this identifier when updating the Contact (this will also prevent duplicates).

        "Company ID" and "User ID" - Custom Fields 
        The terminologies of the custom fields above are just examples that you can use. They will work as unique identifiers between your Source > Segment > Close to avoid duplicates. Feel free to change them as you see fit.

        Segment Integration

        We have a video tutorial on setting up the Segment to Close integration here.

        You can download the mock newsletter-form website (.html, Javascript) used in the video tutorial here.

        Setting up a website (Javascript) as a source in Segment

        Log into your Segment account and select Connections on the left sidebar. Then navigate to Sources and select which source you want to track information from.

        Many Sources will require some coding knowledge.

        If tracking data from your website, you'll need access to your website's code and the ability to write JavaScript code to integrate the website with Segment. If these skills are not on your skillset, it might be best to talk to your web developer about creating this automation for you. Lastly, consider contacting us to inquire about a Professional Service quote from our Engineering Team; send an email to "".

        For this example, click on Add Source and select Javascript. We will recreate the newsletter form in the mock files.

        During the setup below, add your source name, labels, and website URL (if you're tracking analytics).


        Now, you must copy the Segment snippet (below) and add it to your website source code.

        Copy your snippet. 

        The unique identifier in green will be your API code for that snippet. Your HTML code should look something like the one below. If you're using our mock newsletter to test this, ensure that you're replacing the API code (green code) in these screenshots with your own Segment snippet.

        Paste the snippet in your website code.

        After adding the snippet, your web developer must also add the Tracking Script to the code. E.g., code below (mock newsletter site).

        You can test if your source is now sending data by adding a name and email address in the mock form and submitting it. 

        Tab over to the debugger to see if that information was sent from your Source into Segment.

        Debugger tab.

        Your source is now working and connected to Segment!

        Connect Close to Segment

        It's time to connect your Close Organization to Segment. 

        First, go to your Close App and create an API Key by heading to Settings > API Keys > + New API Key.

        After getting your Close API key, head back to Segment, select Collections, and select Catalog.

        Tab over to Destinations and select Close under the CRM section. Click Configure Close

        Save your new Destination as Close, copy your API Key from Close, and paste it under the API Key field.

        Then head to Advanced Settings, where the Custom Fields you created earlier will come in handy.

        While viewing your Custom Fields in Close, copy the ID for your User ID Contact Custom Field by clicking on the '...' symbol and selecting Copy ID (API) towards the bottom.

        e1785b0-ScreenShot2022-04-21at80757PM.pngCopying a Custom Field ID

        Paste the ID under the User ID field in Segment. 

        Do the same for your Company ID Lead Custom Field, paste it under the Company ID field in Segment, and save your changes.

        Head back to Basic Settings, toggle on the Enable Destination option, and save your changes.


        This section will cover how to map your Source's events into Close Action and bring in Lead and Contact information. It's possible that your Source(s) may need to be updated with Javascript so you can send external data from your Source via webhook to Close. For a complete guide on how to do so, head to Segment's documentation here.

        Tab over to Mappings while in Segment and create a new mapping. Select Create or Update Contact and Lead from the popup menu.

        If you have multiple Close destinations, name each destination accordingly to the Source.

        This will make troubleshooting and debugging your Mappings easier.

        Event Types

        These are suggestions for using Event Types to distinguish the actions taken between the Segment app, the source, and the destination. However, these interpretations are not fixed. It does not matter what event type you use, but how you map it to the selected Close Action. Thus, they can mean whatever workflow is best for the web developer doing this integration. 

        I.e., we recommend you use Track since it was the type we used for all our demos in this article. But, as stated previously, all actions can work interchangeably.

        • Identify: Will tie a customer on your Source to their actions and record traits about them within Close. It includes a unique User ID and any optional traits you know about the user, such as their email address, name, etc. Examples of when to use an identify call include a Lead first registering for or logging into your webpage or if they update their address information.

        • Track: This records actions that Leads or Contacts do within your Source, such as when a visitor subscribes to your newsletter.

        • Group: This creates or updates Leads with Contact info.

        • Page, Screen, and Alias: These can have several use cases. The terminology can be freely used to mean different workflows. The above are only suggestions.

        2a75e16-CleanShot2022-04-22at1150272x.pngMapping to a newsletter.

        If your application uses a lot of Identify and Group calls (such as on every page load), you may hit our API limit. Instead, you should use Track (e.g., User Created, User Joined Organization, User Details Changed) or send Identify and Group calls to Close only when the data is updated (e.g., user info changed) by Filtering with Integration Object.

        Configure your Action Fields by filling each section with the matching data from each dropdown menu. Review your mapping on the next page and run a Test Action.

        Double check the information sent into Close to ensure everything is correct and your Leads aren't missing any data that should otherwise be mapped.

        The Debugger tab will show you a list of actions logged by Segment. Take advantage of this tab when troubleshooting a specific Lead creation or update. 

        Segment has more on using this section here.

        If you run into any questions, please reach out to our Support Team or contact Segment's Support Team.

        What's Next