This is a Segment wrapper for AppsFlyer SDK framework.
Segment AppsFlyer uses AppsFlyer static framework from Cocoapods.
Add the appsFlyerFramework
to podfile
and run pod install
.
Example:
pod 'AppsFlyerFramework'
pod 'Analytics', '~> 3.5'
Next step, copy manually 5 files to your project:
SEGAppsFlyerIntegration.h
SEGAppsFlyerIntegration.m
SegAppsFlyerIntegrationFactory.h
SegAppsFlyerIntegrationFactory.m
SegmentAppsFlyeriOS.h
You can find them here: segment appsflyer ios wrapper
To use SDK from a Swift source just 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
Open AppDelegate.h
and add:
#import "SEGAppsFlyerIntegrationFactory.h"
#import <Analytics/SEGAnalytics.h>
In AppDelegate.m
โ didFinishLaunchingWithOptions
:
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];
Open/Create <Your-App-name>-Bridging-Header.h
and add:
#import "SEGAppsFlyerIntegrationFactory.h"
Open AppDelegate.swift
โ didFinishLaunchingWithOptions
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
This project has 2 examples for objective-C and Swift. To give it a try , clone this repo and from each example first run pod install
to install project dependancies.
- Create Podspec with sybspec for users who are unable to bundle static libraries as dependencies (mostly for Swift users)