Skip to content

zlzz-rec/zlyq-ios-sdk

Repository files navigation

zlyq-ios-sdk

1. CocoaPods集成
pod 'ZLYQAnalyticSDK'
2. 初始化

导入头文件#import <ZLYQAnalyticSDK/ZADataAPI>

[[ZADataAPI share] configWithProjectID:projectID
                                appKey:appKey
                                apiKey:apiKey
                                server:server
                        uploadDuration:duration
                            uploadCount:count

projectIDappKeyapiKeyserver在私有化部署后获取,其中appKey需要添加到工程的scheme中,调试debugMode时需要唤起APP使用;

duration指定触发上传的间隔时间, 如果duration等于0,使用默认的15秒, 如果duration小于0,取消定时任务;

count指定触发上传的条数。

3. 指定事件

App用户登录时调用loginWithUserID传入userID,退出登录时调用logout清除登录信息

4. 更新用户画像

根据需要调用下面的方法,increaseProfile只能传入value是数值类型的信息

- (void)setProfile:(NSDictionary *)profileInfo;
- (void)setOnceProfile:(NSDictionary *)profileInfo;
- (void)appendProfile:(NSDictionary *)profileInfo;
- (void)increaseProfile:(NSDictionary *)profileInfo;
- (void)deleteProfile:(NSDictionary *)profileInfo;
- (void)unsetProfile:(NSDictionary *)profileInfo;
5. 埋点

普通上传

+ (void)addEvent:(NSString *)eventName info:(nullable NSDictionary *)info

实时上传 传入事件名称和时间对应的属性

+ (void)addEvent:(NSString *)eventName info:(nullable NSDictionary *)info shouldDelay:(BOOL)shouldDelay

shouldDelay值为false时,该事件实时上传,值为true时,等于普通上传

6. 登录、退出登录更新userId

登录成功后,传入userId

- (void)loginWithUserID:(NSString *)userID;

退出登录,清空userId

- (void)logout;
其它

提供了获取事件公共参数的方法, 用作服务端埋点时保证数据的完整性

- (NSDictionary *)commonParams;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published