miduo_client/Assets/Plugins/iOS/ThinkingSDK/Source/main/ThinkingAnalyticsSDK.h

558 lines
11 KiB
C
Raw Normal View History

2020-06-30 18:59:44 +08:00
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
2021-08-28 20:21:42 +08:00
#import "TDFirstEventModel.h"
#import "TDEditableEventModel.h"
#import "TDConfig.h"
#import "TDPresetProperties.h"
2020-06-30 18:59:44 +08:00
NS_ASSUME_NONNULL_BEGIN
/**
2021-08-28 20:21:42 +08:00
SDK VERSION = 2.7.0
2020-06-30 18:59:44 +08:00
ThinkingData API
## 初始化API
```objective-c
ThinkingAnalyticsSDK *instance = [ThinkingAnalyticsSDK startWithAppId:@"YOUR_APPID" withUrl:@"YOUR_SERVER_URL"];
```
## 事件埋点
```objective-c
instance.track("some_event");
```
```objective-c
[[ThinkingAnalyticsSDK sharedInstanceWithAppid:@"YOUR_APPID"] track:@"some_event"];
```
使
```objective-c
[[ThinkingAnalyticsSDK sharedInstance] track:@"some_event"];
```
## 详细文档
http://doc.thinkingdata.cn/tgamanual/installation/ios_sdk_installation.html
*/
@interface ThinkingAnalyticsSDK : NSObject
#pragma mark - Tracking
/**
@return SDK
*/
+ (nullable ThinkingAnalyticsSDK *)sharedInstance;
/**
APPID
@param appid APP ID
@return SDK
*/
+ (ThinkingAnalyticsSDK *)sharedInstanceWithAppid:(NSString *)appid;
/**
@param appId APP ID
@param url
@return SDK
*/
+ (ThinkingAnalyticsSDK *)startWithAppId:(NSString *)appId withUrl:(NSString *)url;
2021-08-28 20:21:42 +08:00
/**
@param config
@return SDK
*/
+ (ThinkingAnalyticsSDK *)startWithConfig:(nullable TDConfig *)config;
2020-06-30 18:59:44 +08:00
/**
@param appId APP ID
@param url
@param config
@return SDK
*/
+ (ThinkingAnalyticsSDK *)startWithAppId:(NSString *)appId withUrl:(NSString *)url withConfig:(nullable TDConfig *)config;
2021-08-28 20:21:42 +08:00
#pragma mark - Action Track
2020-06-30 18:59:44 +08:00
/**
@param event
*/
- (void)track:(NSString *)event;
/**
@param event
@param propertieDict
*/
- (void)track:(NSString *)event properties:(nullable NSDictionary *)propertieDict;
/**
@param event
@param propertieDict
@param time
*/
- (void)track:(NSString *)event properties:(nullable NSDictionary *)propertieDict time:(NSDate *)time __attribute__((deprecated("使用 track:properties:time:timeZone: 方法传入")));
/**
@param event
@param propertieDict
@param time
@param timeZone
*/
- (void)track:(NSString *)event properties:(nullable NSDictionary *)propertieDict time:(NSDate *)time timeZone:(NSTimeZone *)timeZone;
2021-08-28 20:21:42 +08:00
- (void)trackWithEventModel:(TDEventModel *)eventModel;
#pragma mark -
2020-06-30 18:59:44 +08:00
/**
@param event
*/
- (void)timeEvent:(NSString *)event;
/**
访ID
@param distinctId 访 ID
*/
- (void)identify:(NSString *)distinctId;
/**
访ID
@return 访 ID
*/
- (NSString *)getDistinctId;
/**
SDK
@return SDK
*/
+ (NSString *)getSDKVersion;
/**
ID
@param accountId ID
*/
- (void)login:(NSString *)accountId;
/**
ID
*/
- (void)logout;
/**
@param properties
*/
- (void)user_set:(NSDictionary *)properties;
/**
@param properties
@param time
*/
2021-08-28 20:21:42 +08:00
- (void)user_set:(NSDictionary *)properties withTime:(NSDate * _Nullable)time;
2020-06-30 18:59:44 +08:00
/**
@param propertyName
*/
- (void)user_unset:(NSString *)propertyName;
/**
@param propertyName
@param time
*/
2021-08-28 20:21:42 +08:00
- (void)user_unset:(NSString *)propertyName withTime:(NSDate * _Nullable)time;
2020-06-30 18:59:44 +08:00
/**
@param properties
*/
- (void)user_setOnce:(NSDictionary *)properties;
/**
@param properties
@param time
*/
2021-08-28 20:21:42 +08:00
- (void)user_setOnce:(NSDictionary *)properties withTime:(NSDate * _Nullable)time;
2020-06-30 18:59:44 +08:00
/**
@param properties
*/
- (void)user_add:(NSDictionary *)properties;
/**
@param properties
@param time
*/
2021-08-28 20:21:42 +08:00
- (void)user_add:(NSDictionary *)properties withTime:(NSDate * _Nullable)time;
2020-06-30 18:59:44 +08:00
/**
@param propertyName
@param propertyValue
*/
- (void)user_add:(NSString *)propertyName andPropertyValue:(NSNumber *)propertyValue;
/**
@param propertyName
@param propertyValue
@param time
*/
2021-08-28 20:21:42 +08:00
- (void)user_add:(NSString *)propertyName andPropertyValue:(NSNumber *)propertyValue withTime:(NSDate * _Nullable)time;
2020-06-30 18:59:44 +08:00
/**
使
*/
- (void)user_delete;
/**
使
@param time
*/
2021-08-28 20:21:42 +08:00
- (void)user_delete:(NSDate * _Nullable)time;
2020-06-30 18:59:44 +08:00
/**
Array
@param properties
*/
- (void)user_append:(NSDictionary<NSString *, NSArray *> *)properties;
/**
Array
@param properties
@param time
*/
2021-08-28 20:21:42 +08:00
- (void)user_append:(NSDictionary<NSString *, NSArray *> *)properties withTime:(NSDate * _Nullable)time;
/**
, 使, .
@param libName #lib, "iOS".
@param libVersion #lib_version , SDK.
*/
+ (void)setCustomerLibInfoWithLibName:(NSString *)libName libVersion:(NSString *)libVersion;
2020-06-30 18:59:44 +08:00
/**
@param properties
*/
- (void)setSuperProperties:(NSDictionary *)properties;
/**
@param property
*/
- (void)unsetSuperProperty:(NSString *)property;
/**
*/
- (void)clearSuperProperties;
/**
@return
*/
- (NSDictionary *)currentSuperProperties;
/**
@param dynamicSuperProperties
*/
- (void)registerDynamicSuperProperties:(NSDictionary<NSString *, id> *(^)(void))dynamicSuperProperties;
2021-08-28 20:21:42 +08:00
/**
@return
*/
- (TDPresetProperties *)getPresetProperties;
2020-06-30 18:59:44 +08:00
/**
SDK 3G4G Wifi
@param type
*/
- (void)setNetworkType:(ThinkingAnalyticsNetworkType)type;
/**
@param eventType ThinkingAnalyticsAutoTrackEventType
http://doc.thinkingdata.cn/tgamanual/installation/ios_sdk_installation/ios_sdk_autotrack.html
*/
- (void)enableAutoTrack:(ThinkingAnalyticsAutoTrackEventType)eventType;
/**
ID
@return ID
*/
- (NSString *)getDeviceId;
/**
@param controllers UIViewController
*/
- (void)ignoreAutoTrackViewControllers:(NSArray *)controllers;
/**
@param aClass Class
*/
- (void)ignoreViewType:(Class)aClass;
/**
H5 APP SDK addWebViewUserAgent 使
@param webView H5
@param request NSURLRequest
@return YES NO
http://doc.thinkingdata.cn/tgamanual/installation/h5_app_integrate.html
*/
- (BOOL)showUpWebView:(id)webView WithRequest:(NSURLRequest *)request;
/**
H5 UserAgent
*/
- (void)addWebViewUserAgent;
/**
Log
@param level
*/
+ (void)setLogLevel:(TDLoggingLevel)level;
/**
*/
- (void)flush;
/**
/
@param enabled YES NO
*/
- (void)enableTracking:(BOOL)enabled;
/**
*/
- (void)optOutTracking;
/**
user_del
*/
- (void)optOutTrackingAndDeleteUser;
/**
*/
- (void)optInTracking;
/**
@return SDK
*/
- (ThinkingAnalyticsSDK *)createLightInstance;
/**
使NTP Server
@param ntpServer NTP Server
*/
+ (void)calibrateTimeWithNtp:(NSString *)ntpServer;
/**
@param timestamp
*/
+ (void)calibrateTime:(NSTimeInterval)timestamp;
- (NSString *)getTimeString:(NSDate *)date;
@end
#pragma mark - Autotrack View Interface
/**
APP
*/
@interface UIView (ThinkingAnalytics)
/**
ID
*/
@property (copy,nonatomic) NSString *thinkingAnalyticsViewID;
/**
APPID ID
*/
@property (strong,nonatomic) NSDictionary *thinkingAnalyticsViewIDWithAppid;
/**
*/
@property (nonatomic,assign) BOOL thinkingAnalyticsIgnoreView;
/**
APPID
*/
@property (strong,nonatomic) NSDictionary *thinkingAnalyticsIgnoreViewWithAppid;
/**
*/
@property (strong,nonatomic) NSDictionary *thinkingAnalyticsViewProperties;
/**
APPID
*/
@property (strong,nonatomic) NSDictionary *thinkingAnalyticsViewPropertiesWithAppid;
/**
thinkingAnalyticsDelegate
*/
@property (nonatomic, weak, nullable) id thinkingAnalyticsDelegate;
@end
#pragma mark - Autotrack View Protocol
/**
*/
@protocol TDUIViewAutoTrackDelegate
@optional
/**
UITableView
@return
*/
- (NSDictionary *)thinkingAnalytics_tableView:(UITableView *)tableView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath;
/**
APPID UITableView
@return
*/
- (NSDictionary *)thinkingAnalyticsWithAppid_tableView:(UITableView *)tableView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath;
@optional
/**
UICollectionView
@return
*/
- (NSDictionary *)thinkingAnalytics_collectionView:(UICollectionView *)collectionView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath;
/**
APPID UICollectionView
@return
*/
- (NSDictionary *)thinkingAnalyticsWithAppid_collectionView:(UICollectionView *)collectionView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath;
@end
/**
*/
@protocol TDAutoTracker
@optional
/**
@return
*/
- (NSDictionary *)getTrackProperties;
/**
APPID
@return
*/
- (NSDictionary *)getTrackPropertiesWithAppid;
@end
/**
*/
@protocol TDScreenAutoTracker <TDAutoTracker>
@optional
/**
@return #url
*/
- (NSString *)getScreenUrl;
/**
APPID
@return #url
*/
- (NSDictionary *)getScreenUrlWithAppid;
@end
NS_ASSUME_NONNULL_END