You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/sources/catalog/libraries/mobile/apple/destination-plugins/intercom-swift.md
+37-34Lines changed: 37 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,32 +1,39 @@
1
1
---
2
-
title: Analytics Swift Intercom Plugin
2
+
title: Intercom Destination
3
3
id: 54521fd725e721e32a72eec6
4
4
---
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.
6
6
7
7
## Getting Started
8
8
9
9
1. From the Segment Destinations page click **Add Destination**.
10
10
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.
12
12
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`.
14
13
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.
15
20
16
21
## Adding the dependency
17
22
18
23
***Note:** the Intercom library itself will be installed as an additional dependency.*
19
24
20
-
### via Xcode
25
+
### Using Xcode
21
26
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.
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.
26
33
27
-
### via Package.swift
34
+
### Using Package.swift
28
35
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:
30
37
31
38
```
32
39
.package(
@@ -36,10 +43,10 @@ Open your Package.swift file and add the following do your the `dependencies` se
36
43
),
37
44
```
38
45
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.*
40
47
41
48
42
-
## Using the Plugin in your App
49
+
## Using the plugin in your app
43
50
44
51
Open the file where you setup and configure the Analytics-Swift library. Add this plugin to the list of imports.
45
52
@@ -57,11 +64,11 @@ let analytics = Analytics(configuration: Configuration(writeKey: "<YOUR WRITE KE
57
64
analytics.add(plugin: IntercomDestination())
58
65
```
59
66
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.
61
68
62
69
## Identify
63
70
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:
65
72
66
73
```swift
67
74
structMyTraits: Codable {
@@ -81,20 +88,16 @@ analytics.identify(userId: "a user's id", MyTraits(
81
88
createdAt: "Mon Mar 26 2018 17:44:51 GMT+0000 (UTC)"
82
89
))
83
90
```
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)
86
92
87
93
> 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`.
91
95
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.
94
97
95
98
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.
96
99
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.
98
101
99
102
Intercom knows when your app is backgrounded and comes alive again, so you won't need to re-register your users.
100
103
@@ -113,7 +116,7 @@ Segment maps the following Intercom standard attributes on Identify.
113
116
| remaining `traits`|`customAttributes`| Custom attributes for this user. |
114
117
115
118
> info ""
116
-
> Intercom supports values of type NSString, NSNumber or NSNull on iOS.
119
+
> Intercom supports NSString, NSNumber or NSNull type values on iOS.
117
120
118
121
#### Collect Context
119
122
@@ -123,7 +126,7 @@ The fields collected from the [context object](/docs/connections/spec/common/) a
123
126
124
127
## Track
125
128
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:
> Because Intercom only associates Track events with known users, an Identify call with a `userId` is required before Track events are associated properly.
147
150
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.
149
152
150
153
151
154
### 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:
153
156
154
157
```js
155
158
price: {
@@ -158,20 +161,22 @@ price: {
158
161
}
159
162
```
160
163
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.
162
165
163
166
### 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.
165
168
166
169
### Limited Events
167
170
168
171
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.
169
172
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.
171
176
172
177
## Group
173
178
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:
175
180
176
181
```swift
177
182
structMyTraits: Codable {
@@ -193,7 +198,7 @@ Segment supports Intercom companies in all sources. Users can be put into multip
193
198
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.
194
199
195
200
> 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.
@@ -208,13 +213,11 @@ When you call Group from any of any server-side libraries or mobile sources in c
208
213
209
214
210
215
> info ""
211
-
> Intercom supports values of type `NSString`, `NSNumber` or `NSNull` on iOS.
216
+
> Intercom supports NSString, NSNumber or NSNull type values on iOS.
212
217
213
218
## Reset
214
219
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:
215
220
216
-
On iOS:
217
-
218
221
```swift
219
222
Intercom.logout()
220
223
```
@@ -223,6 +226,6 @@ On iOS:
223
226
224
227
### Arrays and Objects
225
228
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.
227
230
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