Latest 1.2.9
License MIT
Platforms ios 7.0, tvos 9.0, requires ARC
Dependencies Analytics


AppsFlyer integration for Segment.

This is a Segment wrapper for AppsFlyer SDK framework.

In order for us to provide optimal support, we would kindly ask you to submit any issues to [email protected]

When submitting an issue please specify your AppsFlyer sign-up (account) email , your app ID , production steps, logs, code snippets and any additional relevant information.

Table of content


To install the segment-appsflyer-ios integration, simply add this line to your CocoaPods Podfile:

pod 'segment-appsflyer-ios'


For users who are unable to bundle static libraries as dependencies (Swift project for example)
you can choose StaticLibWorkaround subspec, but be sure to include AppsFlyerFramework to in your Podfile:


  pod 'AppsFlyerFramework'
  pod 'segment-appsflyer-ios/StaticLibWorkaround'

Next step, add manually 5 files to your project (located under <YOUR_APP>/Pods/segment-appsflyer-ios/segment-appsflyer-ios/Classes):

  • SEGAppsFlyerIntegration.h
  • SEGAppsFlyerIntegration.m
  • SEGAppsFlyerIntegrationFactory.h
  • SEGAppsFlyerIntegrationFactory.m
  • SegmentAppsFlyeriOS.h

Xcode will ask you to generate <YOUR_APP_NAME>-Bridging-Header.h
Add to this file #import "SEGAppsFlyerIntegrationFactory.h"

For more details follow the instructions from Apple here.


First of all, you must provide values for AppsFlyer Dev Key, Apple App ID (iTunes) and client secret in Segment’s dashboard for AppsFlyer integration

Usage – Objective-C

Open AppDelegate.h and add:

In AppDelegate.mdidFinishLaunchingWithOptions:

SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:@"SEGMENT_KEY"];

    [config use:[SEGAppsFlyerIntegrationFactory instance]];

    config.enableAdvertisingTracking = YES;       //OPTIONAL
    config.trackApplicationLifecycleEvents = YES; //OPTIONAL
    config.trackDeepLinks = YES;                  //OPTIONAL
    config.trackPushNotifications = YES;          //OPTIONAL
    config.trackAttributionData = YES;            //OPTIONAL   
    [SEGAnalytics debug:YES];                     //OPTIONAL
    [SEGAnalytics setupWithConfiguration:config];

Usage – Swift

Open/Create <Your-App-name>-Bridging-Header.h and add:

#import "SEGAppsFlyerIntegrationFactory.h"

Open AppDelegate.swiftdidFinishLaunchingWithOptions and add:

import Analytics


let config:Analytics.SEGAnalyticsConfiguration = SEGAnalyticsConfiguration(writeKey: "SEGMENT_KEY")

        config.enableAdvertisingTracking = true       //OPTIONAL
        config.trackApplicationLifecycleEvents = true //OPTIONAL
        config.trackDeepLinks = true                  //OPTIONAL
        config.trackPushNotifications = true          //OPTIONAL
        config.trackAttributionData = true            //OPTIONAL

        Analytics.SEGAnalytics.setup(with: config)

AppsFlyer integration responds to identify call. To read more about it, visit Segment identify method documentation.
In identify call traits dictionary setCustomerUserID and currencyCode

Install Attributed event

If you are working with networks that don’t allow passing user level data to 3rd parties, you will need to apply code to filter out these networks before calling

// [ track:@"Install Attributed" properties:[properties copy]];


This project has 4 examples for objective-C and Swift (with troubleshooting). To give it a try , clone this repo and from each example first run pod install to install project dependancies.

Latest podspec

    "name": "segment-appsflyer-ios",
    "version": "1.2.9",
    "summary": "AppsFlyer Integration for Segment's analytics-ios library.",
    "description": "AppsFlyer is the market leader in mobile advertising attribution & analytics, helping marketers to pinpoint their targeting, optimize their ad spend and boost their ROI.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Appsflyer": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.2.9"
    "platforms": {
        "ios": "7.0",
        "tvos": "9.0"
    "requires_arc": true,
    "dependencies": {
        "Analytics": [
            "~> 3.5"
    "source_files": "segment-appsflyer-ios/Classes/**/*",
    "ios": {
        "dependencies": {
            "AppsFlyerFramework": [
                "~> 4"
    "tvos": {
        "dependencies": {
            "AppsFlyerTvOsLib": [
                "~> 4"
    "subspecs": [
            "name": "StaticLibWorkaround",
            "preserve_paths": "segment-appsflyer-ios/Classes/**/*"

Pin It on Pinterest

Share This