MTAConfig.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. //
  2. // XGPushStatMTAConfig.h
  3. // TA-SDK
  4. //
  5. // Originally Created by uweiyuan on 2019/7/4.
  6. //
  7. //
  8. #import <Foundation/Foundation.h>
  9. /**
  10. 上报策略枚举值
  11. */
  12. typedef enum {
  13. /**
  14. 实时上报
  15. */
  16. XGPushStatMTA_STRATEGY_INSTANT = 1,
  17. /**
  18. 批量上报,达到缓存临界值时触发发送
  19. */
  20. XGPushStatMTA_STRATEGY_BATCH = 2,
  21. /**
  22. 应用启动时发送
  23. */
  24. XGPushStatMTA_STRATEGY_APP_LAUNCH = 3,
  25. /**
  26. 仅在WIFI网络下发送
  27. */
  28. XGPushStatMTA_STRATEGY_ONLY_WIFI = 4,
  29. /**
  30. 每间隔一定最小时间发送,默认24小时
  31. */
  32. XGPushStatMTA_STRATEGY_PERIOD = 5,
  33. /**
  34. 开发者在代码中主动调用发送行为
  35. */
  36. XGPushStatMTA_STRATEGY_DEVELOPER = 6,
  37. /**
  38. 仅在WIFI网络下发送, 发送失败以及非WIFI网络情况下不缓存数据
  39. */
  40. XGPushStatMTA_STRATEGY_ONLY_WIFI_NO_CACHE = 7,
  41. /*
  42. 不缓存数据,批量上报+间隔上报组合。适用于上报特别频繁的场景。
  43. */
  44. XGPushStatMTA_STRATEGY_NO_CACHE_BATCH_PERIOD = 8
  45. } XGPushStatMTAStatReportStrategy;
  46. @interface XGPushStatMTAConfig : NSObject
  47. #pragma mark - 常规配置项
  48. /**
  49. 取得XGPushStatMTA配置的共享实例
  50. 修改实例的属性必须在调用XGPushStatMTA启动函数之前执行
  51. @return XGPushStatMTAConfig的共享实例
  52. */
  53. + (instancetype)getInstance;
  54. /**
  55. debug开关
  56. 开以后,终端会输出debug日志,默认关闭
  57. */
  58. @property BOOL debugEnable;
  59. /**
  60. Session过期时间,默认30秒
  61. */
  62. @property uint32_t sessionTimeoutSecs;
  63. /**
  64. 上报策略
  65. */
  66. @property (nonatomic) XGPushStatMTAStatReportStrategy reportStrategy;
  67. /**
  68. 是否自动统计整个APP的使用时长,默认打开
  69. */
  70. @property BOOL autoTM;
  71. /**
  72. 若打开此项,XGPushStatMTA会在ViewController的
  73. viewDidAppear和viewWillDisappear
  74. 方法中,自动统计页面时长。
  75. 默认打开
  76. 注:若您自行实现了ViewController中
  77. 的viewDidAppear和viewWillDisappear
  78. 这两个方法。请在这两个方法中分别调用父类
  79. 的对应方法。否则此功能可能无法正常工作。
  80. */
  81. @property BOOL autoTrackPage;
  82. /**
  83. 应用的统计AppKey
  84. */
  85. @property (nonatomic, copy) NSString *appkey;
  86. /**
  87. 渠道名,默认为"appstore"
  88. */
  89. @property (nonatomic, copy) NSString *channel;
  90. /**
  91. 最大缓存的未发送的统计消息,默认1024条
  92. */
  93. @property uint32_t maxStoreEventCount;
  94. /**
  95. 统计上报策略为BATCH时,触发上报时最小缓存消息数,默认30条
  96. */
  97. @property uint32_t minBatchReportCount;
  98. /**
  99. 发送失败最大重试数,默认3次
  100. */
  101. @property uint32_t maxSendRetryCount;
  102. /**
  103. 上报策略为PERIOD时发送间隔,单位分钟,默认一天(1440分钟)
  104. */
  105. @property uint32_t sendPeriodMinutes;
  106. /**
  107. 允许同时统计的时长事件数,默认1024条
  108. */
  109. @property uint32_t maxParallelTimingEvents;
  110. /**
  111. 智能上报
  112. 开启以后设备接入WIFI会实时上报
  113. 否则按照全局策略上报
  114. 默认打开
  115. */
  116. @property BOOL smartReporting;
  117. /**
  118. 最大上报的单条event长度,超过不上报
  119. 单位Byte
  120. 默认4096,即4KB
  121. */
  122. @property uint32_t maxReportEventLength;
  123. /**
  124. XGPushStatMTA是否启动
  125. */
  126. @property BOOL statEnable;
  127. /**
  128. 设备的idfa,建议有广告权限的app设置此字段
  129. 默认为空
  130. */
  131. //@property (nonatomic, copy) NSString *ifa;
  132. /**
  133. 用户自定义的App版本
  134. 默认为空
  135. 若设置了这个字段,SDK会取这个字段作为APP版本上报
  136. 若没设置,则取工程配置文件中的‘Bundle versions string, short’字段作为APP版本上报
  137. 若没没设置‘Bundle versions string, short’字段,则取‘Bundle version’字段上报
  138. */
  139. @property (nonatomic, copy) NSString *customerAppVersion;
  140. /**
  141. 用户自定义的设备标识
  142. */
  143. @property (nonatomic, copy) NSString *customerUserID;
  144. /**
  145. 一个Session内允许上报的最大事件数
  146. 传入-1表示无限制
  147. 不建议修改这个字段
  148. 默认无限制
  149. */
  150. @property int32_t maxSessionStatReportCount;
  151. /**
  152. mid,会存放到mid字段(推荐赋值APNS的token)
  153. */
  154. @property (nonatomic, copy) NSString *mid;
  155. /**
  156. guid,预留字段,无特定含义
  157. */
  158. @property (nonatomic, assign) NSUInteger guid;
  159. /**
  160. 获取在XGPushStatMTA前端控制台配置的参数
  161. 调用这个函数前需要在XGPushStatMTA前端控制台中‘应用配置管理项’下的‘自定义参数’中配置才能生效
  162. 首次配置或者更改参数配置后,需要3-5分钟才能生效
  163. @param key 参数的key
  164. @param v 没取到参数时返回的默认值
  165. @return 参数的值或者默认值
  166. */
  167. - (NSString *)getCustomProperty:(NSString *)key default:(NSString *)v;
  168. /**
  169. 自定义上报地址
  170. */
  171. @property (nonatomic, copy) NSString *statReportURL;
  172. /// tpns accessID
  173. @property (nonatomic, assign) uint32_t tpnsAccessID;
  174. /// tpns sdk版本
  175. @property (nonatomic, copy) NSString *tpnsSDKVersion;
  176. /// 是否检查上报域名
  177. @property (nonatomic, assign) BOOL checkReportDomain;
  178. /// 当前允许的上报域名
  179. @property (nonatomic, copy) NSString *enableReportDomainStr;
  180. @end