Latest 1.2.9
Homepage https://github.com/AppsFlyerSDK/segment-appsflyer-ios
License MIT
Platforms ios 7.0, tvos 9.0, requires ARC
Dependencies Analytics
Authors

segment-appsflyer-ios

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

Installation

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

pod 'segment-appsflyer-ios'

Troubleshooting

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:

Example:

  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.

Usage

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.use(SEGAppsFlyerIntegrationFactory())
        config.enableAdvertisingTracking = true       //OPTIONAL
        config.trackApplicationLifecycleEvents = true //OPTIONAL
        config.trackDeepLinks = true                  //OPTIONAL
        config.trackPushNotifications = true          //OPTIONAL
        config.trackAttributionData = true            //OPTIONAL

        Analytics.SEGAnalytics.debug(true)
        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

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

Examples

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": "https://github.com/AppsFlyerSDK/segment-appsflyer-ios",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Appsflyer": "[email protected]"
    },
    "source": {
        "git": "https://github.com/AppsFlyerSDK/segment-appsflyer-ios.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