Ta android + ios

This commit is contained in:
LYP
2024-08-07 20:22:28 +08:00
parent 69fee08c61
commit 76458664d8
722 changed files with 41709 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
//
// TAAppEndEvent.h
// ThinkingSDK
//
// Created by Yangxiongon 2022/6/17.
//
#import "TAAutoTrackEvent.h"
NS_ASSUME_NONNULL_BEGIN
@interface TAAppEndEvent : TAAutoTrackEvent
@property (nonatomic, copy) NSString *screenName;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 40a6155cb5c236b4b8087a56f07b6b99
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,23 @@
//
// TAAppEndEvent.m
// ThinkingSDK
//
// Created by Yangxiongon 2022/6/17.
//
#import "TAAppEndEvent.h"
#import "TDPresetProperties+TDDisProperties.h"
@implementation TAAppEndEvent
- (NSMutableDictionary *)jsonObject {
NSMutableDictionary *dict = [super jsonObject];
if (![TDPresetProperties disableScreenName]) {
self.properties[@"#screen_name"] = self.screenName ?: @"";
}
return dict;
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 70f1894193c33dd49b8c7a95f3483903
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
//
// TAAppStartEvent.h
// ThinkingSDK
//
// Created by Yangxiongon 2022/6/17.
//
#import "TAAutoTrackEvent.h"
NS_ASSUME_NONNULL_BEGIN
@interface TAAppStartEvent : TAAutoTrackEvent
@property (nonatomic, copy) NSString *startReason;
@property (nonatomic, assign) BOOL resumeFromBackground;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 10585deadfd0a0b41b8af66b473a82d1
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,27 @@
//
// TAAppStartEvent.m
// ThinkingSDK
//
// Created by Yangxiongon 2022/6/17.
//
#import "TAAppStartEvent.h"
#import <CoreGraphics/CoreGraphics.h>
#import "TDPresetProperties+TDDisProperties.h"
@implementation TAAppStartEvent
- (NSMutableDictionary *)jsonObject {
NSMutableDictionary *dict = [super jsonObject];
if (![TDPresetProperties disableResumeFromBackground]) {
self.properties[@"#resume_from_background"] = @(self.resumeFromBackground);
}
if (![TDPresetProperties disableStartReason]) {
self.properties[@"#start_reason"] = self.startReason;
}
return dict;
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 7dc79746c3bbc9e448ed4c906d915101
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,22 @@
//
// TAAutoClickEvent.h
// ThinkingSDK
//
// Created by Yangxiongon 2022/6/15.
//
#import "TAAutoTrackEvent.h"
NS_ASSUME_NONNULL_BEGIN
@interface TAAutoClickEvent : TAAutoTrackEvent
@property (nonatomic, copy) NSString *elementId;
@property (nonatomic, copy) NSString *elementContent;
@property (nonatomic, copy) NSString *elementType;
@property (nonatomic, copy) NSString *elementPosition;
@property (nonatomic, copy) NSString *pageTitle;
@property (nonatomic, copy) NSString *screenName;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: de4bf411c264c504a864d1110c8edb45
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,38 @@
//
// TAAutoClickEvent.m
// ThinkingSDK
//
// Created by Yangxiongon 2022/6/15.
//
#import "TAAutoClickEvent.h"
#import "TDPresetProperties+TDDisProperties.h"
@implementation TAAutoClickEvent
- (NSMutableDictionary *)jsonObject {
NSMutableDictionary *dict = [super jsonObject];
if (![TDPresetProperties disableScreenName]) {
self.properties[@"#screen_name"] = self.screenName;
}
if (![TDPresetProperties disableElementId]) {
self.properties[@"#element_id"] = self.elementId;
}
if (![TDPresetProperties disableElementType]) {
self.properties[@"#element_type"] = self.elementType;
}
if (![TDPresetProperties disableElementContent]) {
self.properties[@"#element_content"] = self.elementContent;
}
if (![TDPresetProperties disableElementPosition]) {
self.properties[@"#element_position"] = self.elementPosition;
}
if (![TDPresetProperties disableTitle]) {
self.properties[@"#title"] = self.pageTitle;
}
return dict;
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 6822b7c6562f6234992a3529f37709f0
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
//
// TAAutoPageViewEvent.h
// ThinkingSDK
//
// Created by Yangxiongon 2022/6/15.
//
#import "TAAutoTrackEvent.h"
NS_ASSUME_NONNULL_BEGIN
@interface TAAutoPageViewEvent : TAAutoTrackEvent
@property (nonatomic, copy) NSString *pageUrl;
@property (nonatomic, copy) NSString *referrer;
@property (nonatomic, copy) NSString *pageTitle;
@property (nonatomic, copy) NSString *screenName;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: f3496858b20c04445b91102798553dc1
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
//
// TAAutoPageViewEvent.m
// ThinkingSDK
//
// Created by Yangxiongon 2022/6/15.
//
#import "TAAutoPageViewEvent.h"
#import "TDPresetProperties+TDDisProperties.h"
@implementation TAAutoPageViewEvent
- (NSMutableDictionary *)jsonObject {
NSMutableDictionary *dict = [super jsonObject];
if (![TDPresetProperties disableScreenName]) {
self.properties[@"#screen_name"] = self.screenName;
}
if (![TDPresetProperties disableTitle]) {
self.properties[@"#title"] = self.pageTitle;
}
if (![TDPresetProperties disableUrl]) {
self.properties[@"#url"] = self.pageUrl;
}
if (![TDPresetProperties disableReferrer]) {
self.properties[@"#referrer"] = self.referrer;
}
return dict;
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 80c9b30ac6f8e9f4793c4c456666088f
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
//
// TAAutoTrackEvent.h
// ThinkingSDK
//
// Created by Yangxiongon 2022/6/15.
//
#import "TATrackEvent.h"
#import "TDConstant.h"
NS_ASSUME_NONNULL_BEGIN
@interface TAAutoTrackEvent : TATrackEvent
/// It is used to record the dynamic public properties of automatic collection events. The dynamic public properties need to be obtained in the current thread where the event occurs
@property (nonatomic, strong) NSDictionary *autoDynamicSuperProperties;
/// Static public property for logging autocollection events
@property (nonatomic, strong) NSDictionary *autoSuperProperties;
/// Returns the automatic collection type
- (ThinkingAnalyticsAutoTrackEventType)autoTrackEventType;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 3090a87679ab84a4abee1eec9aad1b89
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,58 @@
//
// TAAutoTrackEvent.m
// ThinkingSDK
//
// Created by Yangxiongon 2022/6/15.
//
#import "TAAutoTrackEvent.h"
#import "ThinkingAnalyticsSDKPrivate.h"
#import "TDPresetProperties+TDDisProperties.h"
@implementation TAAutoTrackEvent
- (NSMutableDictionary *)jsonObject {
NSMutableDictionary *dict = [super jsonObject];
// Reprocess the duration of automatic collection events, mainly app_start, app_end
// app_start app_end events are collected by the automatic collection management class. There are the following problems: the automatic collection management class and the timeTracker event duration management class are processed by listening to appLifeCycle notifications, so they are not at a precise and unified time point. There will be small errors that need to be eliminated.
// After testing, the error is less than 0.01s.
CGFloat minDuration = 0.01;
if (![TDPresetProperties disableDuration]) {
if (self.foregroundDuration > minDuration) {
self.properties[@"#duration"] = @([NSString stringWithFormat:@"%.3f", self.foregroundDuration].floatValue);
}
}
if (![TDPresetProperties disableBackgroundDuration]) {
if (self.backgroundDuration > minDuration) {
self.properties[@"#background_duration"] = @([NSString stringWithFormat:@"%.3f", self.backgroundDuration].floatValue);
}
}
return dict;
}
- (ThinkingAnalyticsAutoTrackEventType)autoTrackEventType {
if ([self.eventName isEqualToString:TD_APP_START_EVENT]) {
return ThinkingAnalyticsEventTypeAppStart;
} else if ([self.eventName isEqualToString:TD_APP_START_BACKGROUND_EVENT]) {
return ThinkingAnalyticsEventTypeAppStart;
} else if ([self.eventName isEqualToString:TD_APP_END_EVENT]) {
return ThinkingAnalyticsEventTypeAppEnd;
} else if ([self.eventName isEqualToString:TD_APP_VIEW_EVENT]) {
return ThinkingAnalyticsEventTypeAppViewScreen;
} else if ([self.eventName isEqualToString:TD_APP_CLICK_EVENT]) {
return ThinkingAnalyticsEventTypeAppClick;
} else if ([self.eventName isEqualToString:TD_APP_CRASH_EVENT]) {
return ThinkingAnalyticsEventTypeAppViewCrash;
} else if ([self.eventName isEqualToString:TD_APP_INSTALL_EVENT]) {
return ThinkingAnalyticsEventTypeAppInstall;
} else {
return ThinkingAnalyticsEventTypeNone;
}
}
- (void)ta_validateKey:(NSString *)key value:(id)value error:(NSError *__autoreleasing _Nullable *)error {
[TAPropertyValidator validateAutoTrackEventPropertyKey:key value:value error:error];
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: b29666e1c445d994991de96212385d20
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
//
// TAPushClickEvent.h
// ThinkingSDK
//
// Created by liulongbing on 2023/5/31.
//
#import "TAAutoTrackEvent.h"
NS_ASSUME_NONNULL_BEGIN
@interface TAPushClickEvent : TAAutoTrackEvent
@property (nonatomic, strong) NSDictionary *ops;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: fec359995ca52d242b7b0857f45a3b4d
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
//
// TAPushClickEvent.m
// ThinkingSDK
//
// Created by liulongbing on 2023/5/31.
//
#import "TAPushClickEvent.h"
@implementation TAPushClickEvent
- (NSMutableDictionary *)jsonObject {
NSMutableDictionary *dict = [super jsonObject];
self.properties[@"#ops_receipt_properties"] = self.ops;
return dict;
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: d30d06823cd9afb49b3635a39a6adcf5
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant: