Commit 028a0352 authored by lufei's avatar lufei

modify:添加埋点

parent 18b33d2d
...@@ -37,5 +37,6 @@ TODO: Add long description of the pod here. ...@@ -37,5 +37,6 @@ TODO: Add long description of the pod here.
} }
s.framework = 'UIKit' s.framework = 'UIKit'
s.dependency = 'DZUserTracker', :git => 'git@gitlab.wanwudezhi.work:AppBase/DZUserTracker.git'
end end
...@@ -93,6 +93,20 @@ typedef void(^DZXCarouselPageWillShowBlock)(NSInteger index, id data); ...@@ -93,6 +93,20 @@ typedef void(^DZXCarouselPageWillShowBlock)(NSInteger index, id data);
/// 内容视图圆角 /// 内容视图圆角
@property (nonatomic, assign) CGFloat cornerRadius; @property (nonatomic, assign) CGFloat cornerRadius;
/// 埋点 track_rtpKey_
@property(nonatomic, copy) NSString *track_rtpKey_;
/// 埋点 track_extInfo_
@property(nonatomic, copy) NSDictionary *track_extInfo_;
@end
@protocol DZXCarouselViewDelegate <NSObject>
// 埋点 track_rtpKey_
- (NSString *)DZXCarouselView_track_rtpKey_atIndex:(NSInteger)index;
// 埋点 track_extInfo_
- (NSDictionary *)DZXCarouselView_track_extInfo_atIndex:(NSInteger)index;
@end @end
@interface DZXCarouselView : UIView @interface DZXCarouselView : UIView
...@@ -100,6 +114,8 @@ typedef void(^DZXCarouselPageWillShowBlock)(NSInteger index, id data); ...@@ -100,6 +114,8 @@ typedef void(^DZXCarouselPageWillShowBlock)(NSInteger index, id data);
@property (nonatomic, strong) UIScrollView *scrollView; @property (nonatomic, strong) UIScrollView *scrollView;
/// 数据 /// 数据
@property (nonatomic, strong) NSArray *dataArr; @property (nonatomic, strong) NSArray *dataArr;
/// 代理
@property(nonatomic, weak) id<DZXCarouselViewDelegate> delegate;
/// 初始化轮播组件 /// 初始化轮播组件
/// @param frame frame /// @param frame frame
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// models // models
// others // others
#import "NSObject+DZTrackBase.h"
static double const kResetTime = 0.35;//页面重置时间 static double const kResetTime = 0.35;//页面重置时间
static double const kMargin = 50;//偏移间隔 static double const kMargin = 50;//偏移间隔
...@@ -183,6 +183,10 @@ static BOOL isScrolling = NO; ...@@ -183,6 +183,10 @@ static BOOL isScrolling = NO;
[_scrollView addSubview:_currentV]; [_scrollView addSubview:_currentV];
[_scrollView addSubview:_nextV]; [_scrollView addSubview:_nextV];
self.lastV.track_type_ = DZUserTrackTypeElement;
self.currentV.track_type_ = DZUserTrackTypeElement;
self.nextV.track_type_ = DZUserTrackTypeElement;
[self updateSubViewFrames]; [self updateSubViewFrames];
UITapGestureRecognizer *tapGes = [UITapGestureRecognizer.alloc initWithTarget:self action:@selector(tapCurrentView)]; UITapGestureRecognizer *tapGes = [UITapGestureRecognizer.alloc initWithTarget:self action:@selector(tapCurrentView)];
...@@ -373,6 +377,15 @@ static BOOL isScrolling = NO; ...@@ -373,6 +377,15 @@ static BOOL isScrolling = NO;
//已显示 //已显示
- (void)pageShow { - (void)pageShow {
if (_currentIndex < 0 || _currentIndex >= _dataArr.count) return; if (_currentIndex < 0 || _currentIndex >= _dataArr.count) return;
//埋点-曝光事件
if ([_delegate respondsToSelector:@selector(DZXCarouselView_track_rtpKey_atIndex:)]) {
self.currentV.track_rtpKey_ = [_delegate DZXCarouselView_track_rtpKey_atIndex:_currentIndex];
}
if ([_delegate respondsToSelector:@selector(DZXCarouselView_track_extInfo_atIndex:)]) {
self.currentV.track_extInfo_ = [_delegate DZXCarouselView_track_extInfo_atIndex:_currentIndex];
}
[self.currentV ut_exposure];
if (_pageShowBlock) { if (_pageShowBlock) {
_pageShowBlock(_currentIndex,_dataArr[_currentIndex]); _pageShowBlock(_currentIndex,_dataArr[_currentIndex]);
} }
...@@ -380,6 +393,9 @@ static BOOL isScrolling = NO; ...@@ -380,6 +393,9 @@ static BOOL isScrolling = NO;
///点击 ///点击
- (void)tapCurrentView { - (void)tapCurrentView {
if (_currentIndex < 0 || _currentIndex >= _dataArr.count) return; if (_currentIndex < 0 || _currentIndex >= _dataArr.count) return;
//埋点-点击事件
[self.currentV ut_click];
if (self.tapBlock) { if (self.tapBlock) {
self.tapBlock(_currentIndex, self.dataArr[_currentIndex]); self.tapBlock(_currentIndex, self.dataArr[_currentIndex]);
} }
...@@ -416,9 +432,26 @@ static BOOL isScrolling = NO; ...@@ -416,9 +432,26 @@ static BOOL isScrolling = NO;
} }
//页面展示block(第一次进来) //页面展示block(第一次进来)
//埋点-曝光事件
if ([_delegate respondsToSelector:@selector(DZXCarouselView_track_rtpKey_atIndex:)]) {
self.currentV.track_rtpKey_ = [_delegate DZXCarouselView_track_rtpKey_atIndex:0];
}
if ([_delegate respondsToSelector:@selector(DZXCarouselView_track_extInfo_atIndex:)]) {
self.currentV.track_extInfo_ = [_delegate DZXCarouselView_track_extInfo_atIndex:0];
}
[self.currentV ut_exposure];
_pageWillShowBlock(0, _dataArr[0]); _pageWillShowBlock(0, _dataArr[0]);
_pageShowBlock(0, _dataArr[0]); _pageShowBlock(0, _dataArr[0]);
} }
#pragma mark - 埋点
- (NSString *)track_rtpKey_ {
return self.carouselConfig.track_rtpKey_?:@"";
}
-(NSDictionary *)track_extInfo_ {
return self.carouselConfig.track_extInfo_?:@{};
}
@end @end
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