Swrve Segment Integration for iOS
安装
要安装Segment-Swrve集成,只需将此行添加到您的Podfile
中。
pod 'Segment-Swrve'
用法
在添加依赖项后,您必须注册集成。为此,在您的AppDelegate
中导入Swrve集成
#import <Segment-Swrve/SEGSwrveIntegrationFactory.h>
并添加以下行
NSString *const SEGMENT_WRITE_KEY = @"...";
SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:SEGMENT_WRITE_KEY];
// FIXME Add your own App ID and Api Key here
int appId = 0;
NSString *apiKey =@"<Enter your own Api key here>";
SwrveConfig *swrveConfig = [[SwrveConfig alloc] init];
// TODO:
// To use the EU stack, include this in your config.
// swrveConfig.selectedStack = SWRVE_STACK_EU;
[config use:[SEGSwrveIntegrationFactory instanceWithAppId:appId
apiKey:apiKey
swrveConfig:swrveConfig]];
[SEGAnalytics setupWithConfiguration:config];
标识
为了使用Swrve的身份功能,您必须在具有键swrve_external_id
的属性字典中使用Segment的identify
方法。这故意与Segment用户id分开,因为Swrve不允许使用电子邮件或其他PII作为外部标识符。
在Swrve中识别
[[SEGAnalytics sharedAnalytics] identify:@"SEGMENT_USER_ID" traits:@{ @"swrve_external_id": @"EXTERNAL_USER_ID"}];
许可证
© 版权所有 Swrve Mobile Inc 或其许可人。遵循Apache 2.0 许可协议分发。
Google Play Services 库版权 © 2012 Android 开源项目。遵循Apache 2.0 许可协议。
Gradle 版权 © 2007-2011 原作者或作者。遵循Apache 2.0 许可协议。