diff --git a/SensorsAnalyticsSDK.podspec b/SensorsAnalyticsSDK.podspec index 270ba069..c09ff0e3 100644 --- a/SensorsAnalyticsSDK.podspec +++ b/SensorsAnalyticsSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SensorsAnalyticsSDK" - s.version = "2.6.4" + s.version = "2.6.5" s.summary = "The official iOS SDK of Sensors Analytics." s.homepage = "http://www.sensorsdata.cn" s.source = { :git => 'https://github.com/sensorsdata/sa-sdk-ios.git', :tag => "v#{s.version}" } @@ -13,15 +13,12 @@ Pod::Spec.new do |s| s.subspec 'Common' do |c| core_dir = "SensorsAnalyticsSDK/Core/" - auto_track_dir = "SensorsAnalyticsSDK/Core/AutoTrack/" c.source_files = core_dir + "**/*.{h,m}" - c.public_header_files = core_dir + "SensorsAnalyticsSDK.h", core_dir + "SensorsAnalyticsSDK+Public.h", core_dir + "SAAppExtensionDataManager.h", core_dir + "SASecurityPolicy.h", core_dir + "SAConfigOptions.h", core_dir + "SAConstants.h", auto_track_dir + "SensorsAnalyticsSDK+SAAutoTrack.h" + c.public_header_files = core_dir + "SensorsAnalyticsSDK.h", core_dir + "SensorsAnalyticsSDK+Public.h", core_dir + "SAAppExtensionDataManager.h", core_dir + "SASecurityPolicy.h", core_dir + "SAConfigOptions.h", core_dir + "SAConstants.h" c.resource = 'SensorsAnalyticsSDK/SensorsAnalyticsSDK.bundle' end s.subspec 'Core' do |c| - c.dependency 'SensorsAnalyticsSDK/Common' - c.dependency 'SensorsAnalyticsSDK/Gesture' c.dependency 'SensorsAnalyticsSDK/Visualized' end @@ -32,16 +29,16 @@ Pod::Spec.new do |s| f.private_header_files = 'SensorsAnalyticsSDK/CAID/**/*.h' end - # 手势采集 - s.subspec 'Gesture' do |g| + # 全埋点 + s.subspec 'AutoTrack' do |g| g.dependency 'SensorsAnalyticsSDK/Common' - g.source_files = "SensorsAnalyticsSDK/Gesture/**/*.{h,m}" - g.private_header_files = 'SensorsAnalyticsSDK/Gesture/**/*.h' + g.source_files = "SensorsAnalyticsSDK/AutoTrack/**/*.{h,m}" + g.public_header_files = 'SensorsAnalyticsSDK/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.h' end # 可视化相关功能,包含可视化全埋点和点击图 s.subspec 'Visualized' do |f| - f.dependency 'SensorsAnalyticsSDK/Common' + f.dependency 'SensorsAnalyticsSDK/AutoTrack' f.source_files = "SensorsAnalyticsSDK/Visualized/**/*.{h,m}" f.public_header_files = 'SensorsAnalyticsSDK/Visualized/SensorsAnalyticsSDK+Visualized.h' end @@ -84,18 +81,6 @@ Pod::Spec.new do |s| w.public_header_files = 'SensorsAnalyticsSDK/WKWebView/SensorsAnalyticsSDK+WKWebView.h' end - # 允许使用私有 API,v2.0.0 已废弃,待删除 - s.subspec 'ENABLE_NO_PUBLIC_APIS' do |f| - f.dependency 'SensorsAnalyticsSDK/Core' - f.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'SENSORS_ANALYTICS_ENABLE_NO_PUBLICK_APIS=1'} - end - - # 不采集 UITabBar 点击事件 - s.subspec 'DISABLE_AUTOTRACK_UITABBAR' do |f| - f.dependency 'SensorsAnalyticsSDK/Core' - f.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'SENSORS_ANALYTICS_DISABLE_AUTOTRACK_UITABBAR=1'} - end - # 采集 crash slideAdress 信息,需要打开 enableTrackAppCrash 才生效 s.subspec 'CRASH_SLIDEADDRESS' do |f| f.dependency 'SensorsAnalyticsSDK/Core' diff --git a/SensorsAnalyticsSDK.xcodeproj/project.pbxproj b/SensorsAnalyticsSDK.xcodeproj/project.pbxproj index e399c312..12371e64 100644 --- a/SensorsAnalyticsSDK.xcodeproj/project.pbxproj +++ b/SensorsAnalyticsSDK.xcodeproj/project.pbxproj @@ -26,32 +26,6 @@ 45A5656C263C174300C9C41B /* SABaseEventObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A56559263C174300C9C41B /* SABaseEventObject.m */; }; 45A5656D263C174300C9C41B /* SAPresetProperty.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A5655A263C174300C9C41B /* SAPresetProperty.m */; }; 45A5656E263C174300C9C41B /* SASuperProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A5655B263C174300C9C41B /* SASuperProperty.h */; }; - 45A56594263C176700C9C41B /* SAAutoTrackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A56576263C176700C9C41B /* SAAutoTrackManager.m */; }; - 45A56595263C176700C9C41B /* SAAutoTrackUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A56577263C176700C9C41B /* SAAutoTrackUtils.h */; }; - 45A56596263C176700C9C41B /* UIView+AutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A56578263C176700C9C41B /* UIView+AutoTrack.h */; }; - 45A56597263C176700C9C41B /* UIViewController+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A56579263C176700C9C41B /* UIViewController+AutoTrack.m */; }; - 45A56598263C176700C9C41B /* SAAppTrackerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A5657A263C176700C9C41B /* SAAppTrackerProtocol.h */; }; - 45A56599263C176700C9C41B /* SAAppEndTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A5657C263C176700C9C41B /* SAAppEndTracker.m */; }; - 45A5659A263C176700C9C41B /* SAAppEndTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A5657D263C176700C9C41B /* SAAppEndTracker.h */; }; - 45A5659B263C176700C9C41B /* SensorsAnalyticsSDK+SAAutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A5657E263C176700C9C41B /* SensorsAnalyticsSDK+SAAutoTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 45A5659C263C176700C9C41B /* SAAutoTrackProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A5657F263C176700C9C41B /* SAAutoTrackProperty.h */; }; - 45A5659D263C176700C9C41B /* UIApplication+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A56580263C176700C9C41B /* UIApplication+AutoTrack.m */; }; - 45A5659E263C176700C9C41B /* SAScrollViewDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A56582263C176700C9C41B /* SAScrollViewDelegateProxy.m */; }; - 45A5659F263C176700C9C41B /* UIScrollView+AutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A56583263C176700C9C41B /* UIScrollView+AutoTrack.h */; }; - 45A565A0263C176700C9C41B /* SAScrollViewDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A56584263C176700C9C41B /* SAScrollViewDelegateProxy.h */; }; - 45A565A1263C176700C9C41B /* UIScrollView+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A56585263C176700C9C41B /* UIScrollView+AutoTrack.m */; }; - 45A565A2263C176700C9C41B /* SAAutoTrackManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A56586263C176700C9C41B /* SAAutoTrackManager.h */; }; - 45A565A3263C176700C9C41B /* SAAppStartTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A56588263C176700C9C41B /* SAAppStartTracker.h */; }; - 45A565A4263C176700C9C41B /* SAAppStartTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A56589263C176700C9C41B /* SAAppStartTracker.m */; }; - 45A565A5263C176700C9C41B /* UIViewController+AutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A5658A263C176700C9C41B /* UIViewController+AutoTrack.h */; }; - 45A565A6263C176700C9C41B /* UIView+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A5658B263C176700C9C41B /* UIView+AutoTrack.m */; }; - 45A565A7263C176700C9C41B /* SAAutoTrackUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A5658C263C176700C9C41B /* SAAutoTrackUtils.m */; }; - 45A565A8263C176700C9C41B /* SensorsAnalyticsSDK+SAAutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A5658D263C176700C9C41B /* SensorsAnalyticsSDK+SAAutoTrack.m */; }; - 45A565A9263C176700C9C41B /* SAViewElementInfoFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A5658F263C176700C9C41B /* SAViewElementInfoFactory.h */; }; - 45A565AA263C176700C9C41B /* SAViewElementInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A56590263C176700C9C41B /* SAViewElementInfo.m */; }; - 45A565AB263C176700C9C41B /* SAViewElementInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A56591263C176700C9C41B /* SAViewElementInfo.h */; }; - 45A565AC263C176700C9C41B /* SAViewElementInfoFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A56592263C176700C9C41B /* SAViewElementInfoFactory.m */; }; - 45A565AD263C176700C9C41B /* UIApplication+AutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A56593263C176700C9C41B /* UIApplication+AutoTrack.h */; }; 45A565BC263C17E400C9C41B /* SAReferrerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 45A565B8263C17E400C9C41B /* SAReferrerManager.h */; }; 45A565BD263C17E400C9C41B /* SAReferrerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A565B9263C17E400C9C41B /* SAReferrerManager.m */; }; 45A565BE263C17E400C9C41B /* SAAppLifecycle.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A565BA263C17E400C9C41B /* SAAppLifecycle.m */; }; @@ -74,18 +48,6 @@ 4D2D53BE2591EB3A00805141 /* SAJSONUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D2D53AE2591EB3900805141 /* SAJSONUtil.m */; }; 4D2D53C22591EB3A00805141 /* SAReadWriteLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D2D53B22591EB3900805141 /* SAReadWriteLock.h */; }; 4D2D53C62591EB3A00805141 /* SACommonUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D2D53B62591EB3A00805141 /* SACommonUtility.m */; }; - 4D41572B26048448009A9879 /* SAGestureTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D41571E26048448009A9879 /* SAGestureTarget.h */; }; - 4D41572C26048448009A9879 /* SAGestureTarget.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D41571F26048448009A9879 /* SAGestureTarget.m */; }; - 4D41572D26048448009A9879 /* SAGestureViewProcessorFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D41572126048448009A9879 /* SAGestureViewProcessorFactory.m */; }; - 4D41572E26048448009A9879 /* SAGeneralGestureViewProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D41572226048448009A9879 /* SAGeneralGestureViewProcessor.h */; }; - 4D41572F26048448009A9879 /* SAGestureViewProcessorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D41572326048448009A9879 /* SAGestureViewProcessorFactory.h */; }; - 4D41573026048448009A9879 /* SAGeneralGestureViewProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D41572426048448009A9879 /* SAGeneralGestureViewProcessor.m */; }; - 4D41573126048448009A9879 /* SAGestureManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D41572526048448009A9879 /* SAGestureManager.h */; }; - 4D41573226048448009A9879 /* SAGestureTargetActionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D41572626048448009A9879 /* SAGestureTargetActionModel.m */; }; - 4D41573326048449009A9879 /* UIGestureRecognizer+SAAutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D41572726048448009A9879 /* UIGestureRecognizer+SAAutoTrack.m */; }; - 4D41573426048449009A9879 /* SAGestureTargetActionModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D41572826048448009A9879 /* SAGestureTargetActionModel.h */; }; - 4D41573526048449009A9879 /* SAGestureManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D41572926048448009A9879 /* SAGestureManager.m */; }; - 4D41573626048449009A9879 /* UIGestureRecognizer+SAAutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D41572A26048448009A9879 /* UIGestureRecognizer+SAAutoTrack.h */; }; 4D41D9D325FF7E9300D856F4 /* UIViewController+SAElementPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D41D9D125FF7E9300D856F4 /* UIViewController+SAElementPath.h */; }; 4D41D9D425FF7E9300D856F4 /* UIViewController+SAElementPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D41D9D225FF7E9300D856F4 /* UIViewController+SAElementPath.m */; }; 4D4DB2C725B7D19C00938842 /* SAClassHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D4DB2BD25B7D19B00938842 /* SAClassHelper.h */; }; @@ -222,6 +184,47 @@ 888D7A0D2567B3C30052FCF7 /* SADebugModeManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 888D7A0B2567B3C30052FCF7 /* SADebugModeManager.h */; }; 888D7A0E2567B3C30052FCF7 /* SADebugModeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 888D7A0C2567B3C30052FCF7 /* SADebugModeManager.m */; }; A83129AA246E400B00A18C25 /* SAPresetPropertyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A83129A9246E400B00A18C25 /* SAPresetPropertyTests.m */; }; + A8356DBC2656459A00FD64AA /* SAAutoTrackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356D882656459A00FD64AA /* SAAutoTrackManager.m */; }; + A8356DBD2656459A00FD64AA /* SAAutoTrackUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356D892656459A00FD64AA /* SAAutoTrackUtils.h */; }; + A8356DBE2656459A00FD64AA /* UIView+AutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356D8A2656459A00FD64AA /* UIView+AutoTrack.h */; }; + A8356DBF2656459A00FD64AA /* UIViewController+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356D8B2656459A00FD64AA /* UIViewController+AutoTrack.m */; }; + A8356DC02656459A00FD64AA /* SAAppEndTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356D8D2656459A00FD64AA /* SAAppEndTracker.m */; }; + A8356DC12656459A00FD64AA /* SAAppEndTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356D8E2656459A00FD64AA /* SAAppEndTracker.h */; }; + A8356DC22656459A00FD64AA /* SensorsAnalyticsSDK+SAAutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356D8F2656459A00FD64AA /* SensorsAnalyticsSDK+SAAutoTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A8356DC32656459A00FD64AA /* SAAutoTrackProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356D902656459A00FD64AA /* SAAutoTrackProperty.h */; }; + A8356DC42656459A00FD64AA /* UIApplication+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356D912656459A00FD64AA /* UIApplication+AutoTrack.m */; }; + A8356DC52656459A00FD64AA /* SAAppTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356D922656459A00FD64AA /* SAAppTracker.h */; }; + A8356DC62656459A00FD64AA /* SAScrollViewDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356D942656459A00FD64AA /* SAScrollViewDelegateProxy.m */; }; + A8356DC72656459A00FD64AA /* UIScrollView+AutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356D952656459A00FD64AA /* UIScrollView+AutoTrack.h */; }; + A8356DC82656459A00FD64AA /* SAScrollViewDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356D962656459A00FD64AA /* SAScrollViewDelegateProxy.h */; }; + A8356DC92656459A00FD64AA /* UIScrollView+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356D972656459A00FD64AA /* UIScrollView+AutoTrack.m */; }; + A8356DCA2656459A00FD64AA /* SAAutoTrackManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356D982656459A00FD64AA /* SAAutoTrackManager.h */; }; + A8356DCB2656459A00FD64AA /* SAGestureTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356D9B2656459A00FD64AA /* SAGestureTarget.h */; }; + A8356DCC2656459A00FD64AA /* SAGestureTarget.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356D9C2656459A00FD64AA /* SAGestureTarget.m */; }; + A8356DCD2656459A00FD64AA /* SAGestureViewProcessorFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356D9E2656459A00FD64AA /* SAGestureViewProcessorFactory.m */; }; + A8356DCE2656459A00FD64AA /* SAGeneralGestureViewProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356D9F2656459A00FD64AA /* SAGeneralGestureViewProcessor.h */; }; + A8356DCF2656459A00FD64AA /* SAGestureViewProcessorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356DA02656459A00FD64AA /* SAGestureViewProcessorFactory.h */; }; + A8356DD02656459A00FD64AA /* SAGeneralGestureViewProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356DA12656459A00FD64AA /* SAGeneralGestureViewProcessor.m */; }; + A8356DD22656459A00FD64AA /* SAGestureTargetActionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356DA32656459A00FD64AA /* SAGestureTargetActionModel.m */; }; + A8356DD32656459A00FD64AA /* UIGestureRecognizer+SAAutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356DA42656459A00FD64AA /* UIGestureRecognizer+SAAutoTrack.m */; }; + A8356DD42656459A00FD64AA /* SAGestureTargetActionModel.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356DA52656459A00FD64AA /* SAGestureTargetActionModel.h */; }; + A8356DD62656459A00FD64AA /* UIGestureRecognizer+SAAutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356DA72656459A00FD64AA /* UIGestureRecognizer+SAAutoTrack.h */; }; + A8356DD72656459A00FD64AA /* SAAppClickTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356DA92656459A00FD64AA /* SAAppClickTracker.m */; }; + A8356DD82656459A00FD64AA /* SAAppClickTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356DAA2656459A00FD64AA /* SAAppClickTracker.h */; }; + A8356DD92656459A00FD64AA /* SAAppStartTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356DAC2656459A00FD64AA /* SAAppStartTracker.h */; }; + A8356DDA2656459A00FD64AA /* SAAppStartTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356DAD2656459A00FD64AA /* SAAppStartTracker.m */; }; + A8356DDB2656459A00FD64AA /* UIViewController+AutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356DAE2656459A00FD64AA /* UIViewController+AutoTrack.h */; }; + A8356DDC2656459A00FD64AA /* UIView+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356DAF2656459A00FD64AA /* UIView+AutoTrack.m */; }; + A8356DDD2656459A00FD64AA /* SAAutoTrackUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356DB02656459A00FD64AA /* SAAutoTrackUtils.m */; }; + A8356DDE2656459A00FD64AA /* SensorsAnalyticsSDK+SAAutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356DB12656459A00FD64AA /* SensorsAnalyticsSDK+SAAutoTrack.m */; }; + A8356DDF2656459A00FD64AA /* SAViewElementInfoFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356DB32656459A00FD64AA /* SAViewElementInfoFactory.h */; }; + A8356DE02656459A00FD64AA /* SAViewElementInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356DB42656459A00FD64AA /* SAViewElementInfo.m */; }; + A8356DE12656459A00FD64AA /* SAViewElementInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356DB52656459A00FD64AA /* SAViewElementInfo.h */; }; + A8356DE22656459A00FD64AA /* SAViewElementInfoFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356DB62656459A00FD64AA /* SAViewElementInfoFactory.m */; }; + A8356DE32656459A00FD64AA /* SAAppTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356DB72656459A00FD64AA /* SAAppTracker.m */; }; + A8356DE42656459A00FD64AA /* SAAppViewScreenTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356DB92656459A00FD64AA /* SAAppViewScreenTracker.h */; }; + A8356DE52656459A00FD64AA /* SAAppViewScreenTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = A8356DBA2656459A00FD64AA /* SAAppViewScreenTracker.m */; }; + A8356DE62656459A00FD64AA /* UIApplication+AutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = A8356DBB2656459A00FD64AA /* UIApplication+AutoTrack.h */; }; A8A87E4C2568EBD500E16895 /* SARemoteConfigCheckOperator.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A87E422568EBD500E16895 /* SARemoteConfigCheckOperator.h */; }; A8A87E4D2568EBD500E16895 /* SARemoteConfigManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A8A87E432568EBD500E16895 /* SARemoteConfigManager.m */; }; A8A87E4E2568EBD500E16895 /* SARemoteConfigCheckOperator.m in Sources */ = {isa = PBXBuildFile; fileRef = A8A87E442568EBD500E16895 /* SARemoteConfigCheckOperator.m */; }; @@ -311,32 +314,6 @@ 45A56559263C174300C9C41B /* SABaseEventObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SABaseEventObject.m; sourceTree = ""; }; 45A5655A263C174300C9C41B /* SAPresetProperty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAPresetProperty.m; sourceTree = ""; }; 45A5655B263C174300C9C41B /* SASuperProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SASuperProperty.h; sourceTree = ""; }; - 45A56576263C176700C9C41B /* SAAutoTrackManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAutoTrackManager.m; sourceTree = ""; }; - 45A56577263C176700C9C41B /* SAAutoTrackUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAutoTrackUtils.h; sourceTree = ""; }; - 45A56578263C176700C9C41B /* UIView+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+AutoTrack.h"; sourceTree = ""; }; - 45A56579263C176700C9C41B /* UIViewController+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+AutoTrack.m"; sourceTree = ""; }; - 45A5657A263C176700C9C41B /* SAAppTrackerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAppTrackerProtocol.h; sourceTree = ""; }; - 45A5657C263C176700C9C41B /* SAAppEndTracker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAppEndTracker.m; sourceTree = ""; }; - 45A5657D263C176700C9C41B /* SAAppEndTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAppEndTracker.h; sourceTree = ""; }; - 45A5657E263C176700C9C41B /* SensorsAnalyticsSDK+SAAutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SensorsAnalyticsSDK+SAAutoTrack.h"; sourceTree = ""; }; - 45A5657F263C176700C9C41B /* SAAutoTrackProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAutoTrackProperty.h; sourceTree = ""; }; - 45A56580263C176700C9C41B /* UIApplication+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIApplication+AutoTrack.m"; sourceTree = ""; }; - 45A56582263C176700C9C41B /* SAScrollViewDelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAScrollViewDelegateProxy.m; sourceTree = ""; }; - 45A56583263C176700C9C41B /* UIScrollView+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+AutoTrack.h"; sourceTree = ""; }; - 45A56584263C176700C9C41B /* SAScrollViewDelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAScrollViewDelegateProxy.h; sourceTree = ""; }; - 45A56585263C176700C9C41B /* UIScrollView+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+AutoTrack.m"; sourceTree = ""; }; - 45A56586263C176700C9C41B /* SAAutoTrackManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAutoTrackManager.h; sourceTree = ""; }; - 45A56588263C176700C9C41B /* SAAppStartTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAppStartTracker.h; sourceTree = ""; }; - 45A56589263C176700C9C41B /* SAAppStartTracker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAppStartTracker.m; sourceTree = ""; }; - 45A5658A263C176700C9C41B /* UIViewController+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+AutoTrack.h"; sourceTree = ""; }; - 45A5658B263C176700C9C41B /* UIView+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+AutoTrack.m"; sourceTree = ""; }; - 45A5658C263C176700C9C41B /* SAAutoTrackUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAutoTrackUtils.m; sourceTree = ""; }; - 45A5658D263C176700C9C41B /* SensorsAnalyticsSDK+SAAutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SensorsAnalyticsSDK+SAAutoTrack.m"; sourceTree = ""; }; - 45A5658F263C176700C9C41B /* SAViewElementInfoFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAViewElementInfoFactory.h; sourceTree = ""; }; - 45A56590263C176700C9C41B /* SAViewElementInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAViewElementInfo.m; sourceTree = ""; }; - 45A56591263C176700C9C41B /* SAViewElementInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAViewElementInfo.h; sourceTree = ""; }; - 45A56592263C176700C9C41B /* SAViewElementInfoFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAViewElementInfoFactory.m; sourceTree = ""; }; - 45A56593263C176700C9C41B /* UIApplication+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIApplication+AutoTrack.h"; sourceTree = ""; }; 45A565B8263C17E400C9C41B /* SAReferrerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAReferrerManager.h; sourceTree = ""; }; 45A565B9263C17E400C9C41B /* SAReferrerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAReferrerManager.m; sourceTree = ""; }; 45A565BA263C17E400C9C41B /* SAAppLifecycle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAppLifecycle.m; sourceTree = ""; }; @@ -386,18 +363,6 @@ 4D2D53B62591EB3A00805141 /* SACommonUtility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SACommonUtility.m; sourceTree = ""; }; 4D2D53B72591EB3A00805141 /* SAValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAValidator.h; sourceTree = ""; }; 4D2D53B82591EB3A00805141 /* SACommonUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SACommonUtility.h; sourceTree = ""; }; - 4D41571E26048448009A9879 /* SAGestureTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAGestureTarget.h; sourceTree = ""; }; - 4D41571F26048448009A9879 /* SAGestureTarget.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAGestureTarget.m; sourceTree = ""; }; - 4D41572126048448009A9879 /* SAGestureViewProcessorFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAGestureViewProcessorFactory.m; sourceTree = ""; }; - 4D41572226048448009A9879 /* SAGeneralGestureViewProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAGeneralGestureViewProcessor.h; sourceTree = ""; }; - 4D41572326048448009A9879 /* SAGestureViewProcessorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAGestureViewProcessorFactory.h; sourceTree = ""; }; - 4D41572426048448009A9879 /* SAGeneralGestureViewProcessor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAGeneralGestureViewProcessor.m; sourceTree = ""; }; - 4D41572526048448009A9879 /* SAGestureManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAGestureManager.h; sourceTree = ""; }; - 4D41572626048448009A9879 /* SAGestureTargetActionModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAGestureTargetActionModel.m; sourceTree = ""; }; - 4D41572726048448009A9879 /* UIGestureRecognizer+SAAutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIGestureRecognizer+SAAutoTrack.m"; sourceTree = ""; }; - 4D41572826048448009A9879 /* SAGestureTargetActionModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAGestureTargetActionModel.h; sourceTree = ""; }; - 4D41572926048448009A9879 /* SAGestureManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAGestureManager.m; sourceTree = ""; }; - 4D41572A26048448009A9879 /* UIGestureRecognizer+SAAutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIGestureRecognizer+SAAutoTrack.h"; sourceTree = ""; }; 4D41D9D125FF7E9300D856F4 /* UIViewController+SAElementPath.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIViewController+SAElementPath.h"; sourceTree = ""; }; 4D41D9D225FF7E9300D856F4 /* UIViewController+SAElementPath.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+SAElementPath.m"; sourceTree = ""; }; 4D4DB2BD25B7D19B00938842 /* SAClassHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAClassHelper.h; sourceTree = ""; }; @@ -534,6 +499,47 @@ 888D7A0B2567B3C30052FCF7 /* SADebugModeManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SADebugModeManager.h; sourceTree = ""; }; 888D7A0C2567B3C30052FCF7 /* SADebugModeManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SADebugModeManager.m; sourceTree = ""; }; A83129A9246E400B00A18C25 /* SAPresetPropertyTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SAPresetPropertyTests.m; sourceTree = ""; }; + A8356D882656459A00FD64AA /* SAAutoTrackManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAutoTrackManager.m; sourceTree = ""; }; + A8356D892656459A00FD64AA /* SAAutoTrackUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAutoTrackUtils.h; sourceTree = ""; }; + A8356D8A2656459A00FD64AA /* UIView+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+AutoTrack.h"; sourceTree = ""; }; + A8356D8B2656459A00FD64AA /* UIViewController+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+AutoTrack.m"; sourceTree = ""; }; + A8356D8D2656459A00FD64AA /* SAAppEndTracker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAppEndTracker.m; sourceTree = ""; }; + A8356D8E2656459A00FD64AA /* SAAppEndTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAppEndTracker.h; sourceTree = ""; }; + A8356D8F2656459A00FD64AA /* SensorsAnalyticsSDK+SAAutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SensorsAnalyticsSDK+SAAutoTrack.h"; sourceTree = ""; }; + A8356D902656459A00FD64AA /* SAAutoTrackProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAutoTrackProperty.h; sourceTree = ""; }; + A8356D912656459A00FD64AA /* UIApplication+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIApplication+AutoTrack.m"; sourceTree = ""; }; + A8356D922656459A00FD64AA /* SAAppTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAppTracker.h; sourceTree = ""; }; + A8356D942656459A00FD64AA /* SAScrollViewDelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAScrollViewDelegateProxy.m; sourceTree = ""; }; + A8356D952656459A00FD64AA /* UIScrollView+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+AutoTrack.h"; sourceTree = ""; }; + A8356D962656459A00FD64AA /* SAScrollViewDelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAScrollViewDelegateProxy.h; sourceTree = ""; }; + A8356D972656459A00FD64AA /* UIScrollView+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+AutoTrack.m"; sourceTree = ""; }; + A8356D982656459A00FD64AA /* SAAutoTrackManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAutoTrackManager.h; sourceTree = ""; }; + A8356D9B2656459A00FD64AA /* SAGestureTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAGestureTarget.h; sourceTree = ""; }; + A8356D9C2656459A00FD64AA /* SAGestureTarget.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAGestureTarget.m; sourceTree = ""; }; + A8356D9E2656459A00FD64AA /* SAGestureViewProcessorFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAGestureViewProcessorFactory.m; sourceTree = ""; }; + A8356D9F2656459A00FD64AA /* SAGeneralGestureViewProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAGeneralGestureViewProcessor.h; sourceTree = ""; }; + A8356DA02656459A00FD64AA /* SAGestureViewProcessorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAGestureViewProcessorFactory.h; sourceTree = ""; }; + A8356DA12656459A00FD64AA /* SAGeneralGestureViewProcessor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAGeneralGestureViewProcessor.m; sourceTree = ""; }; + A8356DA32656459A00FD64AA /* SAGestureTargetActionModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAGestureTargetActionModel.m; sourceTree = ""; }; + A8356DA42656459A00FD64AA /* UIGestureRecognizer+SAAutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIGestureRecognizer+SAAutoTrack.m"; sourceTree = ""; }; + A8356DA52656459A00FD64AA /* SAGestureTargetActionModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAGestureTargetActionModel.h; sourceTree = ""; }; + A8356DA72656459A00FD64AA /* UIGestureRecognizer+SAAutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIGestureRecognizer+SAAutoTrack.h"; sourceTree = ""; }; + A8356DA92656459A00FD64AA /* SAAppClickTracker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAppClickTracker.m; sourceTree = ""; }; + A8356DAA2656459A00FD64AA /* SAAppClickTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAppClickTracker.h; sourceTree = ""; }; + A8356DAC2656459A00FD64AA /* SAAppStartTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAppStartTracker.h; sourceTree = ""; }; + A8356DAD2656459A00FD64AA /* SAAppStartTracker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAppStartTracker.m; sourceTree = ""; }; + A8356DAE2656459A00FD64AA /* UIViewController+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+AutoTrack.h"; sourceTree = ""; }; + A8356DAF2656459A00FD64AA /* UIView+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+AutoTrack.m"; sourceTree = ""; }; + A8356DB02656459A00FD64AA /* SAAutoTrackUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAutoTrackUtils.m; sourceTree = ""; }; + A8356DB12656459A00FD64AA /* SensorsAnalyticsSDK+SAAutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SensorsAnalyticsSDK+SAAutoTrack.m"; sourceTree = ""; }; + A8356DB32656459A00FD64AA /* SAViewElementInfoFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAViewElementInfoFactory.h; sourceTree = ""; }; + A8356DB42656459A00FD64AA /* SAViewElementInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAViewElementInfo.m; sourceTree = ""; }; + A8356DB52656459A00FD64AA /* SAViewElementInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAViewElementInfo.h; sourceTree = ""; }; + A8356DB62656459A00FD64AA /* SAViewElementInfoFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAViewElementInfoFactory.m; sourceTree = ""; }; + A8356DB72656459A00FD64AA /* SAAppTracker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAppTracker.m; sourceTree = ""; }; + A8356DB92656459A00FD64AA /* SAAppViewScreenTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAppViewScreenTracker.h; sourceTree = ""; }; + A8356DBA2656459A00FD64AA /* SAAppViewScreenTracker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAppViewScreenTracker.m; sourceTree = ""; }; + A8356DBB2656459A00FD64AA /* UIApplication+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIApplication+AutoTrack.h"; sourceTree = ""; }; A8A87E422568EBD500E16895 /* SARemoteConfigCheckOperator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SARemoteConfigCheckOperator.h; sourceTree = ""; }; A8A87E432568EBD500E16895 /* SARemoteConfigManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SARemoteConfigManager.m; sourceTree = ""; }; A8A87E442568EBD500E16895 /* SARemoteConfigCheckOperator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SARemoteConfigCheckOperator.m; sourceTree = ""; }; @@ -641,86 +647,21 @@ 45A5654E263C174300C9C41B /* EventObject */ = { isa = PBXGroup; children = ( + 45A56554263C174300C9C41B /* SABaseEventObject.h */, + 45A56559263C174300C9C41B /* SABaseEventObject.m */, 45A5654F263C174300C9C41B /* SAEventBuildStrategyProtocol.h */, - 45A56550263C174300C9C41B /* SAPropertyValidator.h */, - 45A56551263C174300C9C41B /* SATrackEventObject.h */, + 45A56557263C174300C9C41B /* SAEventLibObject.h */, 45A56552263C174300C9C41B /* SAEventLibObject.m */, + 45A56556263C174300C9C41B /* SAProfileEventObject.h */, 45A56553263C174300C9C41B /* SAProfileEventObject.m */, - 45A56554263C174300C9C41B /* SABaseEventObject.h */, + 45A56550263C174300C9C41B /* SAPropertyValidator.h */, 45A56555263C174300C9C41B /* SAPropertyValidator.m */, - 45A56556263C174300C9C41B /* SAProfileEventObject.h */, - 45A56557263C174300C9C41B /* SAEventLibObject.h */, + 45A56551263C174300C9C41B /* SATrackEventObject.h */, 45A56558263C174300C9C41B /* SATrackEventObject.m */, - 45A56559263C174300C9C41B /* SABaseEventObject.m */, ); path = EventObject; sourceTree = ""; }; - 45A56575263C176700C9C41B /* AutoTrack */ = { - isa = PBXGroup; - children = ( - 45A5657B263C176700C9C41B /* AppEnd */, - 45A56587263C176700C9C41B /* AppStart */, - 45A56581263C176700C9C41B /* Cell */, - 45A5658E263C176700C9C41B /* ElementInfo */, - 45A5657A263C176700C9C41B /* SAAppTrackerProtocol.h */, - 45A56586263C176700C9C41B /* SAAutoTrackManager.h */, - 45A56576263C176700C9C41B /* SAAutoTrackManager.m */, - 45A5657F263C176700C9C41B /* SAAutoTrackProperty.h */, - 45A56577263C176700C9C41B /* SAAutoTrackUtils.h */, - 45A5658C263C176700C9C41B /* SAAutoTrackUtils.m */, - 45A5657E263C176700C9C41B /* SensorsAnalyticsSDK+SAAutoTrack.h */, - 45A5658D263C176700C9C41B /* SensorsAnalyticsSDK+SAAutoTrack.m */, - 45A56593263C176700C9C41B /* UIApplication+AutoTrack.h */, - 45A56580263C176700C9C41B /* UIApplication+AutoTrack.m */, - 45A56578263C176700C9C41B /* UIView+AutoTrack.h */, - 45A5658B263C176700C9C41B /* UIView+AutoTrack.m */, - 45A5658A263C176700C9C41B /* UIViewController+AutoTrack.h */, - 45A56579263C176700C9C41B /* UIViewController+AutoTrack.m */, - ); - path = AutoTrack; - sourceTree = ""; - }; - 45A5657B263C176700C9C41B /* AppEnd */ = { - isa = PBXGroup; - children = ( - 45A5657C263C176700C9C41B /* SAAppEndTracker.m */, - 45A5657D263C176700C9C41B /* SAAppEndTracker.h */, - ); - path = AppEnd; - sourceTree = ""; - }; - 45A56581263C176700C9C41B /* Cell */ = { - isa = PBXGroup; - children = ( - 45A56582263C176700C9C41B /* SAScrollViewDelegateProxy.m */, - 45A56583263C176700C9C41B /* UIScrollView+AutoTrack.h */, - 45A56584263C176700C9C41B /* SAScrollViewDelegateProxy.h */, - 45A56585263C176700C9C41B /* UIScrollView+AutoTrack.m */, - ); - path = Cell; - sourceTree = ""; - }; - 45A56587263C176700C9C41B /* AppStart */ = { - isa = PBXGroup; - children = ( - 45A56588263C176700C9C41B /* SAAppStartTracker.h */, - 45A56589263C176700C9C41B /* SAAppStartTracker.m */, - ); - path = AppStart; - sourceTree = ""; - }; - 45A5658E263C176700C9C41B /* ElementInfo */ = { - isa = PBXGroup; - children = ( - 45A5658F263C176700C9C41B /* SAViewElementInfoFactory.h */, - 45A56590263C176700C9C41B /* SAViewElementInfo.m */, - 45A56591263C176700C9C41B /* SAViewElementInfo.h */, - 45A56592263C176700C9C41B /* SAViewElementInfoFactory.m */, - ); - path = ElementInfo; - sourceTree = ""; - }; 4D0571A525A2FC46007F7B72 /* Visualized */ = { isa = PBXGroup; children = ( @@ -793,42 +734,6 @@ path = ElementPath; sourceTree = ""; }; - 4D41571C26048448009A9879 /* Gesture */ = { - isa = PBXGroup; - children = ( - 4D41571D26048448009A9879 /* Target */, - 4D41572026048448009A9879 /* Processor */, - 4D41572526048448009A9879 /* SAGestureManager.h */, - 4D41572626048448009A9879 /* SAGestureTargetActionModel.m */, - 4D41572726048448009A9879 /* UIGestureRecognizer+SAAutoTrack.m */, - 4D41572826048448009A9879 /* SAGestureTargetActionModel.h */, - 4D41572926048448009A9879 /* SAGestureManager.m */, - 4D41572A26048448009A9879 /* UIGestureRecognizer+SAAutoTrack.h */, - ); - name = Gesture; - path = SensorsAnalyticsSDK/Gesture; - sourceTree = SOURCE_ROOT; - }; - 4D41571D26048448009A9879 /* Target */ = { - isa = PBXGroup; - children = ( - 4D41571E26048448009A9879 /* SAGestureTarget.h */, - 4D41571F26048448009A9879 /* SAGestureTarget.m */, - ); - path = Target; - sourceTree = ""; - }; - 4D41572026048448009A9879 /* Processor */ = { - isa = PBXGroup; - children = ( - 4D41572126048448009A9879 /* SAGestureViewProcessorFactory.m */, - 4D41572226048448009A9879 /* SAGeneralGestureViewProcessor.h */, - 4D41572326048448009A9879 /* SAGestureViewProcessorFactory.h */, - 4D41572426048448009A9879 /* SAGeneralGestureViewProcessor.m */, - ); - path = Processor; - sourceTree = ""; - }; 4D6A188D22978F5B00F6B218 /* AutoTrack */ = { isa = PBXGroup; children = ( @@ -950,7 +855,6 @@ 881A40D2253D7B4F00854F69 /* Core */ = { isa = PBXGroup; children = ( - 45A56575263C176700C9C41B /* AutoTrack */, 45A56547263C174300C9C41B /* Builder */, FCD838572646A40900559F5E /* Encrypt */, 881A414E253D7B4F00854F69 /* Channel */, @@ -1124,6 +1028,126 @@ path = DebugMode; sourceTree = ""; }; + A8356D872656459A00FD64AA /* AutoTrack */ = { + isa = PBXGroup; + children = ( + A8356D8F2656459A00FD64AA /* SensorsAnalyticsSDK+SAAutoTrack.h */, + A8356DB12656459A00FD64AA /* SensorsAnalyticsSDK+SAAutoTrack.m */, + A8356D902656459A00FD64AA /* SAAutoTrackProperty.h */, + A8356D982656459A00FD64AA /* SAAutoTrackManager.h */, + A8356D882656459A00FD64AA /* SAAutoTrackManager.m */, + A8356D892656459A00FD64AA /* SAAutoTrackUtils.h */, + A8356DB02656459A00FD64AA /* SAAutoTrackUtils.m */, + A8356D922656459A00FD64AA /* SAAppTracker.h */, + A8356DB72656459A00FD64AA /* SAAppTracker.m */, + A8356DA82656459A00FD64AA /* AppClick */, + A8356D8C2656459A00FD64AA /* AppEnd */, + A8356DAB2656459A00FD64AA /* AppStart */, + A8356DB82656459A00FD64AA /* AppViewScreen */, + A8356DB22656459A00FD64AA /* ElementInfo */, + ); + path = AutoTrack; + sourceTree = ""; + }; + A8356D8C2656459A00FD64AA /* AppEnd */ = { + isa = PBXGroup; + children = ( + A8356D8E2656459A00FD64AA /* SAAppEndTracker.h */, + A8356D8D2656459A00FD64AA /* SAAppEndTracker.m */, + ); + path = AppEnd; + sourceTree = ""; + }; + A8356D932656459A00FD64AA /* Cell */ = { + isa = PBXGroup; + children = ( + A8356D962656459A00FD64AA /* SAScrollViewDelegateProxy.h */, + A8356D942656459A00FD64AA /* SAScrollViewDelegateProxy.m */, + A8356D952656459A00FD64AA /* UIScrollView+AutoTrack.h */, + A8356D972656459A00FD64AA /* UIScrollView+AutoTrack.m */, + ); + path = Cell; + sourceTree = ""; + }; + A8356D992656459A00FD64AA /* Gesture */ = { + isa = PBXGroup; + children = ( + A8356D9D2656459A00FD64AA /* Processor */, + A8356D9A2656459A00FD64AA /* Target */, + A8356DA52656459A00FD64AA /* SAGestureTargetActionModel.h */, + A8356DA32656459A00FD64AA /* SAGestureTargetActionModel.m */, + A8356DA72656459A00FD64AA /* UIGestureRecognizer+SAAutoTrack.h */, + A8356DA42656459A00FD64AA /* UIGestureRecognizer+SAAutoTrack.m */, + ); + path = Gesture; + sourceTree = ""; + }; + A8356D9A2656459A00FD64AA /* Target */ = { + isa = PBXGroup; + children = ( + A8356D9B2656459A00FD64AA /* SAGestureTarget.h */, + A8356D9C2656459A00FD64AA /* SAGestureTarget.m */, + ); + path = Target; + sourceTree = ""; + }; + A8356D9D2656459A00FD64AA /* Processor */ = { + isa = PBXGroup; + children = ( + A8356D9F2656459A00FD64AA /* SAGeneralGestureViewProcessor.h */, + A8356DA12656459A00FD64AA /* SAGeneralGestureViewProcessor.m */, + A8356DA02656459A00FD64AA /* SAGestureViewProcessorFactory.h */, + A8356D9E2656459A00FD64AA /* SAGestureViewProcessorFactory.m */, + ); + path = Processor; + sourceTree = ""; + }; + A8356DA82656459A00FD64AA /* AppClick */ = { + isa = PBXGroup; + children = ( + A8356D992656459A00FD64AA /* Gesture */, + A8356D932656459A00FD64AA /* Cell */, + A8356DBB2656459A00FD64AA /* UIApplication+AutoTrack.h */, + A8356D912656459A00FD64AA /* UIApplication+AutoTrack.m */, + A8356D8A2656459A00FD64AA /* UIView+AutoTrack.h */, + A8356DAF2656459A00FD64AA /* UIView+AutoTrack.m */, + A8356DAA2656459A00FD64AA /* SAAppClickTracker.h */, + A8356DA92656459A00FD64AA /* SAAppClickTracker.m */, + ); + path = AppClick; + sourceTree = ""; + }; + A8356DAB2656459A00FD64AA /* AppStart */ = { + isa = PBXGroup; + children = ( + A8356DAC2656459A00FD64AA /* SAAppStartTracker.h */, + A8356DAD2656459A00FD64AA /* SAAppStartTracker.m */, + ); + path = AppStart; + sourceTree = ""; + }; + A8356DB22656459A00FD64AA /* ElementInfo */ = { + isa = PBXGroup; + children = ( + A8356DB52656459A00FD64AA /* SAViewElementInfo.h */, + A8356DB42656459A00FD64AA /* SAViewElementInfo.m */, + A8356DB32656459A00FD64AA /* SAViewElementInfoFactory.h */, + A8356DB62656459A00FD64AA /* SAViewElementInfoFactory.m */, + ); + path = ElementInfo; + sourceTree = ""; + }; + A8356DB82656459A00FD64AA /* AppViewScreen */ = { + isa = PBXGroup; + children = ( + A8356DAE2656459A00FD64AA /* UIViewController+AutoTrack.h */, + A8356D8B2656459A00FD64AA /* UIViewController+AutoTrack.m */, + A8356DB92656459A00FD64AA /* SAAppViewScreenTracker.h */, + A8356DBA2656459A00FD64AA /* SAAppViewScreenTracker.m */, + ); + path = AppViewScreen; + sourceTree = ""; + }; CB30BD4A22840CA40004061D = { isa = PBXGroup; children = ( @@ -1149,11 +1173,11 @@ CB30BFD122840EBF0004061D /* SensorsAnalyticsSDK */ = { isa = PBXGroup; children = ( + A8356D872656459A00FD64AA /* AutoTrack */, F277F5B025CF9A43009B5CE6 /* AppPush */, 881A40D2253D7B4F00854F69 /* Core */, 881A4224253D7B5E00854F69 /* Location */, 4D9B536426382F0000318B1D /* DeviceOrientation */, - 4D41571C26048448009A9879 /* Gesture */, 4D0571A525A2FC46007F7B72 /* Visualized */, CB30C0AB22840F1B0004061D /* Resources */, ); @@ -1275,61 +1299,61 @@ buildActionMask = 2147483647; files = ( 4DD1285525F872A4008C0B1E /* SAObjectIdentityProvider.h in Headers */, + A8356DD62656459A00FD64AA /* UIGestureRecognizer+SAAutoTrack.h in Headers */, 4DD1285F25F872A4008C0B1E /* SAVisualizedSnapshotMessage.h in Headers */, 4D4DB2C825B7D19C00938842 /* SADelegateProxy.h in Headers */, 4D2D53A12591EB2100805141 /* SAEventFlush.h in Headers */, FCD8386D2646A40900559F5E /* SAECCPluginEncryptor.h in Headers */, - 4D41573426048449009A9879 /* SAGestureTargetActionModel.h in Headers */, 881A41A9253D7B4F00854F69 /* WKWebView+SABridge.h in Headers */, 4DD128C625F8A003008C0B1E /* SAVisualPropertiesConfigSources.h in Headers */, - 45A565A3263C176700C9C41B /* SAAppStartTracker.h in Headers */, 881A4227253D7B5E00854F69 /* SALocationManager.h in Headers */, 881A41F7253D7B5000854F69 /* SASecurityPolicy.h in Headers */, FC002920262C189E00A18FE3 /* SAConfigOptions+Private.h in Headers */, 881A41AC253D7B4F00854F69 /* SAScriptMessageHandler.h in Headers */, 881A41FB253D7B5000854F69 /* SensorsAnalyticsExceptionHandler.h in Headers */, 45A565BC263C17E400C9C41B /* SAReferrerManager.h in Headers */, - 45A5659C263C176700C9C41B /* SAAutoTrackProperty.h in Headers */, - 4D41572B26048448009A9879 /* SAGestureTarget.h in Headers */, A8A87E4C2568EBD500E16895 /* SARemoteConfigCheckOperator.h in Headers */, 4D57261E26206D5300B2AC9F /* SAVisualizedLogger.h in Headers */, 881A420F253D7B5000854F69 /* SAAlertController.h in Headers */, F277F5C025CF9A43009B5CE6 /* SAUNUserNotificationCenterDelegateProxy.h in Headers */, FCD838712646A40900559F5E /* SARSAPluginEncryptor.h in Headers */, + A8356DC32656459A00FD64AA /* SAAutoTrackProperty.h in Headers */, 4D2D53C22591EB3A00805141 /* SAReadWriteLock.h in Headers */, + A8356DBD2656459A00FD64AA /* SAAutoTrackUtils.h in Headers */, 881A4201253D7B5000854F69 /* SAAppExtensionDataManager.h in Headers */, 45A56561263C174300C9C41B /* SAIdentifier.h in Headers */, + A8356DCA2656459A00FD64AA /* SAAutoTrackManager.h in Headers */, 884B423F25540DEE00416DB6 /* SensorsAnalyticsSDK+Public.h in Headers */, + A8356DD42656459A00FD64AA /* SAGestureTargetActionModel.h in Headers */, F277F5C725CF9A43009B5CE6 /* SAApplicationDelegateProxy.h in Headers */, + A8356DC72656459A00FD64AA /* UIScrollView+AutoTrack.h in Headers */, 881A41F1253D7B5000854F69 /* SensorsAnalyticsSDK.h in Headers */, 4D14F13F25FC5BF200113EA2 /* SAVisualizedUtils.h in Headers */, 45A565BF263C17E400C9C41B /* SAAppLifecycle.h in Headers */, FCD838722646A40900559F5E /* SASecretKeyFactory.h in Headers */, - F277F5D525CFBF38009B5CE6 /* SAScrollViewDelegateProxy.h in Headers */, - 4D41572F26048448009A9879 /* SAGestureViewProcessorFactory.h in Headers */, F277F5C525CF9A43009B5CE6 /* SAAppPushConstants.h in Headers */, 4DA89BC325C2BC1E003ABA43 /* SANetwork.h in Headers */, - 45A5659F263C176700C9C41B /* UIScrollView+AutoTrack.h in Headers */, 881A41A2253D7B4F00854F69 /* SAModuleManager.h in Headers */, 888D7A0D2567B3C30052FCF7 /* SADebugModeManager.h in Headers */, 881A41F6253D7B5000854F69 /* NSString+HashCode.h in Headers */, 4DD1286725F872A4008C0B1E /* NSInvocation+SAHelpers.h in Headers */, - 4D41573126048448009A9879 /* SAGestureManager.h in Headers */, 45A5656E263C174300C9C41B /* SASuperProperty.h in Headers */, 45A5656A263C174300C9C41B /* SAEventLibObject.h in Headers */, + A8356DDF2656459A00FD64AA /* SAViewElementInfoFactory.h in Headers */, + A8356DE42656459A00FD64AA /* SAAppViewScreenTracker.h in Headers */, 881A41F2253D7B5000854F69 /* SAModuleProtocol.h in Headers */, - 45A565AD263C176700C9C41B /* UIApplication+AutoTrack.h in Headers */, 4DD1285725F872A4008C0B1E /* SAVisualizedManager.h in Headers */, + A8356DD82656459A00FD64AA /* SAAppClickTracker.h in Headers */, 4D4DB2C725B7D19C00938842 /* SAClassHelper.h in Headers */, 4DA89BC225C2BC1E003ABA43 /* SAReachability.h in Headers */, - 45A56596263C176700C9C41B /* UIView+AutoTrack.h in Headers */, - 45A5659B263C176700C9C41B /* SensorsAnalyticsSDK+SAAutoTrack.h in Headers */, FCD838742646A40900559F5E /* SAEncryptManager.h in Headers */, A8A87E542568EBD500E16895 /* SARemoteConfigManager.h in Headers */, 4DD1285125F872A4008C0B1E /* SAApplicationStateSerializer.h in Headers */, + A8356DC12656459A00FD64AA /* SAAppEndTracker.h in Headers */, 4DD1284B25F872A4008C0B1E /* SAJSTouchEventView.h in Headers */, F277F5C925CF9A43009B5CE6 /* SANotificationUtil.h in Headers */, 881A41A0253D7B4F00854F69 /* SensorsAnalyticsSDK+Private.h in Headers */, + A8356DC22656459A00FD64AA /* SensorsAnalyticsSDK+SAAutoTrack.h in Headers */, F277F5C825CF9A43009B5CE6 /* UNUserNotificationCenter+PushClick.h in Headers */, A8A87E532568EBD500E16895 /* SARemoteConfigCommonOperator.h in Headers */, 4DD1282125F87225008C0B1E /* SAVisualizedViewPathProperty.h in Headers */, @@ -1345,61 +1369,61 @@ 881A41FF253D7B5000854F69 /* SATrackTimer.h in Headers */, FCD838752646A40900559F5E /* SAAlgorithmProtocol.h in Headers */, 4DD1284E25F872A4008C0B1E /* SATypeDescription.h in Headers */, + A8356DE62656459A00FD64AA /* UIApplication+AutoTrack.h in Headers */, FCD838762646A40900559F5E /* SARSAEncryptor.h in Headers */, 4D4DB2CB25B7D19C00938842 /* SAMethodHelper.h in Headers */, - 45A5659A263C176700C9C41B /* SAAppEndTracker.h in Headers */, - 45A56595263C176700C9C41B /* SAAutoTrackUtils.h in Headers */, - 4D41572E26048448009A9879 /* SAGeneralGestureViewProcessor.h in Headers */, 4DD1286825F872A4008C0B1E /* SAObjectSerializerContext.h in Headers */, - 4D41573626048449009A9879 /* UIGestureRecognizer+SAAutoTrack.h in Headers */, 4DD1296A25F8E451008C0B1E /* SAViewNode.h in Headers */, + A8356DC52656459A00FD64AA /* SAAppTracker.h in Headers */, 881A41FF253D7B5000854F69 /* SATrackTimer.h in Headers */, 4DD1285925F872A4008C0B1E /* SAEnumDescription.h in Headers */, 4DD1285D25F872A4008C0B1E /* SAVisualizedConnection.h in Headers */, + A8356DCF2656459A00FD64AA /* SAGestureViewProcessorFactory.h in Headers */, A8A87E502568EBD500E16895 /* SARemoteConfigModel.h in Headers */, FCD8386C2646A40900559F5E /* SAEncryptProtocol.h in Headers */, 881A41A8253D7B4F00854F69 /* SAFileStore.h in Headers */, A8A87E552568EBD500E16895 /* SARemoteConfigOperator.h in Headers */, - 45A565A2263C176700C9C41B /* SAAutoTrackManager.h in Headers */, - 45A565A5263C176700C9C41B /* UIViewController+AutoTrack.h in Headers */, 45A56567263C174300C9C41B /* SABaseEventObject.h in Headers */, 4DD1286225F872A4008C0B1E /* SAVisualizedMessage.h in Headers */, + A8356DD92656459A00FD64AA /* SAAppStartTracker.h in Headers */, 4DD1286E25F872A4008C0B1E /* SAValueTransformers.h in Headers */, 45A56569263C174300C9C41B /* SAProfileEventObject.h in Headers */, 4D14F16C25FC646A00113EA2 /* SAViewNodeTree.h in Headers */, + A8356DE12656459A00FD64AA /* SAViewElementInfo.h in Headers */, 881A4196253D7B4F00854F69 /* SAConstants.h in Headers */, 4DD1286425F872A4008C0B1E /* SAVisualizedAutoTrackObjectSerializer.h in Headers */, 881A419C253D7B4F00854F69 /* SAConstants+Private.h in Headers */, - 45A565AB263C176700C9C41B /* SAViewElementInfo.h in Headers */, 881A419F253D7B4F00854F69 /* SAHTTPSession.h in Headers */, F2E9723125E637820009A2B9 /* SAAppPushManager.h in Headers */, F277F5E425CFCE56009B5CE6 /* NSObject+DelegateProxy.h in Headers */, 881A41F4253D7B5000854F69 /* SAChannelMatchManager.h in Headers */, 881A4191253D7B4F00854F69 /* SADeeplinkManager.h in Headers */, F277F5C325CF9A43009B5CE6 /* UIApplication+PushClick.h in Headers */, - 45A565A9263C176700C9C41B /* SAViewElementInfoFactory.h in Headers */, 4DD128B925F8A003008C0B1E /* SensorsAnalyticsSDK+Visualized.h in Headers */, + A8356DCE2656459A00FD64AA /* SAGeneralGestureViewProcessor.h in Headers */, 4DD1286525F872A4008C0B1E /* SAObjectSerializerConfig.h in Headers */, 4DD1286C25F872A4008C0B1E /* SAClassDescription.h in Headers */, + A8356DC82656459A00FD64AA /* SAScrollViewDelegateProxy.h in Headers */, + A8356DBE2656459A00FD64AA /* UIView+AutoTrack.h in Headers */, 4D41D9D325FF7E9300D856F4 /* UIViewController+SAElementPath.h in Headers */, 4DD1285325F872A4008C0B1E /* SAVisualizedAbstractMessage.h in Headers */, 4D2D53992591EB2100805141 /* SADatabase.h in Headers */, 45A5655F263C174300C9C41B /* SAPresetProperty.h in Headers */, 4DD1285825F872A4008C0B1E /* SAPropertyDescription.h in Headers */, 4DD128C825F8A003008C0B1E /* SAVisualPropertiesTracker.h in Headers */, + A8356DCB2656459A00FD64AA /* SAGestureTarget.h in Headers */, 881A4191253D7B4F00854F69 /* SADeeplinkManager.h in Headers */, 45A56560263C174300C9C41B /* SAIDFAHelper.h in Headers */, 4DD1281925F8721A008C0B1E /* UIView+SAElementSelector.h in Headers */, FCD8386B2646A40900559F5E /* SAAESEncryptor.h in Headers */, FCD8386E2646A40900559F5E /* SAECCEncryptor.h in Headers */, + A8356DDB2656459A00FD64AA /* UIViewController+AutoTrack.h in Headers */, 4D6AE7FC26086E9300A9CB08 /* SAVisualizedEventCheck.h in Headers */, 45A56563263C174300C9C41B /* SAPropertyValidator.h in Headers */, 881A4191253D7B4F00854F69 /* SADeeplinkManager.h in Headers */, 4D9B536726382F0100318B1D /* SADeviceOrientationManager.h in Headers */, 4DD1296B25F8E451008C0B1E /* SAViewNodeFactory.h in Headers */, 4DD1282025F87225008C0B1E /* UIView+SAElementPath.h in Headers */, - 45A565A0263C176700C9C41B /* SAScrollViewDelegateProxy.h in Headers */, - 45A56598263C176700C9C41B /* SAAppTrackerProtocol.h in Headers */, 881A419B253D7B4F00854F69 /* SAConfigOptions.h in Headers */, 4D6AE7EF26086ABE00A9CB08 /* SAVisualizedDebugLogTracker.h in Headers */, ); @@ -1551,35 +1575,36 @@ 4D4DB31B25B7D58C00938842 /* SAEventStore.m in Sources */, 4D4DB31725B7D58300938842 /* SADateFormatter.m in Sources */, 45A5655D263C174300C9C41B /* SAIdentifier.m in Sources */, - 45A565A6263C176700C9C41B /* UIView+AutoTrack.m in Sources */, 4D4DB31325B7D55400938842 /* SAEventTracker.m in Sources */, - 45A565A4263C176700C9C41B /* SAAppStartTracker.m in Sources */, 4D4DB30F25B7D54D00938842 /* SALog.m in Sources */, 45A5655C263C174300C9C41B /* SAIDFAHelper.m in Sources */, 4D4DB30B25B7D54600938842 /* SAValidator.m in Sources */, FCD838772646A40900559F5E /* SAECCEncryptor.m in Sources */, 4D4DB30725B7D52700938842 /* SAGzipUtility.m in Sources */, + A8356DE32656459A00FD64AA /* SAAppTracker.m in Sources */, 4DD1285625F872A4008C0B1E /* SAObjectIdentityProvider.m in Sources */, 4D4DB30325B7D52000938842 /* SAAbstractLogger.m in Sources */, 4DD128C725F8A003008C0B1E /* SAVisualPropertiesTracker.m in Sources */, 4D4DB2FF25B7D51600938842 /* SALoggerConsoleFormatter.m in Sources */, 4DD1296725F8E451008C0B1E /* SAViewNodeFactory.m in Sources */, - 4D41572D26048448009A9879 /* SAGestureViewProcessorFactory.m in Sources */, 4DD1284F25F872A4008C0B1E /* SAObjectSerializerContext.m in Sources */, 4DD1296D25F8E451008C0B1E /* SAViewNode.m in Sources */, 4D4DB2FB25B7D4D800938842 /* SAURLUtils.m in Sources */, 881A4228253D7B5E00854F69 /* SALocationManager.m in Sources */, + A8356DDD2656459A00FD64AA /* SAAutoTrackUtils.m in Sources */, 4D2D53BD2591EB3A00805141 /* SAReadWriteLock.m in Sources */, 4D2D539D2591EB2100805141 /* SAEventFlush.m in Sources */, 4D14F13E25FC5BF200113EA2 /* SAVisualizedUtils.m in Sources */, 45A5656C263C174300C9C41B /* SABaseEventObject.m in Sources */, 4D2D53A02591EB2100805141 /* SADatabase.m in Sources */, 4D4DB2CE25B7D19C00938842 /* SAClassHelper.m in Sources */, - 45A5659E263C176700C9C41B /* SAScrollViewDelegateProxy.m in Sources */, + A8356DC62656459A00FD64AA /* SAScrollViewDelegateProxy.m in Sources */, + A8356DE52656459A00FD64AA /* SAAppViewScreenTracker.m in Sources */, 881A4220253D7B5000854F69 /* SAFileStore.m in Sources */, F277F5C625CF9A43009B5CE6 /* SAUNUserNotificationCenterDelegateProxy.m in Sources */, F277F5C125CF9A43009B5CE6 /* SANotificationUtil.m in Sources */, 4DA89BC125C2BC1E003ABA43 /* SANetwork.m in Sources */, + A8356DDC2656459A00FD64AA /* UIView+AutoTrack.m in Sources */, FCD838732646A40900559F5E /* SAAESEncryptor.m in Sources */, 4DD128C425F8A003008C0B1E /* SAVisualPropertiesConfigSources.m in Sources */, FCD838782646A40900559F5E /* SAECCPluginEncryptor.m in Sources */, @@ -1587,10 +1612,10 @@ 4D2D53842591EB0600805141 /* SAFileLogger.m in Sources */, 4DD1296925F8E451008C0B1E /* UIView+SAVisualProperties.m in Sources */, 881A41E4253D7B5000854F69 /* SAKeyChainItemWrapper.m in Sources */, - 4D41573226048448009A9879 /* SAGestureTargetActionModel.m in Sources */, 4D41D9D425FF7E9300D856F4 /* UIViewController+SAElementPath.m in Sources */, 881A41AA253D7B4F00854F69 /* SAScriptMessageHandler.m in Sources */, 4DD1286F25F872A4008C0B1E /* SAVisualizedSnapshotMessage.m in Sources */, + A8356DD02656459A00FD64AA /* SAGeneralGestureViewProcessor.m in Sources */, 881A4194253D7B4F00854F69 /* SATrackTimer.m in Sources */, 888D7A0E2567B3C30052FCF7 /* SADebugModeManager.m in Sources */, 4D9B536826382F0100318B1D /* SADeviceOrientationManager.m in Sources */, @@ -1601,31 +1626,28 @@ FCD8386A2646A40900559F5E /* SAEncryptManager.m in Sources */, 4DD1284C25F872A4008C0B1E /* NSInvocation+SAHelpers.m in Sources */, 4D2D537B2591EB0600805141 /* SALogMessage.m in Sources */, + A8356DE22656459A00FD64AA /* SAViewElementInfoFactory.m in Sources */, 881A4181253D7B4F00854F69 /* NSString+HashCode.m in Sources */, 4DD1285B25F872A4008C0B1E /* SAValueTransformers.m in Sources */, - 45A565A8263C176700C9C41B /* SensorsAnalyticsSDK+SAAutoTrack.m in Sources */, 4DD1285025F872A4008C0B1E /* SAClassDescription.m in Sources */, + A8356DC02656459A00FD64AA /* SAAppEndTracker.m in Sources */, 4DD128B825F8A003008C0B1E /* SensorsAnalyticsSDK+Visualized.m in Sources */, 45A565BD263C17E400C9C41B /* SAReferrerManager.m in Sources */, - 45A56599263C176700C9C41B /* SAAppEndTracker.m in Sources */, 4D79695B2609D8FE001B0A6C /* SAEventIdentifier.m in Sources */, - 4D41573526048449009A9879 /* SAGestureManager.m in Sources */, - 45A565AA263C176700C9C41B /* SAViewElementInfo.m in Sources */, 881A41F3253D7B5000854F69 /* SADeeplinkManager.m in Sources */, + A8356DBF2656459A00FD64AA /* UIViewController+AutoTrack.m in Sources */, 45A5656B263C174300C9C41B /* SATrackEventObject.m in Sources */, - 45A56597263C176700C9C41B /* UIViewController+AutoTrack.m in Sources */, + A8356DC42656459A00FD64AA /* UIApplication+AutoTrack.m in Sources */, + A8356DD22656459A00FD64AA /* SAGestureTargetActionModel.m in Sources */, 881A41F3253D7B5000854F69 /* SADeeplinkManager.m in Sources */, - 45A5659D263C176700C9C41B /* UIApplication+AutoTrack.m in Sources */, + A8356DBC2656459A00FD64AA /* SAAutoTrackManager.m in Sources */, 45A56565263C174300C9C41B /* SAEventLibObject.m in Sources */, - 45A565A7263C176700C9C41B /* SAAutoTrackUtils.m in Sources */, - 45A56594263C176700C9C41B /* SAAutoTrackManager.m in Sources */, 45A565BE263C17E400C9C41B /* SAAppLifecycle.m in Sources */, A8A87E522568EBD500E16895 /* SARemoteConfigCommonOperator.m in Sources */, 4D6AE7EE26086ABE00A9CB08 /* SAVisualizedDebugLogTracker.m in Sources */, 45A56568263C174300C9C41B /* SAPropertyValidator.m in Sources */, 881A41FE253D7B5000854F69 /* SAConstants.m in Sources */, F277F5CA25CF9A43009B5CE6 /* UIApplication+PushClick.m in Sources */, - 45A565AC263C176700C9C41B /* SAViewElementInfoFactory.m in Sources */, 881A4195253D7B4F00854F69 /* SAObject+SAConfigOptions.m in Sources */, 881A41F9253D7B5000854F69 /* SAConfigOptions.m in Sources */, 4DD1286925F872A4008C0B1E /* SATypeDescription.m in Sources */, @@ -1637,46 +1659,50 @@ 881A41AB253D7B4F00854F69 /* WKWebView+SABridge.m in Sources */, FCD838692646A40900559F5E /* SASecretKeyFactory.m in Sources */, 4D2D537A2591EB0600805141 /* SAConsoleLogger.m in Sources */, + A8356DCD2656459A00FD64AA /* SAGestureViewProcessorFactory.m in Sources */, 881A419D253D7B4F00854F69 /* SAAlertController.m in Sources */, 4DD1286125F872A4008C0B1E /* SAPropertyDescription.m in Sources */, 4DA89BC425C2BC1E003ABA43 /* SAReachability.m in Sources */, A8A87E512568EBD500E16895 /* SARemoteConfigModel.m in Sources */, F277F5CB25CF9A43009B5CE6 /* SAAppPushConstants.m in Sources */, A8A87E4E2568EBD500E16895 /* SARemoteConfigCheckOperator.m in Sources */, - 4D41573026048448009A9879 /* SAGeneralGestureViewProcessor.m in Sources */, 4DD1286325F872A4008C0B1E /* SAVisualizedAutoTrackObjectSerializer.m in Sources */, 881A4193253D7B4F00854F69 /* SensorsAnalyticsSDK.m in Sources */, 4D2D53C62591EB3A00805141 /* SACommonUtility.m in Sources */, 4D2D53A22591EB2100805141 /* SAEventRecord.m in Sources */, 4D57261F26206D5300B2AC9F /* SAVisualizedLogger.m in Sources */, 4D2D53BB2591EB3A00805141 /* SAWeakPropertyContainer.m in Sources */, + A8356DD72656459A00FD64AA /* SAAppClickTracker.m in Sources */, FCD838792646A40900559F5E /* SARSAPluginEncryptor.m in Sources */, 881A4202253D7B5000854F69 /* SAModuleManager.m in Sources */, F2E9723225E637820009A2B9 /* SAAppPushManager.m in Sources */, 881A41FC253D7B5000854F69 /* SASwizzle.m in Sources */, 881A4207253D7B5000854F69 /* SAHTTPSession.m in Sources */, - 4D41572C26048448009A9879 /* SAGestureTarget.m in Sources */, F277F5C225CF9A43009B5CE6 /* UNUserNotificationCenter+PushClick.m in Sources */, A8A87E4D2568EBD500E16895 /* SARemoteConfigManager.m in Sources */, 4DD1285C25F872A4008C0B1E /* SAObjectSerializerConfig.m in Sources */, 45A5656D263C174300C9C41B /* SAPresetProperty.m in Sources */, 4DD1285E25F872A4008C0B1E /* SAVisualizedObjectSerializerManger.m in Sources */, 45A5655E263C174300C9C41B /* SASuperProperty.m in Sources */, - 4D41573326048449009A9879 /* UIGestureRecognizer+SAAutoTrack.m in Sources */, 4DD1286D25F872A4008C0B1E /* SAVisualizedManager.m in Sources */, 4DD1286A25F872A4008C0B1E /* SAJSTouchEventView.m in Sources */, F277F5BF25CF9A43009B5CE6 /* SAApplicationDelegateProxy.m in Sources */, 881A41A1253D7B4F00854F69 /* SAAppExtensionDataManager.m in Sources */, + A8356DDA2656459A00FD64AA /* SAAppStartTracker.m in Sources */, 4D4DB2CD25B7D19C00938842 /* SAMethodHelper.m in Sources */, 4DD1286625F872A4008C0B1E /* SAVisualizedAbstractMessage.m in Sources */, 4DD1282225F87225008C0B1E /* UIView+SAElementPath.m in Sources */, FCD838702646A40900559F5E /* SAAlgorithmProtocol.m in Sources */, A8A87E4F2568EBD500E16895 /* SARemoteConfigOperator.m in Sources */, 881A4198253D7B4F00854F69 /* SensorsAnalyticsExceptionHandler.m in Sources */, + A8356DE02656459A00FD64AA /* SAViewElementInfo.m in Sources */, 4DD1281825F8721A008C0B1E /* UIView+SAElementSelector.m in Sources */, - 45A565A1263C176700C9C41B /* UIScrollView+AutoTrack.m in Sources */, + A8356DD32656459A00FD64AA /* UIGestureRecognizer+SAAutoTrack.m in Sources */, + A8356DC92656459A00FD64AA /* UIScrollView+AutoTrack.m in Sources */, 45A56566263C174300C9C41B /* SAProfileEventObject.m in Sources */, + A8356DDE2656459A00FD64AA /* SensorsAnalyticsSDK+SAAutoTrack.m in Sources */, 881A41F5253D7B5000854F69 /* SAChannelMatchManager.m in Sources */, + A8356DCC2656459A00FD64AA /* SAGestureTarget.m in Sources */, 4D6AE7FD26086E9300A9CB08 /* SAVisualizedEventCheck.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.h b/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.h index c161e0ef..89ab306a 100644 --- a/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.h +++ b/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.h @@ -1,5 +1,5 @@ // -// UIApplication+AutoTrack.h +// UIApplication+PushClick.h // SensorsAnalyticsSDK // // Created by 陈玉国 on 2021/1/7. diff --git a/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.m b/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.m index 83b03a26..c4ee503d 100644 --- a/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.m +++ b/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.m @@ -1,5 +1,5 @@ // -// UIApplication+AutoTrack.m +// UIApplication+PushClick.m // SensorsAnalyticsSDK // // Created by 陈玉国 on 2021/1/7. @@ -22,7 +22,7 @@ #error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. #endif -#import "UIApplication+AutoTrack.h" +#import "UIApplication+PushClick.h" #import "SAApplicationDelegateProxy.h" #import diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.h b/SensorsAnalyticsSDK/AutoTrack/AppClick/Cell/SAScrollViewDelegateProxy.h similarity index 100% rename from SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.h rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Cell/SAScrollViewDelegateProxy.h diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.m b/SensorsAnalyticsSDK/AutoTrack/AppClick/Cell/SAScrollViewDelegateProxy.m similarity index 62% rename from SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.m rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Cell/SAScrollViewDelegateProxy.m index 17b6c3b6..8aaf2daf 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.m +++ b/SensorsAnalyticsSDK/AutoTrack/AppClick/Cell/SAScrollViewDelegateProxy.m @@ -26,7 +26,7 @@ #import "SAAutoTrackUtils.h" #import "SensorsAnalyticsSDK+Private.h" #import "SAConstants+Private.h" -#import "SAModuleManager.h" +#import "SAAutoTrackManager.h" #import @implementation SAScrollViewDelegateProxy @@ -48,30 +48,8 @@ + (void)trackEventWithTarget:(NSObject *)target scrollView:(UIScrollView *)scrol if (target != scrollView.delegate) { return; } - - NSMutableDictionary *properties = [SAAutoTrackUtils propertiesWithAutoTrackObject:(UIScrollView *)scrollView didSelectedAtIndexPath:indexPath]; - if (!properties) { - return; - } - NSDictionary *dic = [SAAutoTrackUtils propertiesWithAutoTrackDelegate:scrollView didSelectedAtIndexPath:indexPath]; - [properties addEntriesFromDictionary:dic]; - - // 解析 Cell - UIView *cell = [SAAutoTrackUtils cellWithScrollView:scrollView selectedAtIndexPath:indexPath]; - if (!cell) { - SAAutoTrackEventObject *object = [[SAAutoTrackEventObject alloc] initWithEventId:kSAEventNameAppClick]; - [SensorsAnalyticsSDK.sharedInstance asyncTrackEventObject:object properties:properties]; - return; - } - // 获取自定义属性 - [SAModuleManager.sharedInstance visualPropertiesWithView:cell completionHandler:^(NSDictionary * _Nullable visualProperties) { - if (visualProperties) { - [properties addEntriesFromDictionary:visualProperties]; - } - SAAutoTrackEventObject *object = [[SAAutoTrackEventObject alloc] initWithEventId:kSAEventNameAppClick]; - [SensorsAnalyticsSDK.sharedInstance asyncTrackEventObject:object properties:properties]; - }]; + [SAAutoTrackManager.sharedInstance.appClickTracker autoTrackEventWithScrollView:scrollView atIndexPath:indexPath]; } @end diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/Cell/UIScrollView+AutoTrack.h b/SensorsAnalyticsSDK/AutoTrack/AppClick/Cell/UIScrollView+AutoTrack.h similarity index 100% rename from SensorsAnalyticsSDK/Core/AutoTrack/Cell/UIScrollView+AutoTrack.h rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Cell/UIScrollView+AutoTrack.h diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/Cell/UIScrollView+AutoTrack.m b/SensorsAnalyticsSDK/AutoTrack/AppClick/Cell/UIScrollView+AutoTrack.m similarity index 88% rename from SensorsAnalyticsSDK/Core/AutoTrack/Cell/UIScrollView+AutoTrack.m rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Cell/UIScrollView+AutoTrack.m index fc37ea41..ce8f04ca 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/Cell/UIScrollView+AutoTrack.m +++ b/SensorsAnalyticsSDK/AutoTrack/AppClick/Cell/UIScrollView+AutoTrack.m @@ -26,10 +26,8 @@ #import "SAScrollViewDelegateProxy.h" #import #import -#import "SensorsAnalyticsSDK.h" #import "SAConstants+Private.h" -#import "SensorsAnalyticsSDK+Private.h" - +#import "SAAutoTrackManager.h" @implementation UITableView (AutoTrack) @@ -44,7 +42,7 @@ - (void)sensorsdata_setDelegate:(id )delegate { } // 判断是否忽略 $AppClick 事件采集 - if ([[SensorsAnalyticsSDK sharedInstance] isAutoTrackEventTypeIgnored:SensorsAnalyticsEventTypeAppClick]) { + if ([SAAutoTrackManager.sharedInstance isAutoTrackEventTypeIgnored:SensorsAnalyticsEventTypeAppClick]) { return; } @@ -68,7 +66,7 @@ - (void)sensorsdata_setDelegate:(id )delegate { } // 判断是否忽略 $AppClick 事件采集 - if ([[SensorsAnalyticsSDK sharedInstance] isAutoTrackEventTypeIgnored:SensorsAnalyticsEventTypeAppClick]) { + if ([SAAutoTrackManager.sharedInstance isAutoTrackEventTypeIgnored:SensorsAnalyticsEventTypeAppClick]) { return; } diff --git a/SensorsAnalyticsSDK/Gesture/Processor/SAGeneralGestureViewProcessor.h b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Processor/SAGeneralGestureViewProcessor.h similarity index 100% rename from SensorsAnalyticsSDK/Gesture/Processor/SAGeneralGestureViewProcessor.h rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Processor/SAGeneralGestureViewProcessor.h diff --git a/SensorsAnalyticsSDK/Gesture/Processor/SAGeneralGestureViewProcessor.m b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Processor/SAGeneralGestureViewProcessor.m similarity index 100% rename from SensorsAnalyticsSDK/Gesture/Processor/SAGeneralGestureViewProcessor.m rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Processor/SAGeneralGestureViewProcessor.m diff --git a/SensorsAnalyticsSDK/Gesture/Processor/SAGestureViewProcessorFactory.h b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Processor/SAGestureViewProcessorFactory.h similarity index 100% rename from SensorsAnalyticsSDK/Gesture/Processor/SAGestureViewProcessorFactory.h rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Processor/SAGestureViewProcessorFactory.h diff --git a/SensorsAnalyticsSDK/Gesture/Processor/SAGestureViewProcessorFactory.m b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Processor/SAGestureViewProcessorFactory.m similarity index 100% rename from SensorsAnalyticsSDK/Gesture/Processor/SAGestureViewProcessorFactory.m rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Processor/SAGestureViewProcessorFactory.m diff --git a/SensorsAnalyticsSDK/Gesture/SAGestureTargetActionModel.h b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/SAGestureTargetActionModel.h similarity index 100% rename from SensorsAnalyticsSDK/Gesture/SAGestureTargetActionModel.h rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/SAGestureTargetActionModel.h diff --git a/SensorsAnalyticsSDK/Gesture/SAGestureTargetActionModel.m b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/SAGestureTargetActionModel.m similarity index 100% rename from SensorsAnalyticsSDK/Gesture/SAGestureTargetActionModel.m rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/SAGestureTargetActionModel.m diff --git a/SensorsAnalyticsSDK/Gesture/Target/SAGestureTarget.h b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Target/SAGestureTarget.h similarity index 97% rename from SensorsAnalyticsSDK/Gesture/Target/SAGestureTarget.h rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Target/SAGestureTarget.h index 021b3e2b..530ce9b6 100644 --- a/SensorsAnalyticsSDK/Gesture/Target/SAGestureTarget.h +++ b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Target/SAGestureTarget.h @@ -18,7 +18,7 @@ // limitations under the License. // -#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/SensorsAnalyticsSDK/Gesture/Target/SAGestureTarget.m b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Target/SAGestureTarget.m similarity index 73% rename from SensorsAnalyticsSDK/Gesture/Target/SAGestureTarget.m rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Target/SAGestureTarget.m index f10031f2..677c449a 100644 --- a/SensorsAnalyticsSDK/Gesture/Target/SAGestureTarget.m +++ b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/Target/SAGestureTarget.m @@ -28,7 +28,7 @@ #import "SAConstants+Private.h" #import "UIView+AutoTrack.h" #import "SAAutoTrackUtils.h" -#import "SAModuleManager.h" +#import "SAAutoTrackManager.h" @implementation SAGestureTarget @@ -51,18 +51,8 @@ - (void)trackGestureRecognizerAppClick:(UIGestureRecognizer *)gesture { if (!processor.isTrackable) { return; } - - NSMutableDictionary *properties = [[SAAutoTrackUtils propertiesWithAutoTrackObject:processor.trackableView] mutableCopy]; - if (properties.count == 0) { - return; - } - [SAModuleManager.sharedInstance visualPropertiesWithView:processor.trackableView completionHandler:^(NSDictionary * _Nullable visualProperties) { - if (visualProperties) { - [properties addEntriesFromDictionary:visualProperties]; - } - SAAutoTrackEventObject *eventObject = [[SAAutoTrackEventObject alloc] initWithEventId:kSAEventNameAppClick]; - [SensorsAnalyticsSDK.sharedInstance asyncTrackEventObject:eventObject properties:properties]; - }]; + + [SAAutoTrackManager.sharedInstance.appClickTracker autoTrackEventWithGestureView:processor.trackableView]; } @end diff --git a/SensorsAnalyticsSDK/Gesture/UIGestureRecognizer+SAAutoTrack.h b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/UIGestureRecognizer+SAAutoTrack.h similarity index 100% rename from SensorsAnalyticsSDK/Gesture/UIGestureRecognizer+SAAutoTrack.h rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/UIGestureRecognizer+SAAutoTrack.h diff --git a/SensorsAnalyticsSDK/Gesture/UIGestureRecognizer+SAAutoTrack.m b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/UIGestureRecognizer+SAAutoTrack.m similarity index 85% rename from SensorsAnalyticsSDK/Gesture/UIGestureRecognizer+SAAutoTrack.m rename to SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/UIGestureRecognizer+SAAutoTrack.m index 0a978e25..a8abb52c 100644 --- a/SensorsAnalyticsSDK/Gesture/UIGestureRecognizer+SAAutoTrack.m +++ b/SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/UIGestureRecognizer+SAAutoTrack.m @@ -35,14 +35,20 @@ @implementation UIGestureRecognizer (SAAutoTrack) #pragma mark - Hook Method - (instancetype)sensorsdata_initWithTarget:(id)target action:(SEL)action { [self sensorsdata_initWithTarget:target action:action]; - self.sensorsdata_gestureTarget = [SAGestureTarget targetWithGesture:self]; - self.sensorsdata_targetActionModels = [NSMutableArray array]; [self removeTarget:target action:action]; [self addTarget:target action:action]; return self; } - (void)sensorsdata_addTarget:(id)target action:(SEL)action { + // 在 iOS 12 及以下系统中, 从 StoryBoard 加载的手势不会调用 - initWithTarget:action: 方法; + // 1. 在 - addTarget:action 时对 sensorsdata_gestureTarget 和 sensorsdata_targetActionModels 进行初始化 + // 2. sensorsdata_gestureTarget 可能会初始化为空值, 因此使用 sensorsdata_targetActionModels 判断是否初始化过. + if (!self.sensorsdata_targetActionModels) { + self.sensorsdata_targetActionModels = [NSMutableArray array]; + self.sensorsdata_gestureTarget = [SAGestureTarget targetWithGesture:self]; + } + // Track 事件需要在原有事件之前触发(原有事件中更改页面内容,会导致部分内容获取不准确) if (self.sensorsdata_gestureTarget) { if (![SAGestureTargetActionModel containsObjectWithTarget:target andAction:action fromModels:self.sensorsdata_targetActionModels]) { diff --git a/SensorsAnalyticsSDK/AutoTrack/AppClick/SAAppClickTracker.h b/SensorsAnalyticsSDK/AutoTrack/AppClick/SAAppClickTracker.h new file mode 100644 index 00000000..818abcfc --- /dev/null +++ b/SensorsAnalyticsSDK/AutoTrack/AppClick/SAAppClickTracker.h @@ -0,0 +1,60 @@ +// +// SAAppClickTracker.h +// SensorsAnalyticsSDK +// +// Created by 张敏超🍎 on 2021/4/27. +// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import +#import "SAAppTracker.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SAAppClickTracker : SAAppTracker + +/// 触发 UIApplication 全埋点点击事件 +/// @param view UIView +- (void)autoTrackEventWithView:(UIView *)view; + +/// 触发 Cell 全埋点点击事件 +/// @param scrollView cell 所在的视图 +/// @param indexPath cell 位置 +- (void)autoTrackEventWithScrollView:(UIScrollView *)scrollView atIndexPath:(NSIndexPath *)indexPath; + +/// 触发 Gesture 全埋点点击事件 +/// @param view UIView +- (void)autoTrackEventWithGestureView:(UIView *)view; + +/// 通过代码触发 UIView 的 $AppClick 事件 +/// @param view UIView +/// @param properties 自定义属性 +- (void)trackEventWithView:(UIView *)view properties:(NSDictionary * _Nullable)properties; + +/// 忽略某一类型的 View +/// @param aClass View 对应的 Class +- (void)ignoreViewType:(Class)aClass; + +/// 判断某个 View 类型是否被忽略 +/// @param aClass Class View 对应的 Class +- (BOOL)isViewTypeIgnored:(Class)aClass; + +/// 是否忽略视图的点击事件 +/// @param view UIView +- (BOOL)isIgnoreEventWithView:(UIView *)view; + +@end + +NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/AutoTrack/AppClick/SAAppClickTracker.m b/SensorsAnalyticsSDK/AutoTrack/AppClick/SAAppClickTracker.m new file mode 100644 index 00000000..b19d18cd --- /dev/null +++ b/SensorsAnalyticsSDK/AutoTrack/AppClick/SAAppClickTracker.m @@ -0,0 +1,178 @@ +// +// SAAppClickTracker.m +// SensorsAnalyticsSDK +// +// Created by 张敏超🍎 on 2021/4/27. +// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#if ! __has_feature(objc_arc) +#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. +#endif + +#import "SAAppClickTracker.h" +#import "SensorsAnalyticsSDK+Private.h" +#import "SAConstants+Private.h" +#import "SAAutoTrackProperty.h" +#import "SAConstants.h" +#import "SAValidator.h" +#import "SAAutoTrackUtils.h" +#import "UIView+AutoTrack.h" +#import "UIViewController+AutoTrack.h" +#import "SALog.h" +#import "SAModuleManager.h" + +@interface SAAppClickTracker () + +@property (nonatomic, strong) NSMutableSet *ignoredViewTypeList; + +@end + +@implementation SAAppClickTracker + +#pragma mark - Life Cycle + +- (instancetype)init { + self = [super init]; + if (self) { + _ignoredViewTypeList = [NSMutableSet set]; + } + return self; +} + +#pragma mark - Override + +- (NSString *)eventId { + return kSAEventNameAppClick; +} + +- (BOOL)shouldTrackViewController:(UIViewController *)viewController { + if ([self isViewControllerIgnored:viewController]) { + return NO; + } + + return ![self isBlackListContainsViewController:viewController]; +} + +#pragma mark - Public Methods + +- (void)autoTrackEventWithView:(UIView *)view { + // 判断时间间隔 + if (![SAAutoTrackUtils isValidAppClickForObject:view]) { + return; + } + + NSMutableDictionary *properties = [SAAutoTrackUtils propertiesWithAutoTrackObject:view viewController:nil]; + if (!properties) { + return; + } + + // 保存当前触发时间 + view.sensorsdata_timeIntervalForLastAppClick = [[NSProcessInfo processInfo] systemUptime]; + + [self autoTrackEventWithView:view properties:properties]; +} + +- (void)autoTrackEventWithScrollView:(UIScrollView *)scrollView atIndexPath:(NSIndexPath *)indexPath { + NSMutableDictionary *properties = [SAAutoTrackUtils propertiesWithAutoTrackObject:(UIScrollView *)scrollView didSelectedAtIndexPath:indexPath]; + if (!properties) { + return; + } + NSDictionary *dic = [SAAutoTrackUtils propertiesWithAutoTrackDelegate:scrollView didSelectedAtIndexPath:indexPath]; + [properties addEntriesFromDictionary:dic]; + + // 解析 Cell + UIView *cell = [SAAutoTrackUtils cellWithScrollView:scrollView selectedAtIndexPath:indexPath]; + if (!cell) { + return; + } + + [self autoTrackEventWithView:cell properties:properties]; +} + +- (void)autoTrackEventWithGestureView:(UIView *)view { + NSMutableDictionary *properties = [[SAAutoTrackUtils propertiesWithAutoTrackObject:view] mutableCopy]; + if (properties.count == 0) { + return; + } + + [self autoTrackEventWithView:view properties:properties]; +} + +- (void)trackEventWithView:(UIView *)view properties:(NSDictionary *)properties { + @try { + if (view == nil) { + return; + } + NSMutableDictionary *eventProperties = [[NSMutableDictionary alloc]init]; + [eventProperties addEntriesFromDictionary:[SAAutoTrackUtils propertiesWithAutoTrackObject:view isCodeTrack:YES]]; + if ([SAValidator isValidDictionary:properties]) { + [eventProperties addEntriesFromDictionary:properties]; + } + + // 添加自定义属性 + [SAModuleManager.sharedInstance visualPropertiesWithView:view completionHandler:^(NSDictionary * _Nullable visualProperties) { + if (visualProperties) { + [eventProperties addEntriesFromDictionary:visualProperties]; + } + + [self trackPresetEventWithProperties:eventProperties]; + }]; + } @catch (NSException *exception) { + SALogError(@"%@: %@", self, exception); + } +} + +- (void)ignoreViewType:(Class)aClass { + [_ignoredViewTypeList addObject:aClass]; +} + +- (BOOL)isViewTypeIgnored:(Class)aClass { + for (Class obj in _ignoredViewTypeList) { + if ([aClass isSubclassOfClass:obj]) { + return YES; + } + } + return NO; +} + +- (BOOL)isIgnoreEventWithView:(UIView *)view { + return self.isIgnored || [self isViewTypeIgnored:[view class]]; +} + +#pragma mark – Private Methods + +- (BOOL)isBlackListContainsViewController:(UIViewController *)viewController { + NSDictionary *autoTrackBlackList = [self autoTrackViewControllerBlackList]; + NSDictionary *appClickBlackList = autoTrackBlackList[kSAEventNameAppClick]; + return [self isViewController:viewController inBlackList:appClickBlackList]; +} + +- (void)autoTrackEventWithView:(UIView *)view properties:(NSDictionary * _Nullable)properties { + if (self.isIgnored) { + return; + } + + NSMutableDictionary *eventProperties = [NSMutableDictionary dictionaryWithDictionary:properties]; + [SAModuleManager.sharedInstance visualPropertiesWithView:view completionHandler:^(NSDictionary * _Nullable visualProperties) { + if (visualProperties) { + [eventProperties addEntriesFromDictionary:visualProperties]; + } + + [self trackAutoTrackEventWithProperties:eventProperties]; + }]; +} + +@end diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/UIApplication+AutoTrack.h b/SensorsAnalyticsSDK/AutoTrack/AppClick/UIApplication+AutoTrack.h similarity index 100% rename from SensorsAnalyticsSDK/Core/AutoTrack/UIApplication+AutoTrack.h rename to SensorsAnalyticsSDK/AutoTrack/AppClick/UIApplication+AutoTrack.h diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/UIApplication+AutoTrack.m b/SensorsAnalyticsSDK/AutoTrack/AppClick/UIApplication+AutoTrack.m similarity index 71% rename from SensorsAnalyticsSDK/Core/AutoTrack/UIApplication+AutoTrack.m rename to SensorsAnalyticsSDK/AutoTrack/AppClick/UIApplication+AutoTrack.m index 728be7f9..4ded4ae4 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/UIApplication+AutoTrack.m +++ b/SensorsAnalyticsSDK/AutoTrack/AppClick/UIApplication+AutoTrack.m @@ -30,7 +30,7 @@ #import "SensorsAnalyticsSDK+Private.h" #import "UIViewController+AutoTrack.h" #import "SAAutoTrackUtils.h" -#import "SAModuleManager.h" +#import "SAAutoTrackManager.h" @implementation UIApplication (AutoTrack) @@ -81,46 +81,16 @@ - (void)sa_track:(SEL)action to:(id)to from:(NSObject *)from forEvent:(UIEvent * } NSObject *object = (NSObject *)from; - // 判断时间间隔 - if (![SAAutoTrackUtils isValidAppClickForObject:object]) { - return; - } - - NSMutableDictionary *properties = [SAAutoTrackUtils propertiesWithAutoTrackObject:object viewController:nil]; - - if (!properties) { - return; - } - if ([object isKindOfClass:[UISwitch class]] || [object isKindOfClass:[UIStepper class]] || [object isKindOfClass:[UISegmentedControl class]] || [object isKindOfClass:[UIPageControl class]]) { - // 保存当前触发时间 - object.sensorsdata_timeIntervalForLastAppClick = [[NSProcessInfo processInfo] systemUptime]; - - [SAModuleManager.sharedInstance visualPropertiesWithView:(UIView *)object completionHandler:^(NSDictionary * _Nullable visualProperties) { - if (visualProperties) { - [properties addEntriesFromDictionary:visualProperties]; - } - SAAutoTrackEventObject *eventObject = [[SAAutoTrackEventObject alloc] initWithEventId:kSAEventNameAppClick]; - [SensorsAnalyticsSDK.sharedInstance asyncTrackEventObject:eventObject properties:properties]; - }]; + [SAAutoTrackManager.sharedInstance.appClickTracker autoTrackEventWithView:(UIView *)object]; return; } if ([event isKindOfClass:[UIEvent class]] && event.type == UIEventTypeTouches && [[[event allTouches] anyObject] phase] == UITouchPhaseEnded) { - // 保存当前触发时间 - object.sensorsdata_timeIntervalForLastAppClick = [[NSProcessInfo processInfo] systemUptime]; - - [SAModuleManager.sharedInstance visualPropertiesWithView:(UIView *)object completionHandler:^(NSDictionary * _Nullable visualProperties) { - if (visualProperties) { - [properties addEntriesFromDictionary:visualProperties]; - } - SAAutoTrackEventObject *eventObject = [[SAAutoTrackEventObject alloc] initWithEventId:kSAEventNameAppClick]; - [SensorsAnalyticsSDK.sharedInstance asyncTrackEventObject:eventObject properties:properties]; - }]; - return; + [SAAutoTrackManager.sharedInstance.appClickTracker autoTrackEventWithView:(UIView *)object]; } } diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/UIView+AutoTrack.h b/SensorsAnalyticsSDK/AutoTrack/AppClick/UIView+AutoTrack.h similarity index 100% rename from SensorsAnalyticsSDK/Core/AutoTrack/UIView+AutoTrack.h rename to SensorsAnalyticsSDK/AutoTrack/AppClick/UIView+AutoTrack.h diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/UIView+AutoTrack.m b/SensorsAnalyticsSDK/AutoTrack/AppClick/UIView+AutoTrack.m similarity index 96% rename from SensorsAnalyticsSDK/Core/AutoTrack/UIView+AutoTrack.m rename to SensorsAnalyticsSDK/AutoTrack/AppClick/UIView+AutoTrack.m index e83967f3..8042aaad 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/UIView+AutoTrack.m +++ b/SensorsAnalyticsSDK/AutoTrack/AppClick/UIView+AutoTrack.m @@ -27,6 +27,7 @@ #import "SensorsAnalyticsSDK+Private.h" #import #import "SAViewElementInfoFactory.h" +#import "SAAutoTrackManager.h" static void *const kSALastAppClickIntervalPropertyName = (void *)&kSALastAppClickIntervalPropertyName; @@ -38,11 +39,8 @@ - (BOOL)sensorsdata_isIgnored { if (self.isHidden || self.sensorsAnalyticsIgnoreView) { return YES; } - - BOOL isAutoTrackEnabled = [[SensorsAnalyticsSDK sharedInstance] isAutoTrackEnabled]; - BOOL isAutoTrackEventTypeIgnored = [[SensorsAnalyticsSDK sharedInstance] isAutoTrackEventTypeIgnored:SensorsAnalyticsEventTypeAppClick]; - BOOL isViewTypeIgnored = [[SensorsAnalyticsSDK sharedInstance] isViewTypeIgnored:[self class]]; - return !isAutoTrackEnabled || isAutoTrackEventTypeIgnored || isViewTypeIgnored; + + return [SAAutoTrackManager.sharedInstance.appClickTracker isIgnoreEventWithView:self]; } - (void)setSensorsdata_timeIntervalForLastAppClick:(NSTimeInterval)sensorsdata_timeIntervalForLastAppClick { diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/AppEnd/SAAppEndTracker.h b/SensorsAnalyticsSDK/AutoTrack/AppEnd/SAAppEndTracker.h similarity index 84% rename from SensorsAnalyticsSDK/Core/AutoTrack/AppEnd/SAAppEndTracker.h rename to SensorsAnalyticsSDK/AutoTrack/AppEnd/SAAppEndTracker.h index 8270edb7..57b21e36 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/AppEnd/SAAppEndTracker.h +++ b/SensorsAnalyticsSDK/AutoTrack/AppEnd/SAAppEndTracker.h @@ -19,13 +19,14 @@ // #import -#import "SAAppTrackerProtocol.h" +#import "SAAppTracker.h" NS_ASSUME_NONNULL_BEGIN -@interface SAAppEndTracker : NSObject +@interface SAAppEndTracker : SAAppTracker -@property (nonatomic, assign, getter=isIgnored) BOOL ignored; +/// 触发全埋点退出事件 +- (void)autoTrackEvent; /// 开始退出事件计时 - (void)trackTimerStartAppEnd; diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/AppEnd/SAAppEndTracker.m b/SensorsAnalyticsSDK/AutoTrack/AppEnd/SAAppEndTracker.m similarity index 72% rename from SensorsAnalyticsSDK/Core/AutoTrack/AppEnd/SAAppEndTracker.m rename to SensorsAnalyticsSDK/AutoTrack/AppEnd/SAAppEndTracker.m index a0a08766..750eb05d 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/AppEnd/SAAppEndTracker.m +++ b/SensorsAnalyticsSDK/AutoTrack/AppEnd/SAAppEndTracker.m @@ -26,6 +26,12 @@ #import "SensorsAnalyticsSDK+Private.h" #import "SAConstants+Private.h" +@interface SAAppEndTracker () + +@property (nonatomic, copy) NSString *timerEventID; + +@end + @implementation SAAppEndTracker #pragma mark - Life Cycle @@ -33,30 +39,29 @@ @implementation SAAppEndTracker - (instancetype)init { self = [super init]; if (self) { - _ignored = NO; + _timerEventID = kSAEventNameAppEnd; } return self; } -#pragma mark - Public Methods +#pragma mark - Override -- (void)trackTimerStartAppEnd { - [SensorsAnalyticsSDK.sharedInstance trackTimerStart:kSAEventNameAppEnd]; +- (NSString *)eventId { + return self.timerEventID; } -#pragma mark - SAAppTrackerProtocol +#pragma mark - Public Methods -- (void)trackEventWithProperties:(NSDictionary *)properties { - if (self.ignored) { +- (void)autoTrackEvent { + if (self.isIgnored) { return; } - SAAutoTrackEventObject *object = [[SAAutoTrackEventObject alloc] initWithEventId:kSAEventNameAppEnd]; - [SensorsAnalyticsSDK.sharedInstance asyncTrackEventObject:object properties:nil]; + [self trackAutoTrackEventWithProperties:nil]; } -+ (NSString *)eventName { - return kSAEventNameAppEnd; +- (void)trackTimerStartAppEnd { + self.timerEventID = [SensorsAnalyticsSDK.sharedInstance trackTimerStart:kSAEventNameAppEnd]; } @end diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/AppStart/SAAppStartTracker.h b/SensorsAnalyticsSDK/AutoTrack/AppStart/SAAppStartTracker.h similarity index 76% rename from SensorsAnalyticsSDK/Core/AutoTrack/AppStart/SAAppStartTracker.h rename to SensorsAnalyticsSDK/AutoTrack/AppStart/SAAppStartTracker.h index e197bac2..8f3ae3b1 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/AppStart/SAAppStartTracker.h +++ b/SensorsAnalyticsSDK/AutoTrack/AppStart/SAAppStartTracker.h @@ -19,16 +19,15 @@ // #import -#import "SAAppTrackerProtocol.h" +#import "SAAppTracker.h" NS_ASSUME_NONNULL_BEGIN -@interface SAAppStartTracker : NSObject +@interface SAAppStartTracker : SAAppTracker -@property (nonatomic, assign, getter=isIgnored) BOOL ignored; - -/// 是否被动启动 -@property (nonatomic, assign, getter=isPassively) BOOL passively; +/// 触发全埋点启动事件 +/// @param properties 事件属性 +- (void)autoTrackEventWithProperties:(nullable NSDictionary *)properties; @end diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/AppStart/SAAppStartTracker.m b/SensorsAnalyticsSDK/AutoTrack/AppStart/SAAppStartTracker.m similarity index 84% rename from SensorsAnalyticsSDK/Core/AutoTrack/AppStart/SAAppStartTracker.m rename to SensorsAnalyticsSDK/AutoTrack/AppStart/SAAppStartTracker.m index cca44a76..c14b8db3 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/AppStart/SAAppStartTracker.m +++ b/SensorsAnalyticsSDK/AutoTrack/AppStart/SAAppStartTracker.m @@ -23,8 +23,8 @@ #endif #import "SAAppStartTracker.h" -#import "SensorsAnalyticsSDK+Private.h" #import "SAConstants+Private.h" +#import "SensorsAnalyticsSDK+Private.h" // App 启动标记 static NSString * const kSAHasLaunchedOnce = @"HasLaunchedOnce"; @@ -47,18 +47,21 @@ @implementation SAAppStartTracker - (instancetype)init { self = [super init]; if (self) { - _ignored = NO; - _passively = NO; _relaunch = NO; } return self; } -#pragma mark - SAAppTrackerProtocol +#pragma mark - Override + +- (NSString *)eventId { + return self.isPassively ? kSAEventNameAppStartPassively : kSAEventNameAppStart; +} + +#pragma mark - Public Methods -- (void)trackEventWithProperties:(NSDictionary *)properties { +- (void)autoTrackEventWithProperties:(NSDictionary *)properties { if (!self.isIgnored) { - NSString *event = self.isPassively ? kSAEventNameAppStartPassively : kSAEventNameAppStart; NSMutableDictionary *eventProperties = [NSMutableDictionary dictionary]; if (self.isPassively) { eventProperties[kSAEventPropertyAppFirstStart] = @([self isFirstAppStart]); @@ -70,8 +73,12 @@ - (void)trackEventWithProperties:(NSDictionary *)properties { //添加 deeplink 相关渠道信息,可能不存在 [eventProperties addEntriesFromDictionary:properties]; - SAAutoTrackEventObject *object = [[SAAutoTrackEventObject alloc] initWithEventId:event]; - [SensorsAnalyticsSDK.sharedInstance asyncTrackEventObject:object properties:eventProperties]; + [self trackAutoTrackEventWithProperties:eventProperties]; + + // 上报启动事件(包括冷启动和热启动) + if (!self.passively) { + [SensorsAnalyticsSDK.sharedInstance flush]; + } } // 更新首次标记 @@ -81,10 +88,6 @@ - (void)trackEventWithProperties:(NSDictionary *)properties { self.relaunch = YES; } -+ (NSString *)eventName { - return kSAEventNameAppStart; -} - #pragma mark – Private Methods - (BOOL)isFirstAppStart { diff --git a/SensorsAnalyticsSDK/AutoTrack/AppViewScreen/SAAppViewScreenTracker.h b/SensorsAnalyticsSDK/AutoTrack/AppViewScreen/SAAppViewScreenTracker.h new file mode 100644 index 00000000..ffbf58b4 --- /dev/null +++ b/SensorsAnalyticsSDK/AutoTrack/AppViewScreen/SAAppViewScreenTracker.h @@ -0,0 +1,47 @@ +// +// SAAppViewScreenTracker.h +// SensorsAnalyticsSDK +// +// Created by 张敏超🍎 on 2021/4/27. +// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import +#import "SAAppTracker.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SAAppViewScreenTracker : SAAppTracker + +/// 触发全埋点页面浏览事件 +/// @param viewController 触发页面浏览的 UIViewController +- (void)autoTrackEventWithViewController:(UIViewController *)viewController; + +/// 通过代码触发页面浏览事件 +/// @param viewController 当前的 UIViewController +/// @param properties 用户扩展属性 +- (void)trackEventWithViewController:(UIViewController *)viewController properties:(NSDictionary * _Nullable)properties; + +/// 通过代码触发页面浏览事件 +/// @param url 当前页面 url +/// @param properties 用户扩展属性 +- (void)trackEventWithURL:(NSString *)url properties:(NSDictionary * _Nullable)properties; + +/// 触发被动启动时的页面浏览事件 +- (void)trackEventOfLaunchedPassively; + +@end + +NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/AutoTrack/AppViewScreen/SAAppViewScreenTracker.m b/SensorsAnalyticsSDK/AutoTrack/AppViewScreen/SAAppViewScreenTracker.m new file mode 100644 index 00000000..b310b9b5 --- /dev/null +++ b/SensorsAnalyticsSDK/AutoTrack/AppViewScreen/SAAppViewScreenTracker.m @@ -0,0 +1,164 @@ +// +// SAAppViewScreenTracker.m +// SensorsAnalyticsSDK +// +// Created by 张敏超🍎 on 2021/4/27. +// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#if ! __has_feature(objc_arc) +#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. +#endif + +#import "SAAppViewScreenTracker.h" +#import "SensorsAnalyticsSDK+Private.h" +#import "UIViewController+AutoTrack.h" +#import "SAAppLifecycle.h" +#import "SAConstants+Private.h" +#import "SAValidator.h" +#import "SAAutoTrackUtils.h" +#import "SAReferrerManager.h" +#import "SAModuleManager.h" + +@interface SAAppViewScreenTracker () + +@property (nonatomic, strong) NSMutableArray *launchedPassivelyControllers; + +@end + +@implementation SAAppViewScreenTracker + +- (instancetype)init { + self = [super init]; + if (self) { + _launchedPassivelyControllers = [NSMutableArray array]; + } + return self; +} + +#pragma mark - Override + +- (NSString *)eventId { + return kSAEventNameAppViewScreen; +} + +- (BOOL)shouldTrackViewController:(UIViewController *)viewController { + if ([self isViewControllerIgnored:viewController]) { + return NO; + } + + return ![self isBlackListContainsViewController:viewController]; +} + +#pragma mark - Public Methods + +- (void)autoTrackEventWithViewController:(UIViewController *)viewController { + if (!viewController) { + return; + } + + if (self.isIgnored) { + return; + } + + //过滤用户设置的不被AutoTrack的Controllers + if (![self shouldTrackViewController:viewController]) { + return; + } + + if (self.isPassively) { + [self.launchedPassivelyControllers addObject:viewController]; + return; + } + + NSDictionary *eventProperties = [self buildWithViewController:viewController properties:nil autoTrack:YES]; + [self trackAutoTrackEventWithProperties:eventProperties]; +} + +- (void)trackEventWithViewController:(UIViewController *)viewController properties:(NSDictionary *)properties { + if (!viewController) { + return; + } + + if ([self isBlackListContainsViewController:viewController]) { + return; + } + + NSDictionary *eventProperties = [self buildWithViewController:viewController properties:properties autoTrack:NO]; + [self trackPresetEventWithProperties:eventProperties]; +} + +- (void)trackEventWithURL:(NSString *)url properties:(NSDictionary *)properties { + NSDictionary *eventProperties = [[SAReferrerManager sharedInstance] propertiesWithURL:url eventProperties:properties]; + [self trackPresetEventWithProperties:eventProperties]; +} + +- (void)trackEventOfLaunchedPassively { + if (self.launchedPassivelyControllers.count == 0) { + return; + } + + if (self.isIgnored) { + return; + } + + for (UIViewController *vc in self.launchedPassivelyControllers) { + if ([self shouldTrackViewController:vc]) { + NSDictionary *eventProperties = [self buildWithViewController:vc properties:nil autoTrack:YES]; + [self trackAutoTrackEventWithProperties:eventProperties]; + } + } + [self.launchedPassivelyControllers removeAllObjects]; +} + +#pragma mark – Private Methods + +- (BOOL)isBlackListContainsViewController:(UIViewController *)viewController { + NSDictionary *autoTrackBlackList = [self autoTrackViewControllerBlackList]; + NSDictionary *appViewScreenBlackList = autoTrackBlackList[kSAEventNameAppViewScreen]; + return [self isViewController:viewController inBlackList:appViewScreenBlackList]; +} + +- (NSDictionary *)buildWithViewController:(UIViewController *)viewController properties:(NSDictionary *)properties autoTrack:(BOOL)autoTrack { + NSMutableDictionary *eventProperties = [[NSMutableDictionary alloc] init]; + + NSDictionary *autoTrackProperties = [SAAutoTrackUtils propertiesWithViewController:viewController]; + [eventProperties addEntriesFromDictionary:autoTrackProperties]; + + if (autoTrack) { + // App 通过 Deeplink 启动时第一个页面浏览事件会添加 utms 属性 + // 只需要处理全埋点的页面浏览事件 + [eventProperties addEntriesFromDictionary:SAModuleManager.sharedInstance.utmProperties]; + [SAModuleManager.sharedInstance clearUtmProperties]; + } + + if ([SAValidator isValidDictionary:properties]) { + [eventProperties addEntriesFromDictionary:properties]; + } + + NSString *currentURL; + if ([viewController conformsToProtocol:@protocol(SAScreenAutoTracker)] && [viewController respondsToSelector:@selector(getScreenUrl)]) { + UIViewController *screenAutoTrackerController = (UIViewController *)viewController; + currentURL = [screenAutoTrackerController getScreenUrl]; + } + currentURL = [currentURL isKindOfClass:NSString.class] ? currentURL : NSStringFromClass(viewController.class); + + // 添加 $url 和 $referrer 页面浏览相关属性 + NSDictionary *newProperties = [SAReferrerManager.sharedInstance propertiesWithURL:currentURL eventProperties:eventProperties]; + + return newProperties; +} + +@end diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/UIViewController+AutoTrack.h b/SensorsAnalyticsSDK/AutoTrack/AppViewScreen/UIViewController+AutoTrack.h similarity index 81% rename from SensorsAnalyticsSDK/Core/AutoTrack/UIViewController+AutoTrack.h rename to SensorsAnalyticsSDK/AutoTrack/AppViewScreen/UIViewController+AutoTrack.h index 274b29c9..8286d5ca 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/UIViewController+AutoTrack.h +++ b/SensorsAnalyticsSDK/AutoTrack/AppViewScreen/UIViewController+AutoTrack.h @@ -26,3 +26,10 @@ - (void)sa_autotrack_viewDidAppear:(BOOL)animated; @end + +@interface UINavigationController (AutoTrack) + +/// 上一次页面,防止侧滑/下滑重复采集 $AppViewScreen 事件 +@property (nonatomic, strong) UIViewController *sensorsdata_previousViewController; + +@end diff --git a/SensorsAnalyticsSDK/AutoTrack/AppViewScreen/UIViewController+AutoTrack.m b/SensorsAnalyticsSDK/AutoTrack/AppViewScreen/UIViewController+AutoTrack.m new file mode 100644 index 00000000..b6aeefe1 --- /dev/null +++ b/SensorsAnalyticsSDK/AutoTrack/AppViewScreen/UIViewController+AutoTrack.m @@ -0,0 +1,122 @@ +// +// UIViewController+AutoTrack.m +// SensorsAnalyticsSDK +// +// Created by 王灼洲 on 2017/10/18. +// Copyright © 2015-2020 Sensors Data Co., Ltd. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#if ! __has_feature(objc_arc) +#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. +#endif + + +#import "UIViewController+AutoTrack.h" +#import "SensorsAnalyticsSDK.h" +#import "SAConstants+Private.h" +#import "SACommonUtility.h" +#import "SALog.h" +#import "SensorsAnalyticsSDK+Private.h" +#import "UIView+AutoTrack.h" +#import "SAAutoTrackManager.h" +#import "SAWeakPropertyContainer.h" +#import + +static void *const kSAPreviousViewController = (void *)&kSAPreviousViewController; + +@implementation UIViewController (AutoTrack) + +- (BOOL)sensorsdata_isIgnored { + return ![[SAAutoTrackManager sharedInstance].appClickTracker shouldTrackViewController:self]; +} + +- (NSString *)sensorsdata_screenName { + return NSStringFromClass([self class]); +} + +- (NSString *)sensorsdata_title { + __block NSString *titleViewContent = nil; + __block NSString *controllerTitle = nil; + [SACommonUtility performBlockOnMainThread:^{ + titleViewContent = self.navigationItem.titleView.sensorsdata_elementContent; + controllerTitle = self.navigationItem.title; + }]; + if (titleViewContent.length > 0) { + return titleViewContent; + } + + if (controllerTitle.length > 0) { + return controllerTitle; + } + return nil; +} + +- (void)sa_autotrack_viewDidAppear:(BOOL)animated { + @try { + + // 防止 tabbar 切换,可能漏采 $AppViewScreen 全埋点 + if ([self isKindOfClass:UINavigationController.class]) { + UINavigationController *nav = (UINavigationController *)self; + nav.sensorsdata_previousViewController = nil; + } + + SAAppViewScreenTracker *appViewScreenTracker = SAAutoTrackManager.sharedInstance.appViewScreenTracker; + + // parentViewController 判断,防止开启子页面采集时候的侧滑多采集父页面 $AppViewScreen 事件 + if (self.navigationController && self.parentViewController == self.navigationController) { + // 全埋点中,忽略由于侧滑部分返回原页面,重复触发 $AppViewScreen 事件 + if (self.navigationController.sensorsdata_previousViewController == self) { + return; + } + } + +#ifndef SENSORS_ANALYTICS_ENABLE_AUTOTRACK_CHILD_VIEWSCREEN + UIViewController *viewController = (UIViewController *)self; + if (!viewController.parentViewController || + [viewController.parentViewController isKindOfClass:[UITabBarController class]] || + [viewController.parentViewController isKindOfClass:[UINavigationController class]] || + [viewController.parentViewController isKindOfClass:[UIPageViewController class]] || + [viewController.parentViewController isKindOfClass:[UISplitViewController class]]) { + [appViewScreenTracker autoTrackEventWithViewController:viewController]; + } +#else + [appViewScreenTracker autoTrackEventWithViewController:self]; +#endif + + // 标记 previousViewController + if (self.navigationController && self.parentViewController == self.navigationController) { + self.navigationController.sensorsdata_previousViewController = self; + } + } @catch (NSException *exception) { + SALogError(@"%@ error: %@", self, exception); + } + [self sa_autotrack_viewDidAppear:animated]; +} + +@end + +@implementation UINavigationController (AutoTrack) + +- (void)setSensorsdata_previousViewController:(UIViewController *)sensorsdata_previousViewController { + SAWeakPropertyContainer *container = [SAWeakPropertyContainer containerWithWeakProperty:sensorsdata_previousViewController]; + objc_setAssociatedObject(self, kSAPreviousViewController, container, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (UIViewController *)sensorsdata_previousViewController { + SAWeakPropertyContainer *container = objc_getAssociatedObject(self, kSAPreviousViewController); + return container.weakProperty; +} + +@end diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/ElementInfo/SAViewElementInfo.h b/SensorsAnalyticsSDK/AutoTrack/ElementInfo/SAViewElementInfo.h similarity index 100% rename from SensorsAnalyticsSDK/Core/AutoTrack/ElementInfo/SAViewElementInfo.h rename to SensorsAnalyticsSDK/AutoTrack/ElementInfo/SAViewElementInfo.h diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/ElementInfo/SAViewElementInfo.m b/SensorsAnalyticsSDK/AutoTrack/ElementInfo/SAViewElementInfo.m similarity index 88% rename from SensorsAnalyticsSDK/Core/AutoTrack/ElementInfo/SAViewElementInfo.m rename to SensorsAnalyticsSDK/AutoTrack/ElementInfo/SAViewElementInfo.m index 94e3509f..c1b34568 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/ElementInfo/SAViewElementInfo.m +++ b/SensorsAnalyticsSDK/AutoTrack/ElementInfo/SAViewElementInfo.m @@ -23,7 +23,7 @@ #endif #import "SAViewElementInfo.h" -#import "SAModuleManager.h" +#import "SAAutoTrackManager.h" #pragma mark - View Element Type @implementation SAViewElementInfo @@ -47,7 +47,7 @@ - (BOOL)isVisualView { if (!self.view.userInteractionEnabled || self.view.alpha <= 0.01 || self.view.isHidden) { return NO; } - return [SAModuleManager.sharedInstance isGestureVisualView:self.view]; + return [SAAutoTrackManager.sharedInstance isGestureVisualView:self.view]; } @end @@ -78,10 +78,7 @@ - (BOOL)isSupportElementPosition { } - (BOOL)isVisualView { - if (SAModuleManager.sharedInstance.gestureManager) { - return YES; - } - return [super isVisualView]; + return YES; } @end @@ -102,10 +99,7 @@ - (BOOL)isVisualView { if ([self.view.superview isKindOfClass:UICollectionViewCell.class]) { return NO; } - if (SAModuleManager.sharedInstance.gestureManager) { - return YES; - } - return [super isVisualView]; + return YES; } @end diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/ElementInfo/SAViewElementInfoFactory.h b/SensorsAnalyticsSDK/AutoTrack/ElementInfo/SAViewElementInfoFactory.h similarity index 100% rename from SensorsAnalyticsSDK/Core/AutoTrack/ElementInfo/SAViewElementInfoFactory.h rename to SensorsAnalyticsSDK/AutoTrack/ElementInfo/SAViewElementInfoFactory.h diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/ElementInfo/SAViewElementInfoFactory.m b/SensorsAnalyticsSDK/AutoTrack/ElementInfo/SAViewElementInfoFactory.m similarity index 100% rename from SensorsAnalyticsSDK/Core/AutoTrack/ElementInfo/SAViewElementInfoFactory.m rename to SensorsAnalyticsSDK/AutoTrack/ElementInfo/SAViewElementInfoFactory.m diff --git a/SensorsAnalyticsSDK/AutoTrack/SAAppTracker.h b/SensorsAnalyticsSDK/AutoTrack/SAAppTracker.h new file mode 100644 index 00000000..c56d408d --- /dev/null +++ b/SensorsAnalyticsSDK/AutoTrack/SAAppTracker.h @@ -0,0 +1,72 @@ +// +// SAAppTracker.h +// SensorsAnalyticsSDK +// +// Created by wenquan on 2021/5/20. +// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import +#import "SAConstants.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SAAppTracker : NSObject + +/// 是否忽略事件 +@property (nonatomic, assign, getter=isIgnored) BOOL ignored; +/// 是否被动启动 +@property (nonatomic, assign, getter=isPassively) BOOL passively; +/// 用户设置的不被 AutoTrack 的 Controllers +@property (nonatomic, strong) NSMutableSet *ignoredViewControllers; + +/// 获取 tracker 对应的事件 ID +- (NSString *)eventId; + +/// 触发全埋点事件 +/// @param properties 事件属性 +- (void)trackAutoTrackEventWithProperties:(nullable NSDictionary *)properties; + +/// 触发手动采集预置事件 +/// @param properties 事件属性 +- (void)trackPresetEventWithProperties:(nullable NSDictionary *)properties; + +/// 根据 UIViewController 判断,是否采集事件 +/// @param viewController 事件采集时的控制器 +- (BOOL)shouldTrackViewController:(UIViewController *)viewController; + +/// 在 AutoTrack 时,用户可以设置哪些 controllers 不被 AutoTrack +/// @param controllers controller ‘字符串’数组 +- (void)ignoreAutoTrackViewControllers:(NSArray *)controllers; + +/// 判断某个 ViewController 是否被忽略 +/// @param viewController UIViewController +- (BOOL)isViewControllerIgnored:(UIViewController *)viewController; + +/// 判断某个 ViewController 是否被忽略 +/// @param viewControllerClassName UIViewController 类名 +- (BOOL)isViewControllerStringIgnored:(NSString *)viewControllerClassName; + +/// ViewController 的黑名单 +- (NSDictionary *)autoTrackViewControllerBlackList; + +/// 判断某个 ViewController 是否处于黑名单 +/// @param viewController UIViewController +/// @param blackList 黑名单 +- (BOOL)isViewController:(UIViewController *)viewController inBlackList:(NSDictionary *)blackList; + +@end + +NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/AutoTrack/SAAppTracker.m b/SensorsAnalyticsSDK/AutoTrack/SAAppTracker.m new file mode 100644 index 00000000..e1cbb84d --- /dev/null +++ b/SensorsAnalyticsSDK/AutoTrack/SAAppTracker.m @@ -0,0 +1,120 @@ +// +// SAAppTracker.m +// SensorsAnalyticsSDK +// +// Created by wenquan on 2021/5/20. +// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#if ! __has_feature(objc_arc) +#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. +#endif + +#import "SAAppTracker.h" +#import "SATrackEventObject.h" +#import "SensorsAnalyticsSDK+Private.h" +#import "SALog.h" +#import "SAConstants+Private.h" +#import "SAValidator.h" + +@implementation SAAppTracker + +#pragma mark - Life Cycle + +- (instancetype)init { + self = [super init]; + if (self) { + _ignored = NO; + _passively = NO; + _ignoredViewControllers = [NSMutableSet set]; + } + return self; +} + +#pragma mark - Public Methods + +- (NSString *)eventId { + return nil; +} + +- (void)trackAutoTrackEventWithProperties:(NSDictionary *)properties { + SAAutoTrackEventObject *object = [[SAAutoTrackEventObject alloc] initWithEventId:[self eventId]]; + [SensorsAnalyticsSDK.sharedInstance asyncTrackEventObject:object properties:properties]; +} + +- (void)trackPresetEventWithProperties:(NSDictionary *)properties { + SAPresetEventObject *object = [[SAPresetEventObject alloc] initWithEventId:[self eventId]]; + [SensorsAnalyticsSDK.sharedInstance asyncTrackEventObject:object properties:properties]; +} + +- (BOOL)shouldTrackViewController:(UIViewController *)viewController { + return YES; +} + +- (void)ignoreAutoTrackViewControllers:(NSArray *)controllers { + if (controllers == nil || controllers.count == 0) { + return; + } + [self.ignoredViewControllers addObjectsFromArray:controllers]; +} + +- (BOOL)isViewControllerIgnored:(UIViewController *)viewController { + if (viewController == nil) { + return NO; + } + + NSString *screenName = NSStringFromClass([viewController class]); + return [self.ignoredViewControllers containsObject:screenName]; +} + +- (BOOL)isViewControllerStringIgnored:(NSString *)viewControllerClassName { + if (viewControllerClassName == nil) { + return NO; + } + + return [self.ignoredViewControllers containsObject:viewControllerClassName]; +} + +- (NSDictionary *)autoTrackViewControllerBlackList { + static dispatch_once_t onceToken; + static NSDictionary *allClasses = nil; + dispatch_once(&onceToken, ^{ + NSBundle *sensorsBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[SensorsAnalyticsSDK class]] pathForResource:@"SensorsAnalyticsSDK" ofType:@"bundle"]]; + //文件路径 + NSString *jsonPath = [sensorsBundle pathForResource:@"sa_autotrack_viewcontroller_blacklist.json" ofType:nil]; + NSData *jsonData = [NSData dataWithContentsOfFile:jsonPath]; + @try { + allClasses = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:nil]; + } @catch(NSException *exception) { // json加载和解析可能失败 + SALogError(@"%@ error: %@", self, exception); + } + }); + return allClasses; +} + +- (BOOL)isViewController:(UIViewController *)viewController inBlackList:(NSDictionary *)blackList { + if (!viewController || ![SAValidator isValidDictionary:blackList]) { + return NO; + } + + for (NSString *publicClass in blackList[@"public"]) { + if ([viewController isKindOfClass:NSClassFromString(publicClass)]) { + return YES; + } + } + return [(NSArray *)blackList[@"private"] containsObject:NSStringFromClass(viewController.class)]; +} + +@end diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackManager.h b/SensorsAnalyticsSDK/AutoTrack/SAAutoTrackManager.h similarity index 74% rename from SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackManager.h rename to SensorsAnalyticsSDK/AutoTrack/SAAutoTrackManager.h index febe14e1..a196579c 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackManager.h +++ b/SensorsAnalyticsSDK/AutoTrack/SAAutoTrackManager.h @@ -20,15 +20,20 @@ #import #import "SAModuleProtocol.h" +#import "SAAppClickTracker.h" +#import "SAAppViewScreenTracker.h" NS_ASSUME_NONNULL_BEGIN -@interface SAAutoTrackManager : NSObject +@interface SAAutoTrackManager : NSObject @property (nonatomic, strong) SAConfigOptions *configOptions; @property (nonatomic, assign, getter=isEnable) BOOL enable; +@property (nonatomic, strong) SAAppClickTracker *appClickTracker; +@property (nonatomic, strong) SAAppViewScreenTracker *appViewScreenTracker; + + (SAAutoTrackManager *)sharedInstance; #pragma mark - Public @@ -43,6 +48,11 @@ NS_ASSUME_NONNULL_BEGIN /// 更新全埋点事件类型 - (void)updateAutoTrackEventType; +/// 校验可视化全埋点元素能否选中 +/// @param obj 控件元素 +/// @return 返回校验结果 +- (BOOL)isGestureVisualView:(id)obj; + @end NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackManager.m b/SensorsAnalyticsSDK/AutoTrack/SAAutoTrackManager.m similarity index 58% rename from SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackManager.m rename to SensorsAnalyticsSDK/AutoTrack/SAAutoTrackManager.m index c1b281e6..3c58fcfc 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackManager.m +++ b/SensorsAnalyticsSDK/AutoTrack/SAAutoTrackManager.m @@ -35,6 +35,9 @@ #import "SAAppStartTracker.h" #import "SAAppEndTracker.h" #import "SAConstants+Private.h" +#import "UIGestureRecognizer+SAAutoTrack.h" +#import "SAGestureViewProcessorFactory.h" +#import "SACommonUtility.h" @interface SAAutoTrackManager () @@ -55,6 +58,12 @@ - (instancetype)init { if (self) { _appStartTracker = [[SAAppStartTracker alloc] init]; _appEndTracker = [[SAAppEndTracker alloc] init]; + _appViewScreenTracker = [[SAAppViewScreenTracker alloc] init]; + _appClickTracker = [[SAAppClickTracker alloc] init]; + + _disableSDK = NO; + _autoTrackMode = kSAAutoTrackModeDefault; + [self updateAutoTrackEventType]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appLifecycleStateDidChange:) name:kSAAppLifecycleStateDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(remoteConfigModelChanged:) name:SA_REMOTE_CONFIG_MODEL_CHANGED_NOTIFICATION object:nil]; @@ -74,41 +83,26 @@ - (void)setEnable:(BOOL)enable { } } -- (void)enableAutoTrack { - // 监听所有 UIViewController 显示事件 - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - //$AppViewScreen - [UIViewController sa_swizzleMethod:@selector(viewDidAppear:) withMethod:@selector(sa_autotrack_viewDidAppear:) error:NULL]; - NSError *error = NULL; - //$AppClick - // Actions & Events - [UIApplication sa_swizzleMethod:@selector(sendAction:to:from:forEvent:) - withMethod:@selector(sa_sendAction:to:from:forEvent:) - error:&error]; - if (error) { - SALogError(@"Failed to swizzle sendAction:to:forEvent: on UIAppplication. Details: %@", error); - error = NULL; - } - - SEL selector = NSSelectorFromString(@"sensorsdata_setDelegate:"); - [UITableView sa_swizzleMethod:@selector(setDelegate:) withMethod:selector error:NULL]; - [NSObject sa_swizzleMethod:@selector(respondsToSelector:) withMethod:@selector(sensorsdata_respondsToSelector:) error:NULL]; - [UICollectionView sa_swizzleMethod:@selector(setDelegate:) withMethod:selector error:NULL]; - - //React Native - if (NSClassFromString(@"RCTUIManager") && [SAModuleManager.sharedInstance contains:SAModuleTypeReactNative]) { - [SAModuleManager.sharedInstance setEnable:YES forModuleType:SAModuleTypeReactNative]; - } - }); -} - #pragma mark - Instance + (SAAutoTrackManager *)sharedInstance { return (SAAutoTrackManager *)[SAModuleManager.sharedInstance managerForModuleType:SAModuleTypeAutoTrack]; } +#pragma mark - SAAutoTrackModuleProtocol + +- (void)trackAppEndWhenCrashed { + if (self.appEndTracker.isIgnored) { + return; + } + + [SACommonUtility performBlockOnMainThread:^{ + if (UIApplication.sharedApplication.applicationState == UIApplicationStateActive) { + [self.appEndTracker autoTrackEvent]; + } + }]; +} + #pragma mark - Notification - (void)appLifecycleStateDidChange:(NSNotification *)sender { @@ -116,10 +110,15 @@ - (void)appLifecycleStateDidChange:(NSNotification *)sender { SAAppLifecycleState newState = [userInfo[kSAAppLifecycleNewStateKey] integerValue]; SAAppLifecycleState oldState = [userInfo[kSAAppLifecycleOldStateKey] integerValue]; + self.appStartTracker.passively = NO; + self.appViewScreenTracker.passively = NO; + // 被动启动 if (oldState == SAAppLifecycleStateInit && newState == SAAppLifecycleStateStartPassively) { self.appStartTracker.passively = YES; - [self.appStartTracker trackEventWithProperties:SAModuleManager.sharedInstance.utmProperties]; + self.appViewScreenTracker.passively = YES; + + [self.appStartTracker autoTrackEventWithProperties:SAModuleManager.sharedInstance.utmProperties]; return; } @@ -128,14 +127,17 @@ - (void)appLifecycleStateDidChange:(NSNotification *)sender { // 启动 AppEnd 事件计时器 [self.appEndTracker trackTimerStartAppEnd]; // 触发启动事件 - self.appStartTracker.passively = NO; - [self.appStartTracker trackEventWithProperties:SAModuleManager.sharedInstance.utmProperties]; + [self.appStartTracker autoTrackEventWithProperties:SAModuleManager.sharedInstance.utmProperties]; + // 热启动时触发被动启动的页面浏览事件 + if (oldState == SAAppLifecycleStateStartPassively) { + [self.appViewScreenTracker trackEventOfLaunchedPassively]; + } return; } // 退出 if (newState == SAAppLifecycleStateEnd) { - [self.appEndTracker trackEventWithProperties:nil]; + [self.appEndTracker autoTrackEvent]; } } @@ -189,11 +191,11 @@ - (BOOL)isAutoTrackEventTypeIgnored:(SensorsAnalyticsAutoTrackEventType)eventTyp NSString *ignoredEvent = @"None"; switch (eventType) { case SensorsAnalyticsEventTypeAppStart: - ignoredEvent = [SAAppStartTracker eventName]; + ignoredEvent = kSAEventNameAppStart; break; case SensorsAnalyticsEventTypeAppEnd: - ignoredEvent = [SAAppEndTracker eventName]; + ignoredEvent = kSAEventNameAppEnd; break; case SensorsAnalyticsEventTypeAppClick: @@ -216,6 +218,87 @@ - (BOOL)isAutoTrackEventTypeIgnored:(SensorsAnalyticsAutoTrackEventType)eventTyp - (void)updateAutoTrackEventType { self.appStartTracker.ignored = [self isAutoTrackEventTypeIgnored:SensorsAnalyticsEventTypeAppStart]; self.appEndTracker.ignored = [self isAutoTrackEventTypeIgnored:SensorsAnalyticsEventTypeAppEnd]; + self.appViewScreenTracker.ignored = [self isAutoTrackEventTypeIgnored:SensorsAnalyticsEventTypeAppViewScreen]; + self.appClickTracker.ignored = [self isAutoTrackEventTypeIgnored:SensorsAnalyticsEventTypeAppClick]; +} + +- (BOOL)isGestureVisualView:(id)obj { + if (!self.enable) { + return NO; + } + if (![obj isKindOfClass:UIView.class]) { + return NO; + } + UIView *view = (UIView *)obj; + for (UIGestureRecognizer *gesture in view.gestureRecognizers) { + if (gesture.sensorsdata_gestureTarget) { + SAGeneralGestureViewProcessor *processor = [SAGestureViewProcessorFactory processorWithGesture:gesture]; + if (processor.isTrackable && processor.trackableView == gesture.view) { + return YES; + } + } + } + return NO; +} + +#pragma mark – Private Methods + +- (void)enableAutoTrack { + // 监听所有 UIViewController 显示事件 + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + [self enableAppViewScreenAutoTrack]; + [self enableAppClickAutoTrack]; + [self enableReactNativeAutoTrack]; + }); +} + +- (void)enableAppViewScreenAutoTrack { + [UIViewController sa_swizzleMethod:@selector(viewDidAppear:) + withMethod:@selector(sa_autotrack_viewDidAppear:) + error:NULL]; +} + +- (void)enableAppClickAutoTrack { + // Actions & Events + NSError *error = NULL; + [UIApplication sa_swizzleMethod:@selector(sendAction:to:from:forEvent:) + withMethod:@selector(sa_sendAction:to:from:forEvent:) + error:&error]; + if (error) { + SALogError(@"Failed to swizzle sendAction:to:forEvent: on UIAppplication. Details: %@", error); + error = NULL; + } + + // Cell + SEL selector = NSSelectorFromString(@"sensorsdata_setDelegate:"); + [UITableView sa_swizzleMethod:@selector(setDelegate:) + withMethod:selector + error:NULL]; + [NSObject sa_swizzleMethod:@selector(respondsToSelector:) + withMethod:@selector(sensorsdata_respondsToSelector:) + error:NULL]; + [UICollectionView sa_swizzleMethod:@selector(setDelegate:) + withMethod:selector + error:NULL]; + + // Gesture + [UIGestureRecognizer sa_swizzleMethod:@selector(initWithTarget:action:) + withMethod:@selector(sensorsdata_initWithTarget:action:) + error:NULL]; + [UIGestureRecognizer sa_swizzleMethod:@selector(addTarget:action:) + withMethod:@selector(sensorsdata_addTarget:action:) + error:NULL]; + [UIGestureRecognizer sa_swizzleMethod:@selector(removeTarget:action:) + withMethod:@selector(sensorsdata_removeTarget:action:) + error:NULL]; + +} + +- (void)enableReactNativeAutoTrack { + if (NSClassFromString(@"RCTUIManager") && [SAModuleManager.sharedInstance contains:SAModuleTypeReactNative]) { + [SAModuleManager.sharedInstance setEnable:YES forModuleType:SAModuleTypeReactNative]; + } } @end diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackProperty.h b/SensorsAnalyticsSDK/AutoTrack/SAAutoTrackProperty.h similarity index 100% rename from SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackProperty.h rename to SensorsAnalyticsSDK/AutoTrack/SAAutoTrackProperty.h diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackUtils.h b/SensorsAnalyticsSDK/AutoTrack/SAAutoTrackUtils.h similarity index 100% rename from SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackUtils.h rename to SensorsAnalyticsSDK/AutoTrack/SAAutoTrackUtils.h diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackUtils.m b/SensorsAnalyticsSDK/AutoTrack/SAAutoTrackUtils.m similarity index 95% rename from SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackUtils.m rename to SensorsAnalyticsSDK/AutoTrack/SAAutoTrackUtils.m index 16ab3f48..b62640cf 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/SAAutoTrackUtils.m +++ b/SensorsAnalyticsSDK/AutoTrack/SAAutoTrackUtils.m @@ -229,8 +229,8 @@ + (NSInteger)itemIndexForResponder:(UIResponder *)responder { + (NSDictionary *)propertiesWithViewController:(UIViewController *)viewController { NSMutableDictionary *properties = [[NSMutableDictionary alloc] init]; - properties[SA_EVENT_PROPERTY_SCREEN_NAME] = viewController.sensorsdata_screenName; - properties[SA_EVENT_PROPERTY_TITLE] = viewController.sensorsdata_title; + properties[kSAEventPropertyScreenName] = viewController.sensorsdata_screenName; + properties[kSAEventPropertyTitle] = viewController.sensorsdata_title; if ([viewController conformsToProtocol:@protocol(SAAutoTracker)] && [viewController respondsToSelector:@selector(getTrackProperties)]) { @@ -262,7 +262,7 @@ + (NSInteger)itemIndexForResponder:(UIResponder *)responder { NSMutableDictionary *properties = [[NSMutableDictionary alloc] init]; // ViewID - properties[SA_EVENT_PROPERTY_ELEMENT_ID] = object.sensorsdata_elementId; + properties[kSAEventPropertyElementId] = object.sensorsdata_elementId; viewController = viewController ? : object.sensorsdata_viewController; if (!isCodeTrack && viewController.sensorsdata_isIgnored) { @@ -272,9 +272,9 @@ + (NSInteger)itemIndexForResponder:(UIResponder *)responder { NSDictionary *dic = [self propertiesWithViewController:viewController]; [properties addEntriesFromDictionary:dic]; - properties[SA_EVENT_PROPERTY_ELEMENT_TYPE] = object.sensorsdata_elementType; - properties[SA_EVENT_PROPERTY_ELEMENT_CONTENT] = object.sensorsdata_elementContent; - properties[SA_EVENT_PROPERTY_ELEMENT_POSITION] = object.sensorsdata_elementPosition; + properties[kSAEventPropertyElementType] = object.sensorsdata_elementType; + properties[kSAEventPropertyElementContent] = object.sensorsdata_elementContent; + properties[kSAEventPropertyElementPosition] = object.sensorsdata_elementPosition; UIView *view = (UIView *)object; //View Properties @@ -310,7 +310,7 @@ @implementation SAAutoTrackUtils (IndexPath) } // ViewID - properties[SA_EVENT_PROPERTY_ELEMENT_ID] = object.sensorsdata_elementId; + properties[kSAEventPropertyElementId] = object.sensorsdata_elementId; UIViewController *viewController = object.sensorsdata_viewController; if (viewController.sensorsdata_isIgnored) { @@ -320,9 +320,9 @@ @implementation SAAutoTrackUtils (IndexPath) NSDictionary *dic = [self propertiesWithViewController:viewController]; [properties addEntriesFromDictionary:dic]; - properties[SA_EVENT_PROPERTY_ELEMENT_TYPE] = object.sensorsdata_elementType; - properties[SA_EVENT_PROPERTY_ELEMENT_CONTENT] = cell.sensorsdata_elementContent; - properties[SA_EVENT_PROPERTY_ELEMENT_POSITION] = [cell sensorsdata_elementPositionWithIndexPath:indexPath]; + properties[kSAEventPropertyElementType] = object.sensorsdata_elementType; + properties[kSAEventPropertyElementContent] = cell.sensorsdata_elementContent; + properties[kSAEventPropertyElementPosition] = [cell sensorsdata_elementPositionWithIndexPath:indexPath]; //View Properties NSDictionary *viewProperties = ((UIView *)object).sensorsAnalyticsViewProperties; diff --git a/SensorsAnalyticsSDK/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.h b/SensorsAnalyticsSDK/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.h new file mode 100644 index 00000000..77a32329 --- /dev/null +++ b/SensorsAnalyticsSDK/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.h @@ -0,0 +1,225 @@ +// +// SensorsAnalyticsSDK+SAAutoTrack.h +// SensorsAnalyticsSDK +// +// Created by wenquan on 2021/4/2. +// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "SensorsAnalyticsSDK.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol SAUIViewAutoTrackDelegate + +//UITableView +@optional +- (NSDictionary *)sensorsAnalytics_tableView:(UITableView *)tableView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath; + +//UICollectionView +@optional +- (NSDictionary *)sensorsAnalytics_collectionView:(UICollectionView *)collectionView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath; +@end + +@interface UIImage (SensorsAnalytics) +@property (nonatomic, copy) NSString* sensorsAnalyticsImageName; +@end + +@interface UIView (SensorsAnalytics) +- (nullable UIViewController *)sensorsAnalyticsViewController __attribute__((deprecated("已过时"))); + +/// viewID +@property (nonatomic, copy) NSString* sensorsAnalyticsViewID; + +/// AutoTrack 时,是否忽略该 View +@property (nonatomic, assign) BOOL sensorsAnalyticsIgnoreView; + +/// AutoTrack 发生在 SendAction 之前还是之后,默认是 SendAction 之前 +@property (nonatomic, assign) BOOL sensorsAnalyticsAutoTrackAfterSendAction; + +/// AutoTrack 时,View 的扩展属性 +@property (nonatomic, strong) NSDictionary* sensorsAnalyticsViewProperties; + +@property (nonatomic, weak, nullable) id sensorsAnalyticsDelegate; +@end + +/** + * @abstract + * 自动追踪 (AutoTrack) 中,实现该 Protocal 的 Controller 对象可以通过接口向自动采集的事件中加入属性 + * + * @discussion + * 属性的约束请参考 track:withProperties: + */ +@protocol SAAutoTracker + +@required +- (NSDictionary *)getTrackProperties; + +@end + +@protocol SAScreenAutoTracker + +@required +- (NSString *)getScreenUrl; + +@end + +#pragma mark - + +@interface SensorsAnalyticsSDK (SAAutoTrack) + +- (UIViewController *_Nullable)currentViewController; + +/** + * @abstract + * 是否开启 AutoTrack + * + * @return YES: 开启 AutoTrack; NO: 关闭 AutoTrack + */ +- (BOOL)isAutoTrackEnabled; + +#pragma mark - Ignore + +/** + * @abstract + * 判断某个 AutoTrack 事件类型是否被忽略 + * + * @param eventType SensorsAnalyticsAutoTrackEventType 要判断的 AutoTrack 事件类型 + * + * @return YES:被忽略; NO:没有被忽略 + */ +- (BOOL)isAutoTrackEventTypeIgnored:(SensorsAnalyticsAutoTrackEventType)eventType; + +/** + * @abstract + * 忽略某一类型的 View + * + * @param aClass View 对应的 Class + */ +- (void)ignoreViewType:(Class)aClass; + +/** + * @abstract + * 判断某个 View 类型是否被忽略 + * + * @param aClass Class View 对应的 Class + * + * @return YES:被忽略; NO:没有被忽略 + */ +- (BOOL)isViewTypeIgnored:(Class)aClass; + +/** + * @abstract + * 在 AutoTrack 时,用户可以设置哪些 controllers 不被 AutoTrack + * + * @param controllers controller ‘字符串’数组 + */ +- (void)ignoreAutoTrackViewControllers:(NSArray *)controllers; + +/** + * @abstract + * 判断某个 ViewController 是否被忽略 + * + * @param viewController UIViewController + * + * @return YES:被忽略; NO:没有被忽略 + */ +- (BOOL)isViewControllerIgnored:(UIViewController *)viewController; + +#pragma mark - Track + +/** + * @abstract + * 通过代码触发 UIView 的 $AppClick 事件 + * + * @param view UIView + */ +- (void)trackViewAppClick:(nonnull UIView *)view; + +/** + * @abstract + * 通过代码触发 UIView 的 $AppClick 事件 + * + * @param view UIView + * @param properties 自定义属性 + */ +- (void)trackViewAppClick:(nonnull UIView *)view withProperties:(nullable NSDictionary *)properties; + +/** + * @abstract + * 通过代码触发 UIViewController 的 $AppViewScreen 事件 + * + * @param viewController 当前的 UIViewController + */ +- (void)trackViewScreen:(UIViewController *)viewController; +- (void)trackViewScreen:(UIViewController *)viewController properties:(nullable NSDictionary *)properties; + +#pragma mark - Deprecated + +/** + * @property + * + * @abstract + * 打开 SDK 自动追踪,默认只追踪App 启动 / 关闭、进入页面 + * + * @discussion + * 该功能自动追踪 App 的一些行为,例如 SDK 初始化、App 启动 / 关闭、进入页面 等等,具体信息请参考文档: + * https://sensorsdata.cn/manual/ios_sdk.html + * 该功能默认关闭 + */ +- (void)enableAutoTrack __attribute__((deprecated("已过时,请参考 SAConfigOptions 类的 autoTrackEventType"))); + +/** + * @property + * + * @abstract + * 打开 SDK 自动追踪,默认只追踪App 启动 / 关闭、进入页面、元素点击 + * @discussion + * 该功能自动追踪 App 的一些行为,例如 SDK 初始化、App 启动 / 关闭、进入页面 等等,具体信息请参考文档: + * https://sensorsdata.cn/manual/ios_sdk.html + * 该功能默认关闭 + */ +- (void)enableAutoTrack:(SensorsAnalyticsAutoTrackEventType)eventType __attribute__((deprecated("已过时,请参考 SAConfigOptions 类的 autoTrackEventType"))); + +/** + * @abstract + * 过滤掉 AutoTrack 的某个事件类型 + * + * @param eventType SensorsAnalyticsAutoTrackEventType 要忽略的 AutoTrack 事件类型 + */ +- (void)ignoreAutoTrackEventType:(SensorsAnalyticsAutoTrackEventType)eventType __attribute__((deprecated("已过时,请参考enableAutoTrack:(SensorsAnalyticsAutoTrackEventType)eventType"))); + +/** + * @abstract + * 判断某个 ViewController 是否被忽略 + * + * @param viewControllerClassName UIViewController 类名 + * + * @return YES:被忽略; NO:没有被忽略 + */ +- (BOOL)isViewControllerStringIgnored:(NSString *)viewControllerClassName __attribute__((deprecated("已过时,请参考 -(BOOL)isViewControllerIgnored:(UIViewController *)viewController"))); + +/** + * @abstract + * Track $AppViewScreen事件 + * + * @param url 当前页面url + * @param properties 用户扩展属性 + */ +- (void)trackViewScreen:(NSString *)url withProperties:(NSDictionary *)properties __attribute__((deprecated("已过时,请参考 trackViewScreen: properties:"))); + +@end + +NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.m b/SensorsAnalyticsSDK/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.m new file mode 100644 index 00000000..d3a22baf --- /dev/null +++ b/SensorsAnalyticsSDK/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.m @@ -0,0 +1,193 @@ +// +// SensorsAnalyticsSDK+SAAutoTrack.m +// SensorsAnalyticsSDK +// +// Created by wenquan on 2021/4/2. +// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#if ! __has_feature(objc_arc) +#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. +#endif + +#import "SensorsAnalyticsSDK+SAAutoTrack.h" +#import "SensorsAnalyticsSDK+Private.h" +#import "SAAutoTrackUtils.h" +#import "UIView+AutoTrack.h" +#import "SAAutoTrackManager.h" +#import "SAModuleManager.h" +#import "SAWeakPropertyContainer.h" +#include + +@implementation UIImage (SensorsAnalytics) + +- (NSString *)sensorsAnalyticsImageName { + return objc_getAssociatedObject(self, @"sensorsAnalyticsImageName"); +} + +- (void)setSensorsAnalyticsImageName:(NSString *)sensorsAnalyticsImageName { + objc_setAssociatedObject(self, @"sensorsAnalyticsImageName", sensorsAnalyticsImageName, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +@end + +@implementation UIView (SensorsAnalytics) + +- (UIViewController *)sensorsAnalyticsViewController { + return self.sensorsdata_viewController; +} + +//viewID +- (NSString *)sensorsAnalyticsViewID { + return objc_getAssociatedObject(self, @"sensorsAnalyticsViewID"); +} + +- (void)setSensorsAnalyticsViewID:(NSString *)sensorsAnalyticsViewID { + objc_setAssociatedObject(self, @"sensorsAnalyticsViewID", sensorsAnalyticsViewID, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +//ignoreView +- (BOOL)sensorsAnalyticsIgnoreView { + return [objc_getAssociatedObject(self, @"sensorsAnalyticsIgnoreView") boolValue]; +} + +- (void)setSensorsAnalyticsIgnoreView:(BOOL)sensorsAnalyticsIgnoreView { + objc_setAssociatedObject(self, @"sensorsAnalyticsIgnoreView", [NSNumber numberWithBool:sensorsAnalyticsIgnoreView], OBJC_ASSOCIATION_ASSIGN); +} + +//afterSendAction +- (BOOL)sensorsAnalyticsAutoTrackAfterSendAction { + return [objc_getAssociatedObject(self, @"sensorsAnalyticsAutoTrackAfterSendAction") boolValue]; +} + +- (void)setSensorsAnalyticsAutoTrackAfterSendAction:(BOOL)sensorsAnalyticsAutoTrackAfterSendAction { + objc_setAssociatedObject(self, @"sensorsAnalyticsAutoTrackAfterSendAction", [NSNumber numberWithBool:sensorsAnalyticsAutoTrackAfterSendAction], OBJC_ASSOCIATION_ASSIGN); +} + +//viewProperty +- (NSDictionary *)sensorsAnalyticsViewProperties { + return objc_getAssociatedObject(self, @"sensorsAnalyticsViewProperties"); +} + +- (void)setSensorsAnalyticsViewProperties:(NSDictionary *)sensorsAnalyticsViewProperties { + objc_setAssociatedObject(self, @"sensorsAnalyticsViewProperties", sensorsAnalyticsViewProperties, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (id)sensorsAnalyticsDelegate { + SAWeakPropertyContainer *container = objc_getAssociatedObject(self, @"sensorsAnalyticsDelegate"); + return container.weakProperty; +} + +- (void)setSensorsAnalyticsDelegate:(id)sensorsAnalyticsDelegate { + SAWeakPropertyContainer *container = [SAWeakPropertyContainer containerWithWeakProperty:sensorsAnalyticsDelegate]; + objc_setAssociatedObject(self, @"sensorsAnalyticsDelegate", container, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end + +#pragma mark - + +@implementation SensorsAnalyticsSDK (SAAutoTrack) + +- (UIViewController *)currentViewController { + return [SAAutoTrackUtils currentViewController]; +} + +- (BOOL)isAutoTrackEnabled { + return [SAAutoTrackManager.sharedInstance isAutoTrackEnabled]; +} + +#pragma mark - Ignore + +- (BOOL)isAutoTrackEventTypeIgnored:(SensorsAnalyticsAutoTrackEventType)eventType { + return [SAAutoTrackManager.sharedInstance isAutoTrackEventTypeIgnored:eventType]; +} + +- (void)ignoreViewType:(Class)aClass { + [SAAutoTrackManager.sharedInstance.appClickTracker ignoreViewType:aClass]; +} + +- (BOOL)isViewTypeIgnored:(Class)aClass { + return [SAAutoTrackManager.sharedInstance.appClickTracker isViewTypeIgnored:aClass]; +} + +- (void)ignoreAutoTrackViewControllers:(NSArray *)controllers { + [SAAutoTrackManager.sharedInstance.appClickTracker ignoreAutoTrackViewControllers:controllers]; + [SAAutoTrackManager.sharedInstance.appViewScreenTracker ignoreAutoTrackViewControllers:controllers]; +} + +- (BOOL)isViewControllerIgnored:(UIViewController *)viewController { + BOOL isIgnoreAppClick = [SAAutoTrackManager.sharedInstance.appClickTracker isViewControllerIgnored:viewController]; + BOOL isIgnoreAppViewScreen = [SAAutoTrackManager.sharedInstance.appViewScreenTracker isViewControllerIgnored:viewController]; + + return isIgnoreAppClick || isIgnoreAppViewScreen; +} + +#pragma mark - Track + +- (void)trackViewAppClick:(UIView *)view { + [self trackViewAppClick:view withProperties:nil]; +} + +- (void)trackViewAppClick:(UIView *)view withProperties:(NSDictionary *)p { + [SAAutoTrackManager.sharedInstance.appClickTracker trackEventWithView:view properties:p]; +} + +- (void)trackViewScreen:(UIViewController *)controller { + [self trackViewScreen:controller properties:nil]; +} + +- (void)trackViewScreen:(UIViewController *)controller properties:(nullable NSDictionary *)properties { + [SAAutoTrackManager.sharedInstance.appViewScreenTracker trackEventWithViewController:controller properties:properties]; +} + +#pragma mark - Deprecated + +- (void)enableAutoTrack { + [self enableAutoTrack:SensorsAnalyticsEventTypeAppStart | SensorsAnalyticsEventTypeAppEnd | SensorsAnalyticsEventTypeAppViewScreen]; +} + +- (void)enableAutoTrack:(SensorsAnalyticsAutoTrackEventType)eventType { + if (self.configOptions.autoTrackEventType != eventType) { + self.configOptions.autoTrackEventType = eventType; + + [SAModuleManager.sharedInstance setEnable:YES forModuleType:SAModuleTypeAutoTrack]; + + [SAAutoTrackManager.sharedInstance updateAutoTrackEventType]; + } +} + +- (void)ignoreAutoTrackEventType:(SensorsAnalyticsAutoTrackEventType)eventType { + if ([SAAutoTrackManager.sharedInstance isAutoTrackEventTypeIgnored:eventType]) { + return; + } + + self.configOptions.autoTrackEventType = self.configOptions.autoTrackEventType ^ eventType; + + [SAAutoTrackManager.sharedInstance updateAutoTrackEventType]; +} + +- (BOOL)isViewControllerStringIgnored:(NSString *)viewControllerClassName { + BOOL isIgnoreAppClick = [SAAutoTrackManager.sharedInstance.appClickTracker isViewControllerStringIgnored:viewControllerClassName]; + BOOL isIgnoreAppViewScreen = [SAAutoTrackManager.sharedInstance.appViewScreenTracker isViewControllerStringIgnored:viewControllerClassName]; + + return isIgnoreAppClick || isIgnoreAppViewScreen; +} + +- (void)trackViewScreen:(NSString *)url withProperties:(NSDictionary *)properties { + [SAAutoTrackManager.sharedInstance.appViewScreenTracker trackEventWithURL:url properties:properties]; +} + +@end diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/SAAppTrackerProtocol.h b/SensorsAnalyticsSDK/Core/AutoTrack/SAAppTrackerProtocol.h deleted file mode 100644 index 18c062c5..00000000 --- a/SensorsAnalyticsSDK/Core/AutoTrack/SAAppTrackerProtocol.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// SAAppTrackerProtocol.h -// SensorsAnalyticsSDK -// -// Created by wenquan on 2021/4/20. -// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol SAAppTrackerProtocol - -/// 是否忽略事件 -@property (nonatomic, assign, getter=isIgnored) BOOL ignored; - -/// 获取 tracker 对应的事件名 -+ (NSString *)eventName; - -/// 触发全埋点事件 -/// @param properties 事件属性 -- (void)trackEventWithProperties:(nullable NSDictionary *)properties; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.h b/SensorsAnalyticsSDK/Core/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.h deleted file mode 100644 index 7937d347..00000000 --- a/SensorsAnalyticsSDK/Core/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.h +++ /dev/null @@ -1,84 +0,0 @@ -// -// SensorsAnalyticsSDK+SAAutoTrack.h -// SensorsAnalyticsSDK -// -// Created by wenquan on 2021/4/2. -// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "SensorsAnalyticsSDK.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SensorsAnalyticsSDK (SAAutoTrack) - -/** - * @abstract - * 是否开启 AutoTrack - * - * @return YES: 开启 AutoTrack; NO: 关闭 AutoTrack - */ -- (BOOL)isAutoTrackEnabled; - -#pragma mark - Ignore - -/** - * @abstract - * 判断某个 AutoTrack 事件类型是否被忽略 - * - * @param eventType SensorsAnalyticsAutoTrackEventType 要判断的 AutoTrack 事件类型 - * - * @return YES:被忽略; NO:没有被忽略 - */ -- (BOOL)isAutoTrackEventTypeIgnored:(SensorsAnalyticsAutoTrackEventType)eventType; - -#pragma mark - Deprecated - -/** - * @property - * - * @abstract - * 打开 SDK 自动追踪,默认只追踪App 启动 / 关闭、进入页面 - * - * @discussion - * 该功能自动追踪 App 的一些行为,例如 SDK 初始化、App 启动 / 关闭、进入页面 等等,具体信息请参考文档: - * https://sensorsdata.cn/manual/ios_sdk.html - * 该功能默认关闭 - */ -- (void)enableAutoTrack __attribute__((deprecated("已过时,请参考 SAConfigOptions 类的 autoTrackEventType"))); - -/** - * @property - * - * @abstract - * 打开 SDK 自动追踪,默认只追踪App 启动 / 关闭、进入页面、元素点击 - * @discussion - * 该功能自动追踪 App 的一些行为,例如 SDK 初始化、App 启动 / 关闭、进入页面 等等,具体信息请参考文档: - * https://sensorsdata.cn/manual/ios_sdk.html - * 该功能默认关闭 - */ -- (void)enableAutoTrack:(SensorsAnalyticsAutoTrackEventType)eventType __attribute__((deprecated("已过时,请参考 SAConfigOptions 类的 autoTrackEventType"))); - -/** - * @abstract - * 过滤掉 AutoTrack 的某个事件类型 - * - * @param eventType SensorsAnalyticsAutoTrackEventType 要忽略的 AutoTrack 事件类型 - */ -- (void)ignoreAutoTrackEventType:(SensorsAnalyticsAutoTrackEventType)eventType __attribute__((deprecated("已过时,请参考enableAutoTrack:(SensorsAnalyticsAutoTrackEventType)eventType"))); - -@end - -NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.m b/SensorsAnalyticsSDK/Core/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.m deleted file mode 100644 index 4f5af7bb..00000000 --- a/SensorsAnalyticsSDK/Core/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.m +++ /dev/null @@ -1,66 +0,0 @@ -// -// SensorsAnalyticsSDK+SAAutoTrack.m -// SensorsAnalyticsSDK -// -// Created by wenquan on 2021/4/2. -// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - -#import "SensorsAnalyticsSDK+SAAutoTrack.h" -#import "SensorsAnalyticsSDK+Private.h" -#import "SAAutoTrackManager.h" -#import "SAModuleManager.h" - -#pragma mark - - -@implementation SensorsAnalyticsSDK (SAAutoTrack) - -- (BOOL)isAutoTrackEnabled { - return [SAAutoTrackManager.sharedInstance isAutoTrackEnabled]; -} - -#pragma mark - Ignore - -- (BOOL)isAutoTrackEventTypeIgnored:(SensorsAnalyticsAutoTrackEventType)eventType { - return [SAAutoTrackManager.sharedInstance isAutoTrackEventTypeIgnored:eventType]; -} - -#pragma mark - Deprecated - -- (void)enableAutoTrack { - [self enableAutoTrack:SensorsAnalyticsEventTypeAppStart | SensorsAnalyticsEventTypeAppEnd | SensorsAnalyticsEventTypeAppViewScreen]; -} - -- (void)enableAutoTrack:(SensorsAnalyticsAutoTrackEventType)eventType { - if (self.configOptions.autoTrackEventType != eventType) { - self.configOptions.autoTrackEventType = eventType; - - [SAModuleManager.sharedInstance setEnable:YES forModuleType:SAModuleTypeAutoTrack]; - - [SAAutoTrackManager.sharedInstance updateAutoTrackEventType]; - } -} - -- (void)ignoreAutoTrackEventType:(SensorsAnalyticsAutoTrackEventType)eventType { - self.configOptions.autoTrackEventType = self.configOptions.autoTrackEventType ^ eventType; - - [SAAutoTrackManager.sharedInstance updateAutoTrackEventType]; -} - -@end diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/UIViewController+AutoTrack.m b/SensorsAnalyticsSDK/Core/AutoTrack/UIViewController+AutoTrack.m deleted file mode 100644 index e4df628c..00000000 --- a/SensorsAnalyticsSDK/Core/AutoTrack/UIViewController+AutoTrack.m +++ /dev/null @@ -1,90 +0,0 @@ -// -// UIViewController+AutoTrack.m -// SensorsAnalyticsSDK -// -// Created by 王灼洲 on 2017/10/18. -// Copyright © 2015-2020 Sensors Data Co., Ltd. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - - -#import "UIViewController+AutoTrack.h" -#import "SensorsAnalyticsSDK.h" -#import "SAConstants+Private.h" -#import "SACommonUtility.h" -#import "SALog.h" -#import "SensorsAnalyticsSDK+Private.h" -#import "UIView+AutoTrack.h" - -@implementation UIViewController (AutoTrack) - -- (BOOL)sensorsdata_isIgnored { - return ![[SensorsAnalyticsSDK sharedInstance] shouldTrackViewController:self ofType:SensorsAnalyticsEventTypeAppClick]; -} - -- (NSString *)sensorsdata_screenName { - return NSStringFromClass([self class]); -} - -- (NSString *)sensorsdata_title { - __block NSString *titleViewContent = nil; - __block NSString *controllerTitle = nil; - [SACommonUtility performBlockOnMainThread:^{ - titleViewContent = self.navigationItem.titleView.sensorsdata_elementContent; - controllerTitle = self.navigationItem.title; - }]; - if (titleViewContent.length > 0) { - return titleViewContent; - } - - if (controllerTitle.length > 0) { - return controllerTitle; - } - return nil; -} - - -- (void)sa_autotrack_viewDidAppear:(BOOL)animated { - @try { - - SensorsAnalyticsSDK *instance = [SensorsAnalyticsSDK sharedInstance]; - - if (![instance isAutoTrackEventTypeIgnored:SensorsAnalyticsEventTypeAppViewScreen] && instance.previousTrackViewController != self) { -#ifndef SENSORS_ANALYTICS_ENABLE_AUTOTRACK_CHILD_VIEWSCREEN - UIViewController *viewController = (UIViewController *)self; - if (!viewController.parentViewController || [viewController.parentViewController isKindOfClass:[UITabBarController class]] || - [viewController.parentViewController isKindOfClass:[UINavigationController class]] || - [viewController.parentViewController isKindOfClass:[UIPageViewController class]] || - [viewController.parentViewController isKindOfClass:[UISplitViewController class]]) { - [instance autoTrackViewScreen:viewController]; - } -#else - [instance autoTrackViewScreen:self]; -#endif - } - - if (instance.previousTrackViewController != self && UIApplication.sharedApplication.keyWindow == self.view.window) { - // 全埋点中,忽略由于侧滑返回时多次触发的页面浏览事件 - instance.previousTrackViewController = self; - } - } @catch (NSException *exception) { - SALogError(@"%@ error: %@", self, exception); - } - [self sa_autotrack_viewDidAppear:animated]; -} -@end diff --git a/SensorsAnalyticsSDK/Core/Builder/EventObject/SATrackEventObject.m b/SensorsAnalyticsSDK/Core/Builder/EventObject/SATrackEventObject.m index fff3ef8a..0bb4ac3b 100644 --- a/SensorsAnalyticsSDK/Core/Builder/EventObject/SATrackEventObject.m +++ b/SensorsAnalyticsSDK/Core/Builder/EventObject/SATrackEventObject.m @@ -191,7 +191,7 @@ - (void)addCustomProperties:(NSDictionary *)properties error:(NSError **)error { BOOL isAppClick = [self.eventId isEqualToString:kSAEventNameAppClick]; BOOL isViewScreen = [self.eventId isEqualToString:kSAEventNameAppViewScreen]; if (isAppClick || isViewScreen) { - self.lib.detail = [NSString stringWithFormat:@"%@######", properties[SA_EVENT_PROPERTY_SCREEN_NAME] ?: @""]; + self.lib.detail = [NSString stringWithFormat:@"%@######", properties[kSAEventPropertyScreenName] ?: @""]; } } diff --git a/SensorsAnalyticsSDK/Core/HookDelegate/SADelegateProxy.m b/SensorsAnalyticsSDK/Core/HookDelegate/SADelegateProxy.m index e0aedcb6..8a0122ef 100644 --- a/SensorsAnalyticsSDK/Core/HookDelegate/SADelegateProxy.m +++ b/SensorsAnalyticsSDK/Core/HookDelegate/SADelegateProxy.m @@ -26,7 +26,6 @@ #import "SAClassHelper.h" #import "SAMethodHelper.h" #import "SALog.h" -#import "SAAutoTrackProperty.h" #import "NSObject+DelegateProxy.h" #import diff --git a/SensorsAnalyticsSDK/Core/SAConstants+Private.h b/SensorsAnalyticsSDK/Core/SAConstants+Private.h index 569adf1a..ef9fad49 100644 --- a/SensorsAnalyticsSDK/Core/SAConstants+Private.h +++ b/SensorsAnalyticsSDK/Core/SAConstants+Private.h @@ -74,17 +74,17 @@ extern NSString * const SA_EVENT_PROPERTY_APP_INSTALL_FIRST_VISIT_TIME; #pragma mark--autoTrack property // App 浏览页面 Url -extern NSString * const SA_EVENT_PROPERTY_SCREEN_URL; +extern NSString * const kSAEventPropertyScreenUrl; // App 浏览页面 Referrer Url -extern NSString * const SA_EVENT_PROPERTY_SCREEN_REFERRER_URL; -extern NSString * const SA_EVENT_PROPERTY_ELEMENT_ID; -extern NSString * const SA_EVENT_PROPERTY_SCREEN_NAME; -extern NSString * const SA_EVENT_PROPERTY_TITLE; -extern NSString * const SA_EVENT_PROPERTY_ELEMENT_POSITION; -extern NSString * const SA_EVENT_PROPERTY_ELEMENT_SELECTOR; -extern NSString * const SA_EVENT_PROPERTY_ELEMENT_PATH; -extern NSString * const SA_EVENT_PROPERTY_ELEMENT_CONTENT; -extern NSString * const SA_EVENT_PROPERTY_ELEMENT_TYPE; +extern NSString * const kSAEventPropertyScreenReferrerUrl; +extern NSString * const kSAEventPropertyElementId; +extern NSString * const kSAEventPropertyScreenName; +extern NSString * const kSAEventPropertyTitle; +extern NSString * const kSAEventPropertyElementPosition; +extern NSString * const kSAEventPropertyElementSelector; +extern NSString * const kSAEventPropertyElementPath; +extern NSString * const kSAEventPropertyElementContent; +extern NSString * const kSAEventPropertyElementType; extern NSString * const SA_EVENT_PROPERTY_CHANNEL_INFO; extern NSString * const SA_EVENT_PROPERTY_CHANNEL_CALLBACK_EVENT; diff --git a/SensorsAnalyticsSDK/Core/SAConstants.m b/SensorsAnalyticsSDK/Core/SAConstants.m index 3c3c2beb..066443b7 100644 --- a/SensorsAnalyticsSDK/Core/SAConstants.m +++ b/SensorsAnalyticsSDK/Core/SAConstants.m @@ -76,21 +76,21 @@ NSString * const SA_EVENT_PROPERTY_APP_INSTALL_FIRST_VISIT_TIME = @"$first_visit_time"; #pragma mark - autoTrack property // App 浏览页面 Url -NSString * const SA_EVENT_PROPERTY_SCREEN_URL = @"$url"; +NSString * const kSAEventPropertyScreenUrl = @"$url"; // App 浏览页面 Referrer Url -NSString * const SA_EVENT_PROPERTY_SCREEN_REFERRER_URL = @"$referrer"; -NSString * const SA_EVENT_PROPERTY_ELEMENT_ID = @"$element_id"; -NSString * const SA_EVENT_PROPERTY_SCREEN_NAME = @"$screen_name"; -NSString * const SA_EVENT_PROPERTY_TITLE = @"$title"; -NSString * const SA_EVENT_PROPERTY_ELEMENT_POSITION = @"$element_position"; -NSString * const SA_EVENT_PROPERTY_ELEMENT_SELECTOR = @"$element_selector"; +NSString * const kSAEventPropertyScreenReferrerUrl = @"$referrer"; +NSString * const kSAEventPropertyElementId = @"$element_id"; +NSString * const kSAEventPropertyScreenName = @"$screen_name"; +NSString * const kSAEventPropertyTitle = @"$title"; +NSString * const kSAEventPropertyElementPosition = @"$element_position"; +NSString * const kSAEventPropertyElementSelector = @"$element_selector"; NSString * const kSAEeventPropertyReferrerTitle = @"$referrer_title"; // 模糊路径 -NSString * const SA_EVENT_PROPERTY_ELEMENT_PATH = @"$element_path"; -NSString * const SA_EVENT_PROPERTY_ELEMENT_CONTENT = @"$element_content"; -NSString * const SA_EVENT_PROPERTY_ELEMENT_TYPE = @"$element_type"; +NSString * const kSAEventPropertyElementPath = @"$element_path"; +NSString * const kSAEventPropertyElementContent = @"$element_content"; +NSString * const kSAEventPropertyElementType = @"$element_type"; NSString * const SA_EVENT_PROPERTY_CHANNEL_INFO = @"$channel_device_info"; NSString * const SA_EVENT_PROPERTY_CHANNEL_CALLBACK_EVENT = @"$is_channel_callback_event"; // 远程控制配置信息 diff --git a/SensorsAnalyticsSDK/Core/SAModuleManager.h b/SensorsAnalyticsSDK/Core/SAModuleManager.h index 4bbddc3f..4cd1206f 100644 --- a/SensorsAnalyticsSDK/Core/SAModuleManager.h +++ b/SensorsAnalyticsSDK/Core/SAModuleManager.h @@ -98,15 +98,13 @@ typedef NS_ENUM(NSUInteger, SAModuleType) { #pragma mark - -@interface SAModuleManager (Gesture) - -@property (nonatomic, strong, readonly) id gestureManager; +@interface SAModuleManager (Deeplink) @end #pragma mark - -@interface SAModuleManager (Deeplink) +@interface SAModuleManager (AutoTrack) @end diff --git a/SensorsAnalyticsSDK/Core/SAModuleManager.m b/SensorsAnalyticsSDK/Core/SAModuleManager.m index 74eaa1a5..41a8b655 100644 --- a/SensorsAnalyticsSDK/Core/SAModuleManager.m +++ b/SensorsAnalyticsSDK/Core/SAModuleManager.m @@ -39,7 +39,6 @@ static NSString * const kSAEncryptModuleName = @"Encrypt"; static NSString * const kSADeeplinkModuleName = @"Deeplink"; static NSString * const kSANotificationModuleName = @"AppPush"; -static NSString * const kSAGestureModuleName = @"Gesture"; static NSString * const kSAAutoTrackModuleName = @"AutoTrack"; @interface SAModuleManager () @@ -75,15 +74,12 @@ + (void)startWithConfigOptions:(SAConfigOptions *)configOptions debugMode:(Senso // 加密 [SAModuleManager.sharedInstance setEnable:configOptions.enableEncrypt forModule:kSAEncryptModuleName]; - // 手势采集 - if (NSClassFromString(@"SAGestureManager")) { - [SAModuleManager.sharedInstance setEnable:YES forModule:kSAGestureModuleName]; - } - // 默认加载全埋点模块,没有判断是否开启全埋点,原因如下: // 1. 同之前的逻辑保持一致 // 2. 保证添加对于生命周期的监听在生命周期类的实例化之前 - [SAModuleManager.sharedInstance setEnable:YES forModuleType:SAModuleTypeAutoTrack]; + if ([SAModuleManager.sharedInstance contains:SAModuleTypeAutoTrack] || configOptions.autoTrackEventType != SensorsAnalyticsEventTypeNone) { + [SAModuleManager.sharedInstance setEnable:YES forModuleType:SAModuleTypeAutoTrack]; + } } + (instancetype)sharedInstance { @@ -332,21 +328,6 @@ - (void)setLaunchOptions:(NSDictionary *)launchOptions { #pragma mark - -@implementation SAModuleManager (Gesture) - -- (id)gestureManager { - id manager = (id)self.modules[kSAGestureModuleName]; - return manager.isEnable ? manager : nil; -} - -- (BOOL)isGestureVisualView:(id)obj { - return [self.gestureManager isGestureVisualView:obj]; -} - -@end - -#pragma mark - - @implementation SAModuleManager (Deeplink) - (id)deeplinkManager { @@ -371,3 +352,18 @@ - (void)clearUtmProperties { } @end + +#pragma mark - + +@implementation SAModuleManager (AutoTrack) + +- (id)autoTrackManager { + id manager = (id)self.modules[kSAAutoTrackModuleName]; + return manager.isEnable ? manager : nil; +} + +- (void)trackAppEndWhenCrashed { + [self.autoTrackManager trackAppEndWhenCrashed]; +} + +@end diff --git a/SensorsAnalyticsSDK/Core/SAModuleProtocol.h b/SensorsAnalyticsSDK/Core/SAModuleProtocol.h index 8ab96366..28540af0 100644 --- a/SensorsAnalyticsSDK/Core/SAModuleProtocol.h +++ b/SensorsAnalyticsSDK/Core/SAModuleProtocol.h @@ -144,17 +144,6 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - -@protocol SAGestureModuleProtocol - -/// 校验可视化全埋点元素能否选中 -/// @param obj 控件元素 -/// @return 返回校验结果 -- (BOOL)isGestureVisualView:(id)obj; - -@end - -#pragma mark - - @protocol SADeeplinkModuleProtocol /// DeepLink 回调函数 @@ -175,4 +164,13 @@ NS_ASSUME_NONNULL_BEGIN @end +#pragma mark - + +@protocol SAAutoTrackModuleProtocol + +/// 触发 App 崩溃时的退出事件 +- (void)trackAppEndWhenCrashed; + +@end + NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/Core/SAReferrerManager.h b/SensorsAnalyticsSDK/Core/SAReferrerManager.h index 7399156a..e12028bf 100644 --- a/SensorsAnalyticsSDK/Core/SAReferrerManager.h +++ b/SensorsAnalyticsSDK/Core/SAReferrerManager.h @@ -25,14 +25,18 @@ NS_ASSUME_NONNULL_BEGIN @interface SAReferrerManager : NSObject -@property (nonatomic, assign) BOOL isClearReferrer; +@property (nonatomic, strong) dispatch_queue_t serialQueue; @property (nonatomic, assign) BOOL enableReferrerTitle; +@property (nonatomic, assign) BOOL isClearReferrer; @property (atomic, copy, readonly) NSDictionary *referrerProperties; @property (atomic, copy, readonly) NSString *referrerURL; @property (nonatomic, copy, readonly) NSString *referrerTitle; -- (NSDictionary *)propertiesWithURL:(NSString *)currentURL eventProperties:(NSDictionary *)eventProperties serialQueue:(dispatch_queue_t)serialQueue; ++ (instancetype)sharedInstance; + +- (NSDictionary *)propertiesWithURL:(NSString *)currentURL eventProperties:(NSDictionary *)eventProperties; + - (void)clearReferrer; @end diff --git a/SensorsAnalyticsSDK/Core/SAReferrerManager.m b/SensorsAnalyticsSDK/Core/SAReferrerManager.m index 9ab46bda..b4fc8c93 100644 --- a/SensorsAnalyticsSDK/Core/SAReferrerManager.m +++ b/SensorsAnalyticsSDK/Core/SAReferrerManager.m @@ -36,34 +36,43 @@ @interface SAReferrerManager () @implementation SAReferrerManager -- (NSDictionary *)propertiesWithURL:(NSString *)currentURL eventProperties:(NSDictionary *)eventProperties serialQueue:(dispatch_queue_t)serialQueue { ++ (instancetype)sharedInstance { + static dispatch_once_t onceToken; + static SAReferrerManager *manager = nil; + dispatch_once(&onceToken, ^{ + manager = [[SAReferrerManager alloc] init]; + }); + return manager; +} + +- (NSDictionary *)propertiesWithURL:(NSString *)currentURL eventProperties:(NSDictionary *)eventProperties { NSString *referrerURL = self.referrerURL; NSMutableDictionary *newProperties = [NSMutableDictionary dictionaryWithDictionary:eventProperties]; // 客户自定义属性中包含 $url 时,以客户自定义内容为准 - if (!newProperties[SA_EVENT_PROPERTY_SCREEN_URL]) { - newProperties[SA_EVENT_PROPERTY_SCREEN_URL] = currentURL; + if (!newProperties[kSAEventPropertyScreenUrl]) { + newProperties[kSAEventPropertyScreenUrl] = currentURL; } // 客户自定义属性中包含 $referrer 时,以客户自定义内容为准 - if (referrerURL && !newProperties[SA_EVENT_PROPERTY_SCREEN_REFERRER_URL]) { - newProperties[SA_EVENT_PROPERTY_SCREEN_REFERRER_URL] = referrerURL; + if (referrerURL && !newProperties[kSAEventPropertyScreenReferrerUrl]) { + newProperties[kSAEventPropertyScreenReferrerUrl] = referrerURL; } // $referrer 内容以最终页面浏览事件中的 $url 为准 - self.referrerURL = newProperties[SA_EVENT_PROPERTY_SCREEN_URL]; + self.referrerURL = newProperties[kSAEventPropertyScreenUrl]; self.referrerProperties = newProperties; - dispatch_async(serialQueue, ^{ - [self cacheReferrerTitle:newProperties]; - }); + if (self.enableReferrerTitle) { + dispatch_async(self.serialQueue, ^{ + [self cacheReferrerTitle:newProperties]; + }); + } + return newProperties; } - (void)cacheReferrerTitle:(NSDictionary *)properties { - if (!self.enableReferrerTitle) { - return; - } self.referrerTitle = self.currentTitle; - self.currentTitle = properties[SA_EVENT_PROPERTY_TITLE]; + self.currentTitle = properties[kSAEventPropertyTitle]; } - (void)clearReferrer { diff --git a/SensorsAnalyticsSDK/Core/SensorsAnalyticsExceptionHandler.m b/SensorsAnalyticsSDK/Core/SensorsAnalyticsExceptionHandler.m index adf0a548..64d773de 100644 --- a/SensorsAnalyticsSDK/Core/SensorsAnalyticsExceptionHandler.m +++ b/SensorsAnalyticsSDK/Core/SensorsAnalyticsExceptionHandler.m @@ -31,6 +31,7 @@ #import "SAConstants+Private.h" #import "SACommonUtility.h" #import "SensorsAnalyticsSDK+Private.h" +#import "SAModuleManager.h" #if defined(SENSORS_ANALYTICS_CRASH_SLIDEADDRESS) #import @@ -168,7 +169,7 @@ - (void) sa_handleUncaughtException:(NSException *)exception { if (instance.configOptions.enableTrackAppCrash) { NSMutableDictionary *properties = [[NSMutableDictionary alloc] init]; if ([exception callStackSymbols]) { - NSString *exceptionStack = [[exception callStackSymbols] componentsJoinedByString:@"\n"]; + NSString *exceptionStack = [[exception callStackSymbols] componentsJoinedByString:@"\n"]; #if defined(SENSORS_ANALYTICS_CRASH_SLIDEADDRESS) long slide_address = [SensorsAnalyticsExceptionHandler sa_computeImageSlide]; @@ -183,14 +184,10 @@ - (void) sa_handleUncaughtException:(NSException *)exception { SAPresetEventObject *object = [[SAPresetEventObject alloc] initWithEventId:kSAEventNameAppCrashed]; [instance asyncTrackEventObject:object properties:properties]; } - if (![instance isAutoTrackEventTypeIgnored:SensorsAnalyticsEventTypeAppEnd]) { - [SACommonUtility performBlockOnMainThread:^{ - if (UIApplication.sharedApplication.applicationState == UIApplicationStateActive) { - SAAutoTrackEventObject *eventObject = [[SAAutoTrackEventObject alloc] initWithEventId:kSAEventNameAppEnd]; - [instance asyncTrackEventObject:eventObject properties:nil]; - } - }]; - } + + // 触发退出事件 + [SAModuleManager.sharedInstance trackAppEndWhenCrashed]; + // 阻塞当前线程,完成 serialQueue 中数据相关的任务 sensorsdata_dispatch_safe_sync(instance.serialQueue, ^{}); } diff --git a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Private.h b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Private.h index 1139ddcb..c9928482 100644 --- a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Private.h +++ b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Private.h @@ -27,6 +27,7 @@ #import "SANetwork.h" #import "SAHTTPSession.h" #import "SATrackEventObject.h" +#import "SAAppLifecycle.h" @interface SensorsAnalyticsSDK(Private) @@ -43,22 +44,12 @@ + (SensorsAnalyticsSDK *)sdkInstance; #pragma mark - method -- (void)autoTrackViewScreen:(UIViewController *)viewController; /// 事件采集: 切换到 serialQueue 中执行 /// @param object 事件对象 /// @param properties 事件属性 - (void)asyncTrackEventObject:(SABaseEventObject *)object properties:(NSDictionary *)properties; -/** - 根据 viewController 判断,是否采集事件 - - @param controller 事件采集时的控制器 - @param type 事件类型 - @return 是否采集 - */ -- (BOOL)shouldTrackViewController:(UIViewController *)controller ofType:(SensorsAnalyticsAutoTrackEventType)type; - /** 向 WKWebView 注入 Message Handler @@ -72,15 +63,10 @@ #pragma mark - property @property (nonatomic, strong, readonly) SAConfigOptions *configOptions; @property (nonatomic, readonly, class) SAConfigOptions *configOptions; - @property (nonatomic, strong, readonly) SANetwork *network; -@property (nonatomic, weak) UIViewController *previousTrackViewController; - @end - - /** SAConfigOptions 实现 私有 property diff --git a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Public.h b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Public.h index d63dad76..0dae6ada 100644 --- a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Public.h +++ b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Public.h @@ -193,33 +193,11 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)trackAppCrash __attribute__((deprecated("已过时,请参考 SAConfigOptions 类的 enableTrackAppCrash"))); -/** - * @abstract - * 忽略某一类型的 View - * - * @param aClass View 对应的 Class - */ -- (void)ignoreViewType:(Class)aClass; -/** - * @abstract - * 判断某个 View 类型是否被忽略 - * - * @param aClass Class View 对应的 Class - * - * @return YES:被忽略; NO:没有被忽略 - */ -- (BOOL)isViewTypeIgnored:(Class)aClass; -/** - * @abstract - * 判断某个 ViewController 是否被忽略 - * - * @param viewController UIViewController - * - * @return YES:被忽略; NO:没有被忽略 - */ -- (BOOL)isViewControllerIgnored:(UIViewController *)viewController; + + + /** * @abstract @@ -318,8 +296,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)clearTrackTimer; -- (UIViewController *_Nullable)currentViewController; - #pragma mark track event /** * @abstract @@ -377,14 +353,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (NSString *)getCookieWithDecode:(BOOL)decode; -/** - * @abstract - * 在 AutoTrack 时,用户可以设置哪些 controllers 不被 AutoTrack - * - * @param controllers controller ‘字符串’数组 - */ -- (void)ignoreAutoTrackViewControllers:(NSArray *)controllers; - /** * @abstract * 获取 LastScreenUrl @@ -409,32 +377,6 @@ NS_ASSUME_NONNULL_BEGIN - (SensorsAnalyticsDebugMode)debugMode; -/** - * @abstract - * 通过代码触发 UIView 的 $AppClick 事件 - * - * @param view UIView - */ -- (void)trackViewAppClick:(nonnull UIView *)view; - -/** - * @abstract - * 通过代码触发 UIViewController 的 $AppViewScreen 事件 - * - * @param viewController 当前的 UIViewController - */ -- (void)trackViewScreen:(UIViewController *)viewController; -- (void)trackViewScreen:(UIViewController *)viewController properties:(nullable NSDictionary *)properties; - -/** - * @abstract - * 通过代码触发 UIView 的 $AppClick 事件 - * - * @param view UIView - * @param properties 自定义属性 - */ -- (void)trackViewAppClick:(nonnull UIView *)view withProperties:(nullable NSDictionary *)properties; - /** @abstract * Track App Extension groupIdentifier 中缓存的数据 @@ -1080,16 +1022,6 @@ DeepLink 回调函数 */ - (void)setDebugMode:(SensorsAnalyticsDebugMode)debugMode __attribute__((deprecated("已过时,建议动态开启调试模式"))); -/** - * @abstract - * 判断某个 ViewController 是否被忽略 - * - * @param viewControllerClassName UIViewController 类名 - * - * @return YES:被忽略; NO:没有被忽略 - */ -- (BOOL)isViewControllerStringIgnored:(NSString *)viewControllerClassName __attribute__((deprecated("已过时,请参考 -(BOOL)isViewControllerIgnored:(UIViewController *)viewController"))); - /** * @abstract * 提供一个接口,用来在用户注册的时候,用注册ID来替换用户以前的匿名ID @@ -1171,15 +1103,6 @@ DeepLink 回调函数 */ - (void)trackTimer:(NSString *)event withTimeUnit:(SensorsAnalyticsTimeUnit)timeUnit __attribute__((deprecated("已过时,请参考 trackTimerStart"))); -/** - * @abstract - * Track $AppViewScreen事件 - * - * @param url 当前页面url - * @param properties 用户扩展属性 - */ -- (void)trackViewScreen:(NSString *)url withProperties:(NSDictionary *)properties __attribute__((deprecated("已过时,请参考 trackViewScreen: properties:"))); - @end NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.h b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.h index b3a0a497..ab9029ac 100755 --- a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.h +++ b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.h @@ -25,7 +25,10 @@ #import "SASecurityPolicy.h" #import "SAConfigOptions.h" #import "SAConstants.h" + +#if __has_include("SensorsAnalyticsSDK+SAAutoTrack.h") #import "SensorsAnalyticsSDK+SAAutoTrack.h" +#endif #if __has_include("SensorsAnalyticsSDK+WKWebView.h") #import "SensorsAnalyticsSDK+WKWebView.h" @@ -38,72 +41,3 @@ #if __has_include("SensorsAnalyticsSDK+Visualized.h") #import "SensorsAnalyticsSDK+Visualized.h" #endif - -NS_ASSUME_NONNULL_BEGIN - -/** - * @abstract - * 在 DEBUG 模式下,发送错误时会抛出该异常 - */ -@interface SensorsAnalyticsDebugException : NSException - -@end - -@protocol SAUIViewAutoTrackDelegate - -//UITableView -@optional -- (NSDictionary *)sensorsAnalytics_tableView:(UITableView *)tableView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath; - -//UICollectionView -@optional -- (NSDictionary *)sensorsAnalytics_collectionView:(UICollectionView *)collectionView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath; -@end - -@interface UIImage (SensorsAnalytics) -@property (nonatomic, copy) NSString* sensorsAnalyticsImageName; -@end - -@interface UIView (SensorsAnalytics) -- (nullable UIViewController *)sensorsAnalyticsViewController __attribute__((deprecated("已过时"))); - -/// viewID -@property (nonatomic, copy) NSString* sensorsAnalyticsViewID; - -/// AutoTrack 时,是否忽略该 View -@property (nonatomic, assign) BOOL sensorsAnalyticsIgnoreView; - -/// AutoTrack 发生在 SendAction 之前还是之后,默认是 SendAction 之前 -@property (nonatomic, assign) BOOL sensorsAnalyticsAutoTrackAfterSendAction; - -/// AutoTrack 时,View 的扩展属性 -@property (nonatomic, strong) NSDictionary* sensorsAnalyticsViewProperties; - -@property (nonatomic, weak, nullable) id sensorsAnalyticsDelegate; -@end - - - -/** - * @abstract - * 自动追踪 (AutoTrack) 中,实现该 Protocal 的 Controller 对象可以通过接口向自动采集的事件中加入属性 - * - * @discussion - * 属性的约束请参考 track:withProperties: - */ -@protocol SAAutoTracker - -@required -- (NSDictionary *)getTrackProperties; - -@end - -@protocol SAScreenAutoTracker - -@required -- (NSString *)getScreenUrl; - -@end - -NS_ASSUME_NONNULL_END - diff --git a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m index dacc6e9a..206fa363 100755 --- a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m +++ b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m @@ -30,15 +30,12 @@ #import "SAJSONUtil.h" #import "SAGzipUtility.h" #import "SensorsAnalyticsSDK.h" -#import "UIApplication+AutoTrack.h" -#import "UIViewController+AutoTrack.h" #import "NSObject+DelegateProxy.h" #import "SASwizzle.h" #import "NSString+HashCode.h" #import "SensorsAnalyticsExceptionHandler.h" #import "SAURLUtils.h" #import "SAAppExtensionDataManager.h" -#import "SAAutoTrackUtils.h" #ifndef SENSORS_ANALYTICS_DISABLE_KEYCHAIN #import "SAKeyChainItemWrapper.h" @@ -47,7 +44,6 @@ #import #import "SARemoteConfigManager.h" -#import "UIView+AutoTrack.h" #import "SACommonUtility.h" #import "SAConstants+Private.h" #import "SensorsAnalyticsSDK+Private.h" @@ -75,80 +71,11 @@ #import "SAProfileEventObject.h" #import "SASuperProperty.h" -#define VERSION @"2.6.4" +#define VERSION @"2.6.5" void *SensorsAnalyticsQueueTag = &SensorsAnalyticsQueueTag; static dispatch_once_t sdkInitializeOnceToken; - -@implementation SensorsAnalyticsDebugException - -@end - -@implementation UIImage (SensorsAnalytics) -- (NSString *)sensorsAnalyticsImageName { - return objc_getAssociatedObject(self, @"sensorsAnalyticsImageName"); -} - -- (void)setSensorsAnalyticsImageName:(NSString *)sensorsAnalyticsImageName { - objc_setAssociatedObject(self, @"sensorsAnalyticsImageName", sensorsAnalyticsImageName, OBJC_ASSOCIATION_COPY_NONATOMIC); -} -@end - -@implementation UIView (SensorsAnalytics) - -- (UIViewController *)sensorsAnalyticsViewController { - return self.sensorsdata_viewController; -} - -//viewID -- (NSString *)sensorsAnalyticsViewID { - return objc_getAssociatedObject(self, @"sensorsAnalyticsViewID"); -} - -- (void)setSensorsAnalyticsViewID:(NSString *)sensorsAnalyticsViewID { - objc_setAssociatedObject(self, @"sensorsAnalyticsViewID", sensorsAnalyticsViewID, OBJC_ASSOCIATION_COPY_NONATOMIC); -} - -//ignoreView -- (BOOL)sensorsAnalyticsIgnoreView { - return [objc_getAssociatedObject(self, @"sensorsAnalyticsIgnoreView") boolValue]; -} - -- (void)setSensorsAnalyticsIgnoreView:(BOOL)sensorsAnalyticsIgnoreView { - objc_setAssociatedObject(self, @"sensorsAnalyticsIgnoreView", [NSNumber numberWithBool:sensorsAnalyticsIgnoreView], OBJC_ASSOCIATION_ASSIGN); -} - -//afterSendAction -- (BOOL)sensorsAnalyticsAutoTrackAfterSendAction { - return [objc_getAssociatedObject(self, @"sensorsAnalyticsAutoTrackAfterSendAction") boolValue]; -} - -- (void)setSensorsAnalyticsAutoTrackAfterSendAction:(BOOL)sensorsAnalyticsAutoTrackAfterSendAction { - objc_setAssociatedObject(self, @"sensorsAnalyticsAutoTrackAfterSendAction", [NSNumber numberWithBool:sensorsAnalyticsAutoTrackAfterSendAction], OBJC_ASSOCIATION_ASSIGN); -} - -//viewProperty -- (NSDictionary *)sensorsAnalyticsViewProperties { - return objc_getAssociatedObject(self, @"sensorsAnalyticsViewProperties"); -} - -- (void)setSensorsAnalyticsViewProperties:(NSDictionary *)sensorsAnalyticsViewProperties { - objc_setAssociatedObject(self, @"sensorsAnalyticsViewProperties", sensorsAnalyticsViewProperties, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -- (id)sensorsAnalyticsDelegate { - SAWeakPropertyContainer *container = objc_getAssociatedObject(self, @"sensorsAnalyticsDelegate"); - return container.weakProperty; -} - -- (void)setSensorsAnalyticsDelegate:(id)sensorsAnalyticsDelegate { - SAWeakPropertyContainer *container = [SAWeakPropertyContainer containerWithWeakProperty:sensorsAnalyticsDelegate]; - objc_setAssociatedObject(self, @"sensorsAnalyticsDelegate", container, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} -@end - - static SensorsAnalyticsSDK *sharedInstance = nil; @interface SensorsAnalyticsSDK() @@ -169,12 +96,6 @@ @interface SensorsAnalyticsSDK() @property (nonatomic, strong) NSTimer *timer; -//用户设置的不被AutoTrack的Controllers -@property (nonatomic, strong) NSMutableArray *ignoredViewControllers; -@property (nonatomic, weak) UIViewController *previousTrackViewController; - -@property (nonatomic, strong) NSMutableArray *ignoredViewTypeList; - // 兼容 UA 值打通逻辑,后续废弃 UA 值打通逻辑时可以全部移除 @property (atomic, copy) NSString *userAgent; @property (nonatomic, copy) NSString *addWebViewUserAgent; @@ -185,8 +106,6 @@ @interface SensorsAnalyticsSDK() @property (nonatomic, copy) BOOL (^trackEventCallback)(NSString *, NSMutableDictionary *); -@property (nonatomic, strong) NSMutableArray *launchedPassivelyControllers; - @property (nonatomic, strong) SAIdentifier *identifier; @property (nonatomic, strong) SAPresetProperty *presetProperty; @@ -197,8 +116,6 @@ @interface SensorsAnalyticsSDK() @property (nonatomic, strong) SAAppLifecycle *appLifecycle; -@property (nonatomic, strong) SAReferrerManager *referrerManager; - @end @implementation SensorsAnalyticsSDK { @@ -276,11 +193,9 @@ - (instancetype)initWithConfigOptions:(nonnull SAConfigOptions *)configOptions d _eventTracker = [[SAEventTracker alloc] initWithQueue:_serialQueue]; - _referrerManager =[[SAReferrerManager alloc] init]; - _referrerManager.enableReferrerTitle = configOptions.enableReferrerTitle; - - _ignoredViewControllers = [[NSMutableArray alloc] init]; - _ignoredViewTypeList = [[NSMutableArray alloc] init]; + [SAReferrerManager sharedInstance].serialQueue = _serialQueue; + [SAReferrerManager sharedInstance].enableReferrerTitle = configOptions.enableReferrerTitle; + _trackChannelEventNames = [[NSMutableSet alloc] init]; _trackTimer = [[SATrackTimer alloc] init]; @@ -373,38 +288,6 @@ + (UInt64)getSystemUpTime { return NSProcessInfo.processInfo.systemUptime * 1000; } -- (BOOL)shouldTrackViewController:(UIViewController *)controller ofType:(SensorsAnalyticsAutoTrackEventType)type { - if ([self isViewControllerIgnored:controller]) { - return NO; - } - - return ![self isBlackListViewController:controller ofType:type]; -} - -- (BOOL)isBlackListViewController:(UIViewController *)viewController ofType:(SensorsAnalyticsAutoTrackEventType)type { - static dispatch_once_t onceToken; - static NSDictionary *allClasses = nil; - dispatch_once(&onceToken, ^{ - NSBundle *sensorsBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[SensorsAnalyticsSDK class]] pathForResource:@"SensorsAnalyticsSDK" ofType:@"bundle"]]; - //文件路径 - NSString *jsonPath = [sensorsBundle pathForResource:@"sa_autotrack_viewcontroller_blacklist.json" ofType:nil]; - NSData *jsonData = [NSData dataWithContentsOfFile:jsonPath]; - @try { - allClasses = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:nil]; - } @catch(NSException *exception) { // json加载和解析可能失败 - SALogError(@"%@ error: %@", self, exception); - } - }); - - NSDictionary *dictonary = (type == SensorsAnalyticsEventTypeAppViewScreen) ? allClasses[kSAEventNameAppViewScreen] : allClasses[kSAEventNameAppClick]; - for (NSString *publicClass in dictonary[@"public"]) { - if ([viewController isKindOfClass:NSClassFromString(publicClass)]) { - return YES; - } - } - return [(NSArray *)dictonary[@"private"] containsObject:NSStringFromClass(viewController.class)]; -} - - (NSDictionary *)getPresetProperties { return [NSDictionary dictionaryWithDictionary:[self.presetProperty currentPresetProperties]]; } @@ -437,10 +320,6 @@ - (void)setFlushNetworkPolicy:(SensorsAnalyticsNetworkType)networkType { } } -- (UIViewController *)currentViewController { - return [SAAutoTrackUtils currentViewController]; -} - - (void)setMaxCacheSize:(UInt64)maxCacheSize { @synchronized(self) { //防止设置的值太小导致事件丢失 @@ -512,31 +391,6 @@ - (void)trackAppCrash { [[SensorsAnalyticsExceptionHandler sharedHandler] addSensorsAnalyticsInstance:self]; } -- (void)ignoreViewType:(Class)aClass { - [_ignoredViewTypeList addObject:aClass]; -} - -- (BOOL)isViewTypeIgnored:(Class)aClass { - for (Class obj in _ignoredViewTypeList) { - if ([aClass isSubclassOfClass:obj]) { - return YES; - } - } - return NO; -} - -- (BOOL)isViewControllerIgnored:(UIViewController *)viewController { - if (viewController == nil) { - return NO; - } - NSString *screenName = NSStringFromClass([viewController class]); - if (_ignoredViewControllers.count > 0 && [_ignoredViewControllers containsObject:screenName]) { - return YES; - } - - return NO; -} - - (void)showDebugInfoView:(BOOL)show { [SAModuleManager.sharedInstance setShowDebugAlertView:show]; } @@ -605,7 +459,7 @@ - (void)appLifecycleStateWillChange:(NSNotification *)sender { [self.trackTimer pauseAllEventTimers:currentSysUpTime]; }); // 清除 $referrer - [_referrerManager clearReferrer]; + [[SAReferrerManager sharedInstance] clearReferrer]; } } @@ -615,20 +469,8 @@ - (void)appLifecycleStateDidChange:(NSNotification *)sender { SAAppLifecycleState newState = [userInfo[kSAAppLifecycleNewStateKey] integerValue]; SAAppLifecycleState oldState = [userInfo[kSAAppLifecycleOldStateKey] integerValue]; - // 尝试上报启动事件(包括冷启动和热启动) - if (newState == SAAppLifecycleStateStart && ![self isAutoTrackEventTypeIgnored:SensorsAnalyticsEventTypeAppStart]) { - [self flush]; - } - // 热启动 if (oldState != SAAppLifecycleStateInit && newState == SAAppLifecycleStateStart) { - // track 被动启动的页面浏览 - if (self.launchedPassivelyControllers) { - [self.launchedPassivelyControllers enumerateObjectsUsingBlock:^(UIViewController * _Nonnull controller, NSUInteger idx, BOOL * _Nonnull stop) { - [self trackViewScreen:controller properties:nil autoTrack:YES]; - }]; - self.launchedPassivelyControllers = nil; - } // 开启定时器 [self startFlushTimer]; return; @@ -665,7 +507,6 @@ - (BOOL)canHandleURL:(NSURL *)url { [[SARemoteConfigManager sharedInstance] canHandleURL:url]; } - - (BOOL)handleSchemeUrl:(NSURL *)url { if (!url) { return NO; @@ -909,7 +750,7 @@ - (void)trackEventObject:(SABaseEventObject *)object properties:(NSDictionary *) } if (self.configOptions.enableReferrerTitle) { - [object addReferrerTitleProperty:self.referrerManager.referrerTitle]; + [object addReferrerTitleProperty:[SAReferrerManager sharedInstance].referrerTitle]; } // 5. 添加的自定义属性需要校验 @@ -1107,21 +948,6 @@ - (void)clearTrackTimer { }); } -- (void)ignoreAutoTrackViewControllers:(NSArray *)controllers { - if (controllers == nil || controllers.count == 0) { - return; - } - [_ignoredViewControllers addObjectsFromArray:controllers]; - - //去重 - NSSet *set = [NSSet setWithArray:_ignoredViewControllers]; - if (set != nil) { - _ignoredViewControllers = [NSMutableArray arrayWithArray:[set allObjects]]; - } else { - _ignoredViewControllers = [[NSMutableArray alloc] init]; - } -} - - (void)identify:(NSString *)anonymousId { dispatch_async(self.serialQueue, ^{ if (![self.identifier identify:anonymousId]) { @@ -1232,121 +1058,21 @@ - (void)stopFlushTimer { } - (NSString *)getLastScreenUrl { - return _referrerManager.referrerURL; + return [SAReferrerManager sharedInstance].referrerURL; } - (void)clearReferrerWhenAppEnd { - _referrerManager.isClearReferrer = YES; + [SAReferrerManager sharedInstance].isClearReferrer = YES; } - (NSDictionary *)getLastScreenTrackProperties { - return _referrerManager.referrerProperties; + return [SAReferrerManager sharedInstance].referrerProperties; } - (SensorsAnalyticsDebugMode)debugMode { return SAModuleManager.sharedInstance.debugMode; } -- (void)trackViewAppClick:(UIView *)view { - [self trackViewAppClick:view withProperties:nil]; -} - -- (void)trackViewAppClick:(UIView *)view withProperties:(NSDictionary *)p { - @try { - if (view == nil) { - return; - } - NSMutableDictionary *properties = [[NSMutableDictionary alloc]init]; - [properties addEntriesFromDictionary:[SAAutoTrackUtils propertiesWithAutoTrackObject:view isCodeTrack:YES]]; - if ([SAValidator isValidDictionary:p]) { - [properties addEntriesFromDictionary:p]; - } - - // 添加自定义属性 - [SAModuleManager.sharedInstance visualPropertiesWithView:view completionHandler:^(NSDictionary * _Nullable visualProperties) { - if (visualProperties) { - [properties addEntriesFromDictionary:visualProperties]; - } - SAPresetEventObject *object = [[SAPresetEventObject alloc] initWithEventId:kSAEventNameAppClick]; - [self asyncTrackEventObject:object properties:properties]; - }]; - } @catch (NSException *exception) { - SALogError(@"%@: %@", self, exception); - } -} - -- (void)autoTrackViewScreen:(UIViewController *)controller { - if (!controller) { - return; - } - //过滤用户设置的不被AutoTrack的Controllers - if (![self shouldTrackViewController:controller ofType:SensorsAnalyticsEventTypeAppViewScreen]) { - return; - } - - if (self.appLifecycle.state == SAAppLifecycleStateStartPassively) { - if (!self.launchedPassivelyControllers) { - self.launchedPassivelyControllers = [NSMutableArray array]; - } - [self.launchedPassivelyControllers addObject:controller]; - return; - } - - [self trackViewScreen:controller properties:nil autoTrack:YES]; -} - -- (void)trackViewScreen:(UIViewController *)controller { - [self trackViewScreen:controller properties:nil]; -} - -- (void)trackViewScreen:(UIViewController *)controller properties:(nullable NSDictionary *)properties { - [self trackViewScreen:controller properties:properties autoTrack:NO]; -} - -- (void)trackViewScreen:(UIViewController *)controller properties:(nullable NSDictionary *)properties autoTrack:(BOOL)autoTrack { - if (!controller) { - return; - } - - if ([self isBlackListViewController:controller ofType:SensorsAnalyticsEventTypeAppViewScreen]) { - return; - } - - NSMutableDictionary *eventProperties = [[NSMutableDictionary alloc] init]; - - NSDictionary *autoTrackProperties = [SAAutoTrackUtils propertiesWithViewController:controller]; - [eventProperties addEntriesFromDictionary:autoTrackProperties]; - - if (autoTrack) { - // App 通过 Deeplink 启动时第一个页面浏览事件会添加 utms 属性 - // 只需要处理全埋点的页面浏览事件 - [eventProperties addEntriesFromDictionary:SAModuleManager.sharedInstance.utmProperties]; - [SAModuleManager.sharedInstance clearUtmProperties]; - } - - if ([SAValidator isValidDictionary:properties]) { - [eventProperties addEntriesFromDictionary:properties]; - } - - NSString *currentURL; - if ([controller conformsToProtocol:@protocol(SAScreenAutoTracker)] && [controller respondsToSelector:@selector(getScreenUrl)]) { - UIViewController *screenAutoTrackerController = (UIViewController *)controller; - currentURL = [screenAutoTrackerController getScreenUrl]; - } - currentURL = [currentURL isKindOfClass:NSString.class] ? currentURL : NSStringFromClass(controller.class); - - // 添加 $url 和 $referrer 页面浏览相关属性 - NSDictionary *newProperties = [_referrerManager propertiesWithURL:currentURL eventProperties:eventProperties serialQueue:self.serialQueue]; - - SATrackEventObject *eventObject = nil; - if (autoTrack) { - eventObject = [[SAAutoTrackEventObject alloc] initWithEventId:kSAEventNameAppViewScreen]; - } else { - eventObject = [[SAPresetEventObject alloc] initWithEventId:kSAEventNameAppViewScreen]; - } - [self asyncTrackEventObject:eventObject properties:newProperties]; -} - - (void)trackEventFromExtensionWithGroupIdentifier:(NSString *)groupIdentifier completion:(void (^)(NSString *groupIdentifier, NSArray *events)) completion { @try { if (groupIdentifier == nil || [groupIdentifier isEqualToString:@""]) { @@ -1892,17 +1618,6 @@ - (void)setDebugMode:(SensorsAnalyticsDebugMode)debugMode { SAModuleManager.sharedInstance.debugMode = debugMode; } -- (BOOL)isViewControllerStringIgnored:(NSString *)viewControllerClassName { - if (viewControllerClassName == nil) { - return NO; - } - - if (_ignoredViewControllers.count > 0 && [_ignoredViewControllers containsObject:viewControllerClassName]) { - return YES; - } - return NO; -} - - (void)trackTimerBegin:(NSString *)event { [self trackTimerStart:event]; } @@ -1935,11 +1650,4 @@ - (void)trackSignUp:(NSString *)newDistinctId { [self trackSignUp:newDistinctId withProperties:nil]; } - -- (void)trackViewScreen:(NSString *)url withProperties:(NSDictionary *)properties { - NSDictionary *eventProperties = [_referrerManager propertiesWithURL:url eventProperties:properties serialQueue:self.serialQueue]; - SAPresetEventObject *object = [[SAPresetEventObject alloc] initWithEventId:kSAEventNameAppViewScreen]; - [self asyncTrackEventObject:object properties:eventProperties]; -} - @end diff --git a/SensorsAnalyticsSDK/Gesture/SAGestureManager.h b/SensorsAnalyticsSDK/Gesture/SAGestureManager.h deleted file mode 100644 index a4b50d83..00000000 --- a/SensorsAnalyticsSDK/Gesture/SAGestureManager.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// SAGestureManager.h -// SensorsAnalyticsSDK -// -// Created by yuqiang on 2021/3/3. -// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import -#import "SAModuleProtocol.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SAGestureManager : NSObject - -@property (nonatomic, assign, getter=isEnable) BOOL enable; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/Gesture/SAGestureManager.m b/SensorsAnalyticsSDK/Gesture/SAGestureManager.m deleted file mode 100644 index ede207b8..00000000 --- a/SensorsAnalyticsSDK/Gesture/SAGestureManager.m +++ /dev/null @@ -1,78 +0,0 @@ -// -// SAGestureManager.m -// SensorsAnalyticsSDK -// -// Created by yuqiang on 2021/3/3. -// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - -#import "SAGestureManager.h" -#import "SASwizzle.h" -#import "UIGestureRecognizer+SAAutoTrack.h" -#import "SAGestureViewProcessorFactory.h" - -@implementation SAGestureManager - -#pragma mark - SAModuleProtocol - -- (void)setEnable:(BOOL)enable { - _enable = enable; - - if (enable) { - [self enableAutoTrackGesture]; - } -} - -- (void)enableAutoTrackGesture { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [UIGestureRecognizer sa_swizzleMethod:@selector(initWithTarget:action:) - withMethod:@selector(sensorsdata_initWithTarget:action:) - error:NULL]; - [UIGestureRecognizer sa_swizzleMethod:@selector(addTarget:action:) - withMethod:@selector(sensorsdata_addTarget:action:) - error:NULL]; - [UIGestureRecognizer sa_swizzleMethod:@selector(removeTarget:action:) - withMethod:@selector(sensorsdata_removeTarget:action:) - error:NULL]; - }); -} - -#pragma mark - SAGestureModuleProtocol - -- (BOOL)isGestureVisualView:(id)obj { - if (!self.enable) { - return NO; - } - if (![obj isKindOfClass:UIView.class]) { - return NO; - } - UIView *view = (UIView *)obj; - for (UIGestureRecognizer *gesture in view.gestureRecognizers) { - if (gesture.sensorsdata_gestureTarget) { - SAGeneralGestureViewProcessor *processor = [SAGestureViewProcessorFactory processorWithGesture:gesture]; - if (processor.isTrackable && processor.trackableView == gesture.view) { - return YES; - } - } - } - return NO; -} - -@end diff --git a/SensorsAnalyticsSDK/SensorsAnalyticsSDK.bundle/sa_autotrack_viewcontroller_blacklist.json b/SensorsAnalyticsSDK/SensorsAnalyticsSDK.bundle/sa_autotrack_viewcontroller_blacklist.json index b2f4e0a1..c95bffcb 100644 --- a/SensorsAnalyticsSDK/SensorsAnalyticsSDK.bundle/sa_autotrack_viewcontroller_blacklist.json +++ b/SensorsAnalyticsSDK/SensorsAnalyticsSDK.bundle/sa_autotrack_viewcontroller_blacklist.json @@ -69,7 +69,10 @@ "SFPasswordRemoteViewController", "UIWebRotatingAlertController", "UIEditUserWordController", - "_UIContextMenuActionsOnlyViewController" + "_UIContextMenuActionsOnlyViewController", + "UIPredictionViewController", + "UISystemInputAssistantViewController", + "UICandidateViewController" ] }, "$AppClick": { diff --git a/SensorsAnalyticsSDK/Visualized/Config/SAVisualPropertiesConfigSources.m b/SensorsAnalyticsSDK/Visualized/Config/SAVisualPropertiesConfigSources.m index a24f85e8..96a4d3fa 100644 --- a/SensorsAnalyticsSDK/Visualized/Config/SAVisualPropertiesConfigSources.m +++ b/SensorsAnalyticsSDK/Visualized/Config/SAVisualPropertiesConfigSources.m @@ -150,8 +150,9 @@ - (void)requestConfigWithCompletionHandler:(SAVisualPropertiesConfigCompletionHa 200:正常请求并正确返回配置 304:如果本地配置和后端最新版本相同,则返回 304,同时配置为空 205:配置不存在(未创建可视化全埋点事件或运维关闭自定义属性),此时配置为空,返回 205 + 404:当前环境未包含此接口,可能 SA 版本比较低,暂不支持自定义属性 */ - BOOL success = statusCode == 200 || statusCode == 304 || statusCode == 205; + BOOL success = statusCode == 200 || statusCode == 304 || statusCode == 205 || statusCode == 404; SAVisualPropertiesResponse *config = nil; if (statusCode == 200) { @@ -181,12 +182,15 @@ - (void)requestConfigWithCompletionHandler:(SAVisualPropertiesConfigCompletionHa NSString *logMessage = [SAVisualizedLogger buildLoggerMessageWithTitle:@"获取配置" message:[NSString stringWithFormat:@"配置不存在(当前项目未创建可视化全埋点事件或运维关闭自定义属性),statusCode = %ld", (long)statusCode]]; SALogDebug(@"【request visualProperties config】%@", logMessage); - } else if (statusCode == 304) { // 未更新 - NSString *logMessage = [SAVisualizedLogger buildLoggerMessageWithTitle:@"获取配置" message:[NSString stringWithFormat:@"可视化全埋点配置未更新,statusCode = %ld", (long)statusCode]]; - SALogDebug(@"【request visualProperties config】%@", logMessage); } else if (statusCode > 200 && statusCode < 300) { NSString *logMessage = [SAVisualizedLogger buildLoggerMessageWithTitle:@"获取配置" message:[NSString stringWithFormat:@"请求配置异常,statusCode = %ld",(long)statusCode]]; SALogWarn(@"【request visualProperties config】%@", logMessage); + } else if (statusCode == 304) { // 未更新 + NSString *logMessage = [SAVisualizedLogger buildLoggerMessageWithTitle:@"获取配置" message:[NSString stringWithFormat:@"可视化全埋点配置未更新,statusCode = %ld", (long)statusCode]]; + SALogDebug(@"【request visualProperties config】%@", logMessage); + } else if (statusCode == 404) { + NSString *logMessage = [SAVisualizedLogger buildLoggerMessageWithTitle:@"获取配置" message:[NSString stringWithFormat:@"请求配置失败,当前环境可能暂不支持自定义属性,statusCode = %ld", (long)statusCode]]; + SALogDebug(@"【request visualProperties config】%@", logMessage); } else { NSString *logMessage = [SAVisualizedLogger buildLoggerMessageWithTitle:@"获取配置" message:[NSString stringWithFormat:@"请求配置出错,error: %@",error]]; SALogError(@"【request visualProperties config】%@", logMessage); diff --git a/SensorsAnalyticsSDK/Visualized/ElementPath/UIView+SAElementPath.m b/SensorsAnalyticsSDK/Visualized/ElementPath/UIView+SAElementPath.m index 4ef5facc..749e0b2c 100644 --- a/SensorsAnalyticsSDK/Visualized/ElementPath/UIView+SAElementPath.m +++ b/SensorsAnalyticsSDK/Visualized/ElementPath/UIView+SAElementPath.m @@ -364,7 +364,7 @@ - (NSString *)sensorsdata_screenName { if ([self sensorsdata_clickableForRNView]) { NSDictionary *screenProperties = [self sensorsdata_RNElementScreenProperties]; // 如果 ReactNative 页面信息为空,则使用 Native 的 - NSString *screenName = screenProperties[SA_EVENT_PROPERTY_SCREEN_NAME]; + NSString *screenName = screenProperties[kSAEventPropertyScreenName]; if (screenName) { return screenName; } @@ -373,7 +373,7 @@ - (NSString *)sensorsdata_screenName { // 解析 Native 元素页面信息 if (self.sensorsdata_viewController) { NSDictionary *autoTrackScreenProperties = [SAAutoTrackUtils propertiesWithViewController:self.sensorsdata_viewController]; - return autoTrackScreenProperties[SA_EVENT_PROPERTY_SCREEN_NAME]; + return autoTrackScreenProperties[kSAEventPropertyScreenName]; } return nil; } @@ -383,15 +383,15 @@ - (NSString *)sensorsdata_title { if ([self sensorsdata_clickableForRNView]) { NSDictionary *screenProperties = [self sensorsdata_RNElementScreenProperties]; // 如果 ReactNative 的 screenName 不存在,则判断页面信息不存在,即使用 Native 逻辑 - if (screenProperties[SA_EVENT_PROPERTY_SCREEN_NAME]) { - return screenProperties[SA_EVENT_PROPERTY_TITLE]; + if (screenProperties[kSAEventPropertyScreenName]) { + return screenProperties[kSAEventPropertyTitle]; } } // 处理 Native 元素 if (self.sensorsdata_viewController) { NSDictionary *autoTrackScreenProperties = [SAAutoTrackUtils propertiesWithViewController:self.sensorsdata_viewController]; - return autoTrackScreenProperties[SA_EVENT_PROPERTY_TITLE]; + return autoTrackScreenProperties[kSAEventPropertyTitle]; } return nil; } diff --git a/SensorsAnalyticsSDK/Visualized/ElementPath/UIViewController+SAElementPath.m b/SensorsAnalyticsSDK/Visualized/ElementPath/UIViewController+SAElementPath.m index 8c5ddffb..b513c3ba 100644 --- a/SensorsAnalyticsSDK/Visualized/ElementPath/UIViewController+SAElementPath.m +++ b/SensorsAnalyticsSDK/Visualized/ElementPath/UIViewController+SAElementPath.m @@ -29,6 +29,7 @@ #import "SensorsAnalyticsSDK+Private.h" #import "SAConstants+Private.h" #import "SAVisualizedObjectSerializerManger.h" +#import "SAAutoTrackManager.h" @implementation UIViewController (SAElementPath) @@ -102,7 +103,7 @@ - (void)sensorsdata_visualize_viewDidAppear:(BOOL)animated { } - (void)sensorsdata_readyEnterViewController { - if (![[SensorsAnalyticsSDK sharedInstance] shouldTrackViewController:self ofType:SensorsAnalyticsEventTypeAppViewScreen]) { + if (![[SAAutoTrackManager sharedInstance].appViewScreenTracker shouldTrackViewController:self]) { return; } // 保存最后一次页面浏览所在的 controller,用于可视化全埋点定义页面浏览 diff --git a/SensorsAnalyticsSDK/Visualized/EventCheck/SAEventIdentifier.m b/SensorsAnalyticsSDK/Visualized/EventCheck/SAEventIdentifier.m index 34ed6b1d..d2966e87 100644 --- a/SensorsAnalyticsSDK/Visualized/EventCheck/SAEventIdentifier.m +++ b/SensorsAnalyticsSDK/Visualized/EventCheck/SAEventIdentifier.m @@ -45,10 +45,10 @@ - (instancetype)initWithEventInfo:(NSDictionary *)eventInfo { + (NSDictionary *)eventIdentifierDicWithEventInfo:(NSDictionary *)eventInfo { NSMutableDictionary *eventInfoDic = [NSMutableDictionary dictionary]; - eventInfoDic[@"element_path"] = eventInfo[@"properties"][SA_EVENT_PROPERTY_ELEMENT_PATH]; - eventInfoDic[@"element_position"] = eventInfo[@"properties"][SA_EVENT_PROPERTY_ELEMENT_POSITION]; - eventInfoDic[@"element_content"] = eventInfo[@"properties"][SA_EVENT_PROPERTY_ELEMENT_CONTENT]; - eventInfoDic[@"screen_name"] = eventInfo[@"properties"][SA_EVENT_PROPERTY_SCREEN_NAME]; + eventInfoDic[@"element_path"] = eventInfo[@"properties"][kSAEventPropertyElementPath]; + eventInfoDic[@"element_position"] = eventInfo[@"properties"][kSAEventPropertyElementPosition]; + eventInfoDic[@"element_content"] = eventInfo[@"properties"][kSAEventPropertyElementContent]; + eventInfoDic[@"screen_name"] = eventInfo[@"properties"][kSAEventPropertyScreenName]; return eventInfoDic; } @end diff --git a/SensorsAnalyticsSDK/Visualized/SAVisualizedAbstractMessage.m b/SensorsAnalyticsSDK/Visualized/SAVisualizedAbstractMessage.m index 986b7fff..20d05691 100644 --- a/SensorsAnalyticsSDK/Visualized/SAVisualizedAbstractMessage.m +++ b/SensorsAnalyticsSDK/Visualized/SAVisualizedAbstractMessage.m @@ -106,16 +106,16 @@ - (NSData *)JSONDataWithFeatureCode:(NSString *)featureCode { // 解析页面信息 NSDictionary *autoTrackScreenProperties = [SAAutoTrackUtils propertiesWithViewController:currentViewController]; - screenName = autoTrackScreenProperties[SA_EVENT_PROPERTY_SCREEN_NAME]; - pageName = autoTrackScreenProperties[SA_EVENT_PROPERTY_SCREEN_NAME]; - title = autoTrackScreenProperties[SA_EVENT_PROPERTY_TITLE]; + screenName = autoTrackScreenProperties[kSAEventPropertyScreenName]; + pageName = autoTrackScreenProperties[kSAEventPropertyScreenName]; + title = autoTrackScreenProperties[kSAEventPropertyTitle]; // 获取 RN 页面信息 NSDictionary *RNScreenInfo = [SAVisualizedUtils currentRNScreenVisualizeProperties]; - if (RNScreenInfo[SA_EVENT_PROPERTY_SCREEN_NAME]) { - pageName = RNScreenInfo[SA_EVENT_PROPERTY_SCREEN_NAME]; - screenName = RNScreenInfo[SA_EVENT_PROPERTY_SCREEN_NAME]; - title = RNScreenInfo[SA_EVENT_PROPERTY_TITLE]; + if (RNScreenInfo[kSAEventPropertyScreenName]) { + pageName = RNScreenInfo[kSAEventPropertyScreenName]; + screenName = RNScreenInfo[kSAEventPropertyScreenName]; + title = RNScreenInfo[kSAEventPropertyTitle]; } } @catch (NSException *exception) { SALogError(@"%@ error: %@", self, exception); diff --git a/SensorsAnalyticsSDK/Visualized/SAVisualizedManager.m b/SensorsAnalyticsSDK/Visualized/SAVisualizedManager.m index e1c62434..0c237680 100644 --- a/SensorsAnalyticsSDK/Visualized/SAVisualizedManager.m +++ b/SensorsAnalyticsSDK/Visualized/SAVisualizedManager.m @@ -310,8 +310,8 @@ - (nullable NSDictionary *)propertiesWithView:(UIView *)view { NSString *elementPath = [SAVisualizedUtils viewSimilarPathForView:view atViewController:viewController shouldSimilarPath:YES]; NSMutableDictionary *viewPthProperties = [NSMutableDictionary dictionary]; - viewPthProperties[SA_EVENT_PROPERTY_ELEMENT_SELECTOR] = elementSelector; - viewPthProperties[SA_EVENT_PROPERTY_ELEMENT_PATH] = elementPath; + viewPthProperties[kSAEventPropertyElementSelector] = elementSelector; + viewPthProperties[kSAEventPropertyElementPath] = elementPath; return viewPthProperties.count > 0 ? viewPthProperties : nil; } diff --git a/SensorsAnalyticsSDK/Visualized/SAVisualizedUtils.m b/SensorsAnalyticsSDK/Visualized/SAVisualizedUtils.m index 6b2e99a7..716fb4b6 100644 --- a/SensorsAnalyticsSDK/Visualized/SAVisualizedUtils.m +++ b/SensorsAnalyticsSDK/Visualized/SAVisualizedUtils.m @@ -300,7 +300,7 @@ + (BOOL)isIgnoreSubviewsWithView:(UIView *)view { return YES; } - // 普通 view,非响应事假元素,一般继续遍历子元素 + // 普通 view,非响应事件独立元素,一般继续遍历子元素 if (![view isKindOfClass:UIControl.class]) { return NO; } diff --git a/SensorsAnalyticsTests/AutoTrack/SAAutoTrackUtilsTest.m b/SensorsAnalyticsTests/AutoTrack/SAAutoTrackUtilsTest.m index 8335bd07..6a9c88eb 100644 --- a/SensorsAnalyticsTests/AutoTrack/SAAutoTrackUtilsTest.m +++ b/SensorsAnalyticsTests/AutoTrack/SAAutoTrackUtilsTest.m @@ -25,7 +25,6 @@ #import "SAAutoTrackUtils.h" #import "ElementViewController.h" #import "UIView+AutoTrack.h" -//#import "UIViewController+AutoTrack.h" #import "UIViewController+AutoTrack.h" @interface SAAutoTrackUtilsTest : XCTestCase