Skip to content

Commit 1da1ee7

Browse files
Merge pull request #6285 from segmentio/thomas/appsflyer-consent
Add section for sending consent data in Appsflyer
2 parents 12849a2 + c862d61 commit 1da1ee7

File tree

1 file changed

+86
-30
lines changed
  • src/connections/destinations/catalog/appsflyer

1 file changed

+86
-30
lines changed

src/connections/destinations/catalog/appsflyer/index.md

Lines changed: 86 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -62,43 +62,15 @@ To prevent this, you can enable the new **Fallback to send IDFV when advertising
6262

6363
{% include content/react2-dest.md %}
6464

65-
### Server
65+
## Server
6666

6767
AppsFlyer offers an **augmentative** server-side [HTTP API](https://support.appsflyer.com/hc/en-us/articles/207034486-Server-to-Server-In-App-Events-API-HTTP-API-){:target="_blank"} intended for use along side the AppsFlyer mobile SDK. Use the cloud-mode destination _with_ the mobile SDK to link out-of-app events (such as website or offline purchases) with attributed users and devices.
6868

6969
**Important**: The cloud-mode destination is not meant to replace the device-mode destination, and you should not use the cloud-mode destination by itself. AppsFlyer requires that you bundle the mobile SDK to correctly attribute user actions. Remember that if you pass in an `appsFlyerId` on cloud-mode calls, you cannot prevent events from sending to AppsFlyer from the Segment app.
7070

7171
If you want to use AppsFlyer server-side only, contact your AppsFlyer representative, as this is an Enterprise Customer Feature.
7272

73-
## Identify
74-
75-
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 iOS call would look like:
76-
77-
```swift
78-
[[SEGAnalytics sharedAnalytics] identify:@"12091906-01011992"
79-
traits:@{ @"email": @"[email protected]" }];
80-
```
81-
82-
When you call `.identify()`, Segment uses AppsFlyer's `setCustomerUserID` to send the `userId` that was passed in.
83-
84-
**Note:** `identify` calls are not supported using AppsFlyer's HTTP API at the moment. You can only send `.identify` calls if you have the AppsFlyer SDK bundled.
85-
86-
## Track
87-
88-
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 iOS call would look like:
89-
90-
```swift
91-
[[SEGAnalytics sharedAnalytics] track:@"Article Completed"
92-
properties:@{ @"title": @"How to Create a Tracking Plan", @"course": @"Intro to Analytics" }];
93-
```
94-
95-
When you call `track`, Segment translates it automatically and sends the event to AppsFlyer.
96-
97-
Segment includes all the event properties as callback parameters on the AppsFlyer event, and automatically translate `properties.revenue` to the appropriate AppsFlyer purchase event properties based on the spec'd properties.
98-
99-
Finally, Segment uses AppsFlyer's `transactionId` deduplication when you send an `orderId` (see the [e-commerce spec](/docs/connections/spec/ecommerce/v2/)).
100-
101-
### Server
73+
### Configuring Server-side Delivery
10274

10375
If you'd like to attribute offline events with a certain user or device, the server-side destination may be employed.
10476

@@ -158,6 +130,90 @@ When transmitting data serverside to Appsflyer, you have the option to enhance s
158130

159131
To activate this feature, simply input your S2S token in the destination settings and toggle the "Use API v3" switch to the enabled position.
160132

133+
### Send User Consent Preferences Server-side
134+
135+
To transmit user consent data server-side, incorporate the consent preferences into the `integrations.AppsFlyer.consent_data` object. This can be done in either TCF or manual format, as outlined in [the AppsFlyer Send Event documentation](https://dev.appsflyer.com/hc/reference/s2s-events-api3-post){:target="_blank”}.
136+
137+
```js
138+
// node.js library example with tcf
139+
analytics.track({
140+
event: 'Membership Upgraded',
141+
userId: '97234974',
142+
context: {
143+
device: {
144+
type: 'ios',
145+
advertisingId: '159358'
146+
}
147+
},
148+
integrations: {
149+
AppsFlyer: {
150+
appsFlyerId: '1415211453000-6513894'
151+
},
152+
consent_data: {
153+
tcf: {
154+
tcstring: "string",
155+
cmp_sdk_version: 1,
156+
cmp_sdk_id: 1,
157+
gdpr_applies: 0,
158+
policy_version: 1
159+
}
160+
}
161+
}
162+
});
163+
164+
// node.js library example with manual consent
165+
analytics.track({
166+
event: 'Membership Upgraded',
167+
userId: '97234974',
168+
context: {
169+
device: {
170+
type: 'ios',
171+
advertisingId: '159358'
172+
}
173+
},
174+
integrations: {
175+
AppsFlyer: {
176+
appsFlyerId: '1415211453000-6513894'
177+
},
178+
consent_data: {
179+
manual: {
180+
ad_personalization_enabled: 'true',
181+
ad_user_data_enabled: 'true',
182+
gdpr_applies: 'true'
183+
}
184+
}
185+
}
186+
});
187+
```
188+
189+
## Identify
190+
191+
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 iOS call would look like:
192+
193+
```swift
194+
[[SEGAnalytics sharedAnalytics] identify:@"12091906-01011992"
195+
traits:@{ @"email": @"[email protected]" }];
196+
```
197+
198+
When you call Identify, Segment uses AppsFlyer's `setCustomerUserID` to send the `userId` that was passed in.
199+
200+
**Note:** Identify calls are not supported using AppsFlyer's HTTP API at the moment. You can only send `.identify` calls if you have the AppsFlyer SDK bundled.
201+
202+
## Track
203+
204+
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 iOS call would look like:
205+
206+
```swift
207+
[[SEGAnalytics sharedAnalytics] track:@"Article Completed"
208+
properties:@{ @"title": @"How to Create a Tracking Plan", @"course": @"Intro to Analytics" }];
209+
```
210+
211+
When you call Track, Segment translates it automatically and sends the event to AppsFlyer.
212+
213+
Segment includes all the event properties as callback parameters on the AppsFlyer event, and automatically translates `properties.revenue` to the appropriate AppsFlyer purchase event properties based on the spec'd properties.
214+
215+
Segment uses AppsFlyer's `transactionId` deduplication when you send an `orderId` (see Segment's [e-commerce spec](/docs/connections/spec/ecommerce/v2/) for more details).
216+
161217
## Install Attributed
162218

163219
### Client

0 commit comments

Comments
 (0)