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.
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).
We have a video tutorial on setting up the Segment to Close integration here.
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.
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.
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.
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.
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.
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.
Tab over to Mappings while in Segment and create a new mapping. Select Create or Update Contact and Lead from the popup menu.
This will make troubleshooting and debugging your Mappings easier.
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.
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.