Commit 8dcf4a68 authored by 翟国钧's avatar 翟国钧

增加了对pv事件的统计

parent aee43e6f
...@@ -28,7 +28,7 @@ PODS: ...@@ -28,7 +28,7 @@ PODS:
- GMLibrary/Network (0.0.1): - GMLibrary/Network (0.0.1):
- AFNetworking (~> 2.6.1) - AFNetworking (~> 2.6.1)
- GMLibrary/Cache (~> 0.0.1) - GMLibrary/Cache (~> 0.0.1)
- GMPhobos (0.0.7): - GMPhobos (0.0.9):
- GMLibrary (~> 0.0.1) - GMLibrary (~> 0.0.1)
- TMCache (2.1.0) - TMCache (2.1.0)
...@@ -37,12 +37,12 @@ DEPENDENCIES: ...@@ -37,12 +37,12 @@ DEPENDENCIES:
EXTERNAL SOURCES: EXTERNAL SOURCES:
GMPhobos: GMPhobos:
:path: "../" :path: ../
SPEC CHECKSUMS: SPEC CHECKSUMS:
AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60 AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60
GMLibrary: c31039ad32bc93f866d6c3052c20acb8cf9c1568 GMLibrary: c31039ad32bc93f866d6c3052c20acb8cf9c1568
GMPhobos: 0deddf9803485afce92be86985e9d13f045b2ccd GMPhobos: d4797474f9cdedb989d421ab9f8b6b9461e75e3d
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
COCOAPODS: 0.39.0 COCOAPODS: 0.39.0
{ {
"name": "GMPhobos", "name": "GMPhobos",
"version": "0.0.7", "version": "0.0.9",
"summary": "GM statistic data sdk", "summary": "GM statistic data sdk",
"description": "GM event track sdk.", "description": "GM event track sdk.",
"homepage": "http://git.gengmei.cc/gengmeiios/GMPhobos", "homepage": "http://git.gengmei.cc/gengmeiios/GMPhobos",
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
}, },
"source": { "source": {
"git": "http://git.gengmei.cc/gengmeiios/GMPhobos.git", "git": "http://git.gengmei.cc/gengmeiios/GMPhobos.git",
"tag": "0.0.7" "tag": "0.0.9"
}, },
"platforms": { "platforms": {
"ios": "7.0" "ios": "7.0"
......
...@@ -28,7 +28,7 @@ PODS: ...@@ -28,7 +28,7 @@ PODS:
- GMLibrary/Network (0.0.1): - GMLibrary/Network (0.0.1):
- AFNetworking (~> 2.6.1) - AFNetworking (~> 2.6.1)
- GMLibrary/Cache (~> 0.0.1) - GMLibrary/Cache (~> 0.0.1)
- GMPhobos (0.0.7): - GMPhobos (0.0.9):
- GMLibrary (~> 0.0.1) - GMLibrary (~> 0.0.1)
- TMCache (2.1.0) - TMCache (2.1.0)
...@@ -37,12 +37,12 @@ DEPENDENCIES: ...@@ -37,12 +37,12 @@ DEPENDENCIES:
EXTERNAL SOURCES: EXTERNAL SOURCES:
GMPhobos: GMPhobos:
:path: "../" :path: ../
SPEC CHECKSUMS: SPEC CHECKSUMS:
AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60 AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60
GMLibrary: c31039ad32bc93f866d6c3052c20acb8cf9c1568 GMLibrary: c31039ad32bc93f866d6c3052c20acb8cf9c1568
GMPhobos: 0deddf9803485afce92be86985e9d13f045b2ccd GMPhobos: d4797474f9cdedb989d421ab9f8b6b9461e75e3d
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
COCOAPODS: 0.39.0 COCOAPODS: 0.39.0
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
buildForArchiving = "YES"> buildForArchiving = "YES">
<BuildableReference <BuildableReference
BuildableIdentifier = 'primary' BuildableIdentifier = 'primary'
BlueprintIdentifier = '1E27E082AA9394BADBC763A5' BlueprintIdentifier = '3F6B435A89A4195E324BCFAD'
BlueprintName = 'GMPhobos' BlueprintName = 'GMPhobos'
ReferencedContainer = 'container:Pods.xcodeproj' ReferencedContainer = 'container:Pods.xcodeproj'
BuildableName = 'GMPhobos.framework'> BuildableName = 'GMPhobos.framework'>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.0.7</string> <string>0.0.9</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "GMPhobos" s.name = "GMPhobos"
s.version = "0.0.8" s.version = "0.0.9"
s.summary = "GM statistic data sdk" s.summary = "GM statistic data sdk"
# This description is used to generate tags and improve search results. # This description is used to generate tags and improve search results.
...@@ -26,7 +26,7 @@ Pod::Spec.new do |s| ...@@ -26,7 +26,7 @@ Pod::Spec.new do |s|
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT' s.license = 'MIT'
s.author = { "licong" => "licong@gmei.com" } s.author = { "licong" => "licong@gmei.com" }
s.source = { :git => "http://git.gengmei.cc/gengmeiios/GMPhobos.git", :tag => "0.0.8" } s.source = { :git => "http://git.gengmei.cc/gengmeiios/GMPhobos.git", :tag => "0.0.9" }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.platform = :ios, '7.0' s.platform = :ios, '7.0'
......
...@@ -74,19 +74,17 @@ ...@@ -74,19 +74,17 @@
* *
* @param pageName 页面唯一编码 * @param pageName 页面唯一编码
* @param businessId 页面中的业务ID,比如美购详情页美购ID * @param businessId 页面中的业务ID,比如美购详情页美购ID
* @param refererPageName 目标页面的上一个页面的pageName
* *
* @since 0.0.8 * @since 0.0.8
*/ */
- (void)onPageStart:(NSString *)pageName businessId:(NSString *)businessId; - (void)onPageStart:(NSString *)pageName businessId:(NSString *)businessId referer:(NSString *)refererPageName;
/** /**
* @brief 当页面结束时的PV处理 * @brief 当页面结束时的PV处理,在此方法中记录当前页面的停留时间和记录本次埋点事件
*
* @param pageName 页面唯一编码
* @param businessId 页面中的业务ID,比如美购详情页美购ID
* *
* @since 0.0.8 * @since 0.0.8
*/ */
- (void)onPageEnd:(NSString *)pageName; - (void)onPageEnd;
@end @end
...@@ -30,6 +30,7 @@ static NSString *sdkVersion = @"110"; ...@@ -30,6 +30,7 @@ static NSString *sdkVersion = @"110";
@property (strong, nonatomic) NSString *pageName; @property (strong, nonatomic) NSString *pageName;
@property (strong, nonatomic) NSString *pageEnterTime; @property (strong, nonatomic) NSString *pageEnterTime;
@property (strong, nonatomic) NSString *pageExitTime; @property (strong, nonatomic) NSString *pageExitTime;
@property (strong, nonatomic) NSMutableDictionary *pageEnterParam;
@end @end
...@@ -216,16 +217,34 @@ static NSString *sdkVersion = @"110"; ...@@ -216,16 +217,34 @@ static NSString *sdkVersion = @"110";
} }
#pragma - mark pv #pragma - mark pv
- (void)onPageStart:(NSString *)pageName businessId:(NSString *)businessId{ - (void)onPageStart:(NSString *)pageName businessId:(NSString *)businessId referer:(NSString *)refererPageName{
double enterTime = [[NSDate date] timeIntervalSince1970];
Please register or sign in to reply
_pageEnterParam = [NSMutableDictionary dictionaryWithObjectsAndKeys:
pageName,@"page_name",
businessId,@"business_id",
refererPageName,@"referer",
@(enterTime),@"in",nil];
} }
- (void)onPageEnd{
- (void)onPageEnd:(NSString *)pageName{ double exitTime = [[NSDate date] timeIntervalSince1970];
Please register or sign in to reply
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
@try {
[dict setObject:@(exitTime) forKey:@"out"];
[dict setObject:@([_pageEnterParam[@"in"] doubleValue]) forKey:@"in"];
[dict setObject:_pageEnterParam[@"page_name"] forKey:@"page_name"];
[dict setObject:_pageEnterParam[@"business_id"] forKey:@"business_id"];
[dict setObject:_pageEnterParam[@"referer"] forKey:@"referer"];
[dict setObject:@(NO) forKey:@"fake"];
[self track:@"PV" attributes:dict];
Please register or sign in to reply
[_pageEnterParam removeAllObjects];
}
@catch (NSException *exception) {
phobosLog(exception);
}
} }
/** /**
* @brief 将埋点时间封装成词典数据 * @brief 将埋点时间封装成词典数据
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment