Skip to content

Commit eeba049

Browse files
committed
resolve swift-intercom edits
1 parent cfd5d12 commit eeba049

File tree

1 file changed

+37
-34
lines changed
  • src/connections/sources/catalog/libraries/mobile/apple/destination-plugins

1 file changed

+37
-34
lines changed

src/connections/sources/catalog/libraries/mobile/apple/destination-plugins/intercom-swift.md

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
11
---
2-
title: Analytics Swift Intercom Plugin
2+
title: Intercom Destination
33
id: 54521fd725e721e32a72eec6
44
---
5-
[Intercom](https://www.intercom.com/){:target="_blank"} makes customer messaging apps for sales, marketing, and support, connected on one platform. The Intercom Destination Plugin is open-source.You can browse the Swift code for [iOS](https://github.com/segment-integrations/analytics-swift-intercom){:target="_blank"} on GitHub.
5+
[Intercom](https://www.intercom.com/){:target="_blank"} makes customer messaging apps for sales, marketing, and support, connected on one platform. The Intercom Destination Plugin is open-source. You can browse the Swift code for [iOS](https://github.com/segment-integrations/analytics-swift-intercom){:target="_blank"} on GitHub.
66

77
## Getting Started
88

99
1. From the Segment Destinations page click **Add Destination**.
1010
2. Search for "Intercom" and select it in the results that appear.
11-
3. Choose which Source to connect Intercom to.
11+
3. Select a source to connect to your Intercom destination.
1212
4. Authorize your Intercom account in Segment and select the Intercom Account to sync with Segment.
13-
5. [Find your "App ID" in the Intercom UI](https://docs.intercom.com/faqs-and-troubleshooting/getting-set-up/where-can-i-find-my-app-id){:target="_blank"} or by navigating to the Gear Menu and clicking on "App Settings" followed by "API Keys". It should look something like `9iefb489`.
1413

14+
You can choose which account to sync from the drop down menu in the top right. If you are using [server-side sources](/docs/connections/sources#server), Segment starts passing data through once you activate the Destination. For other libraries continue reading below.
15+
5. [Find your "App ID" in the Intercom UI](https://docs.intercom.com/faqs-and-troubleshooting/getting-set-up/where-can-i-find-my-app-id){:target="_blank"} or by navigating to the Gear Menu and selecting App Settings > API Keys. It should look something like `9iefb489`.
16+
17+
Your changes appear in the Segment CDN in about 45 minutes, and then Analytics.js starts asynchronously loading Intercom's `library.js` onto your page.
18+
19+
This means you should remove Intercom's snippet from your page.
1520

1621
## Adding the dependency
1722

1823
***Note:** the Intercom library itself will be installed as an additional dependency.*
1924

20-
### via Xcode
25+
### Using Xcode
2126
In the Xcode `File` menu, click `Add Packages`. You'll see a dialog where you can search for Swift packages. In the search field, enter the URL to this repo.
2227

28+
```
2329
https://github.com/segment-integrations/analytics-swift-intercom
30+
```
2431

25-
You'll then have the option to pin to a version, or specific branch, as well as which project in your workspace to add it to. Once you've made your selections, click the `Add Package` button.
32+
You then have the option to pin to a version or specific branch and select which project in your workspace to add the package to. Once you've made your selections, click the **Add Package** button.
2633

27-
### via Package.swift
34+
### Using Package.swift
2835

29-
Open your Package.swift file and add the following do your the `dependencies` section:
36+
Open your Package.swift file and add the following to the `dependencies` section:
3037

3138
```
3239
.package(
@@ -36,10 +43,10 @@ Open your Package.swift file and add the following do your the `dependencies` se
3643
),
3744
```
3845

39-
*Note the Intercom library itself will be installed as an additional dependency.*
46+
**Note:** the Intercom library itself will be installed as an additional dependency.*
4047

4148

42-
## Using the Plugin in your App
49+
## Using the plugin in your app
4350

4451
Open the file where you setup and configure the Analytics-Swift library. Add this plugin to the list of imports.
4552

@@ -57,11 +64,11 @@ let analytics = Analytics(configuration: Configuration(writeKey: "<YOUR WRITE KE
5764
analytics.add(plugin: IntercomDestination())
5865
```
5966

60-
Your events will now begin to flow to Intercom in device mode.
67+
Your events will now start to flow to Intercom in device0mode.
6168

6269
## Identify
6370

64-
If you're not familiar with the Segment Specs, take a look to understand what the [Identify method](/docs/connections/spec/identify/) does. An example call would look like:
71+
If you're not familiar with the Segment Spec, take a look to understand what the [Identify method](/docs/connections/spec/identify/) does. An example call would look like:
6572

6673
```swift
6774
struct MyTraits: Codable {
@@ -81,20 +88,16 @@ analytics.identify(userId: "a user's id", MyTraits(
8188
createdAt: "Mon Mar 26 2018 17:44:51 GMT+0000 (UTC)"
8289
))
8390
```
84-
85-
When you call Identify, Segment creates or updates the user in Intercom using their [Users API](https://developers.intercom.com/reference#users){:target="_blank"}. Segment does not currently support creation of leads.
91+
When you call Identify, Segment creates or updates the user in Intercom using their [Contacts API](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/Contacts/contact/){:target="_blank"}. Segment does not currently support creating [leads](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/Contacts/MergeContact)
8692

8793
> info ""
88-
> Intercom associates Track events with known users. An Identify call with a `userId` is required before Track events are associated properly. Segment's bundled mobile SDKs also require that `identify` be called prior to `track`, but accepts setting an unknown user in Intercom using the `anonymousId`.
89-
90-
Keep reading for more information about the Identify call depending on the source type you send it from.
94+
> Intercom associates Track events with known users. An Identify call with a `userId` is required before Track events are associated properly. Segment's bundled mobile SDKs also require that Identify be called prior to Track, but accepts setting an unknown user in Intercom using the `anonymousId`.
9195
92-
- Passing `traits.company` creates a new Intercom Company if the `company_id` does not match a known company. See the [Intercom contact model documentation](https://developers.intercom.com/intercom-api-reference/reference/the-contact-model){:target="_blank"} for more details.
93-
- Trait values must be no longer than 255 characters
96+
- Passing `traits.company` creates a new Intercom Company if the `company_id` does not match an existing `company_id`. See the [Intercom contact model documentation](https://developers.intercom.com/intercom-api-reference/reference/the-contact-model){:target="_blank"} for more details.
9497

9598
Intercom supports both logged-in or logged-out users. You must register your users with Intercom before you can talk to them or see what they do in your app. This means that Identify must be called before Track.
9699

97-
Intercom allows users to choose to track only known or only unknown users, as well as both. Segment supports the ability to track both by checking for logged in users (determined by the `userId`) and falling back to setting the user as "Unidentified" when this is not present.
100+
Intercom allows you to track only known or only unknown users, or all users regardless of identification status. Segment supports the ability to track all users regardless of identification status by checking for logged in users (determined by the `userId`) and falling back to setting the user as "Unidentified" when this is not present.
98101

99102
Intercom knows when your app is backgrounded and comes alive again, so you won't need to re-register your users.
100103

@@ -113,7 +116,7 @@ Segment maps the following Intercom standard attributes on Identify.
113116
| remaining `traits` | `customAttributes` | Custom attributes for this user. |
114117

115118
> info ""
116-
> Intercom supports values of type NSString, NSNumber or NSNull on iOS.
119+
> Intercom supports NSString, NSNumber or NSNull type values on iOS.
117120
118121
#### Collect Context
119122

@@ -123,7 +126,7 @@ The fields collected from the [context object](/docs/connections/spec/common/) a
123126

124127
## Track
125128

126-
If you're not familiar with the Segment Specs, take a look to understand what the [Track method](/docs/connections/spec/track/) does. An example call would look like:
129+
If you're not familiar with the Segment Spec, take a look to understand what the [Track method](/docs/connections/spec/track/) does. An example call would look like:
127130

128131
```swift
129132
struct OrderCompletedProperties: Codable {
@@ -145,11 +148,11 @@ analytics.track(name: "Product Purchased", properties: OrderCompletedProperties(
145148
> info ""
146149
> Because Intercom only associates Track events with known users, an Identify call with a `userId` is required before Track events are associated properly.
147150
148-
When you make a Track call from any of the server-side libraries or mobile sources in `cloud-mode` (for example, without the beta Segment mobile Intercom SDK installed), you must include either the `userId` or `email` of an existing user in Intercom.
151+
When you make a Track call from any of the server-side libraries or mobile sources in cloud-mode (for example, without the beta Segment mobile Intercom SDK installed), you must include either the `userId` or `email` of a user already recorded in Intercom.
149152

150153

151154
### Revenue and currency
152-
If you send `properties.revenue` and `properties.currency`, Segment formats that according to [Intercom's Monetary Amount](https://developers.intercom.com/intercom-api-reference/reference/submit-a-data-event#metadata-object){:target="_blank"} and send it as:
155+
If you send `properties.revenue` and `properties.currency` to Intercom, Segment formats those properties according to [Intercom's Monetary Amount](https://developers.intercom.com/intercom-api-reference/reference/submit-a-data-event#metadata-object){:target="_blank"} and sends them to Segment as:
153156

154157
```js
155158
price: {
@@ -158,20 +161,22 @@ price: {
158161
}
159162
```
160163

161-
The bundled mobile integrations also check `properties.total` if `properties.revenue` is not present, and assign the total value as the amount value.
164+
If `properties.revenue` is not present, the bundled mobile integrations check `properties.total` and assign the total value as the `properties.revenue` or amount value.
162165

163166
### Limited Properties
164-
Intercom can only store [five event properties](http://docs.intercom.io/Intercom-for-user-analysis/Tracking-User-Events-in-Intercom#metadata-support){:target="_blank"} per event. That means if you send an event to Segment with more than five properties, Intercom only shows the first five properties.
167+
Intercom can only store [5 event properties](http://docs.intercom.io/Intercom-for-user-analysis/Tracking-User-Events-in-Intercom#metadata-support){:target="_blank"} per event. If you send an event to Segment with more than 5 properties, Intercom only shows the first 5 properties.
165168

166169
### Limited Events
167170

168171
Intercom only allows a total of 120 unique _active_ event names. If you're sending Segment more than 120 unique event names, Intercom only accepts the first 120 events that their servers see, and the rest throw an error.
169172

170-
In Intercom, an "Active" event is an event that hasn't been archived. If you archive an event, it makes it inactive and removes it from your 120 active events. If you need to bring your account back under the 120 event limit, archive some events from in the Intercom UI by navigating to **Settings > (workspace name) data > Events**, then click on the event to archive.
173+
In Intercom, an "Active" event is an event that hasn't been archived. Intercom only allows a total of 120 unique _active_ event names. If you're sending Segment more than 120 unique event names, Intercom only accepts the first 120 events that their servers encounter. Any additional unique event names will result in an error.
174+
175+
If you need to bring your account back under the 120 event limit, archive some events from in the Intercom UI by navigating to **Settings > (workspace name) data > Events**, then click on the event to archive.
171176

172177
## Group
173178

174-
If you're not familiar with the Segment Specs, take a look to understand what the [Group method](/docs/connections/spec/group/) does. An example call would look like:
179+
If you're not familiar with the Segment Spec, take a look to understand what the [Group method](/docs/connections/spec/group/) does. An example call would look like:
175180

176181
```swift
177182
struct MyTraits: Codable {
@@ -193,7 +198,7 @@ Segment supports Intercom companies in all sources. Users can be put into multip
193198
When you call Group from any of any server-side libraries or mobile sources in cloud-mode (without Segment's mobile Intercom SDK installed), you must include either the `userId` or `email` of an existing user in Intercom.
194199

195200
> info ""
196-
> In order for the Company Sessions Count to update within Intercom, the company must first be recorded in an `identify` call.
201+
> In order for the Company Sessions Count to update within Intercom, the company must first be recorded in an Identify call.
197202
198203

199204
| Segment Parameter | Intercom Parameter | Description |
@@ -208,13 +213,11 @@ When you call Group from any of any server-side libraries or mobile sources in c
208213

209214

210215
> info ""
211-
> Intercom supports values of type `NSString`, `NSNumber` or `NSNull` on iOS.
216+
> Intercom supports NSString, NSNumber or NSNull type values on iOS.
212217
213218
## Reset
214219
When `reset` is called The bundled mobile SDK `reset` method un-registers a user in Intercom. When users want to log out of your app and you call Segment's `reset` method, Segment calls:
215220

216-
On iOS:
217-
218221
```swift
219222
Intercom.logout()
220223
```
@@ -223,6 +226,6 @@ On iOS:
223226

224227
### Arrays and Objects
225228

226-
Intercom doesn't support custom arrays or objects. This means that if you want to send a certain user `trait` or event `property` to Intercom, you must send them at the top level.
229+
Intercom doesn't support custom arrays or objects. If you want to send a certain user `trait` or event `property` to Intercom, you must send them at the top level instead of in an array or object.
227230

228-
This limitation does not apply, however, for mapping `company` objects on [Identify calls](/docs/connections/spec/identify/). Segment continues to handle that in the same way as before. This is only applicable for any custom traits or properties.
231+
This limitation doThis limitation does not apply if you are mapping custom traits or properties to `company` objects on [Identify calls](/docs/connections/spec/identify/). es not apply, however, for mapping `company` objects on [Identify calls](/docs/connections/spec/identify/). Segment continues to handle that in the same way as before. This is only applicable for any custom traits or properties.

0 commit comments

Comments
 (0)