Skip to content

Add section for sending consent data in Appsflyer #6285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 86 additions & 30 deletions src/connections/destinations/catalog/appsflyer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,43 +62,15 @@ To prevent this, you can enable the new **Fallback to send IDFV when advertising

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

### Server
## Server

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.

**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.

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

## Identify

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:

```swift
[[SEGAnalytics sharedAnalytics] identify:@"12091906-01011992"
traits:@{ @"email": @"john.doe@example.com" }];
```

When you call `.identify()`, Segment uses AppsFlyer's `setCustomerUserID` to send the `userId` that was passed in.

**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.

## Track

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:

```swift
[[SEGAnalytics sharedAnalytics] track:@"Article Completed"
properties:@{ @"title": @"How to Create a Tracking Plan", @"course": @"Intro to Analytics" }];
```

When you call `track`, Segment translates it automatically and sends the event to AppsFlyer.

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.

Finally, Segment uses AppsFlyer's `transactionId` deduplication when you send an `orderId` (see the [e-commerce spec](/docs/connections/spec/ecommerce/v2/)).

### Server
### Configuring Server-side Delivery

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

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

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

### Send User Consent Preferences Server-side

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”}.

```js
// node.js library example with tcf
analytics.track({
event: 'Membership Upgraded',
userId: '97234974',
context: {
device: {
type: 'ios',
advertisingId: '159358'
}
},
integrations: {
AppsFlyer: {
appsFlyerId: '1415211453000-6513894'
},
consent_data: {
tcf: {
tcstring: "string",
cmp_sdk_version: 1,
cmp_sdk_id: 1,
gdpr_applies: 0,
policy_version: 1
}
}
}
});

// node.js library example with manual consent
analytics.track({
event: 'Membership Upgraded',
userId: '97234974',
context: {
device: {
type: 'ios',
advertisingId: '159358'
}
},
integrations: {
AppsFlyer: {
appsFlyerId: '1415211453000-6513894'
},
consent_data: {
manual: {
ad_personalization_enabled: 'true',
ad_user_data_enabled: 'true',
gdpr_applies: 'true'
}
}
}
});
```

## Identify

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:

```swift
[[SEGAnalytics sharedAnalytics] identify:@"12091906-01011992"
traits:@{ @"email": @"john.doe@example.com" }];
```

When you call Identify, Segment uses AppsFlyer's `setCustomerUserID` to send the `userId` that was passed in.

**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.

## Track

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:

```swift
[[SEGAnalytics sharedAnalytics] track:@"Article Completed"
properties:@{ @"title": @"How to Create a Tracking Plan", @"course": @"Intro to Analytics" }];
```

When you call Track, Segment translates it automatically and sends the event to AppsFlyer.

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.

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).

## Install Attributed

### Client
Expand Down