# TMViewTrackerSDK **Repository Path**: alibaba/TMViewTrackerSDK ## Basic Information - **Project Name**: TMViewTrackerSDK - **Description**: ViewTracker is a sdk can help Developers to collect exposure and click events automatically. - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-10-31 - **Last Updated**: 2026-10-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ViewTracker - iOS ViewTracker is a tool to automatically collect exposure and click event data. Now just support Objective-C, not swift support. The system requirement for ViewTracker is iOS 7.0+ [中文文档](README_CN.md) ## Feature - Two platform support (iOS & Android, See ViewTracker-Android in Github for Android Version) - Automated Data Collection for exposure and click event. - Covering a variety of scenes , such as Tab、ScrollView、UIControlEventTouchUpInside、Page or App switch. - A good performance on Page FPS. - Compact API. ## Performance - Move to [Performance Test](Docs/viewtrack_performance.md) ## Install Use Cocoapods to Get latest version of ViewTracker ```ruby pod 'ViewTracker' ``` ## Getting Started ##### Set a Delegate to respond to processing exposure and click events. > feature/viewtrack-opensource ```objc #import "ViewTrackerProxy.h" #import ... [[TMViewTrackerManager sharedManager] setCommitProtocol:[ViewTrackerProxy new]]; ... ``` ViewTrackerProxy.h ```objc #import @interface ViewTrackerProxy : NSObject @end ``` ViewTrackerProxy.m ```objc #import "ViewTrackerProxy.h" @implementation ViewTrackerProxy - (instancetype)init { if (self = [super init]) { //init ViewTrack Config NSDictionary * dictionary = @{kExposureSwitch:@(1), kClickSwitch:@(1)}; [[TMViewTrackerManager sharedManager] setViewTrackerConfig:dictionary]; //register notification to handle changes of config from server. } return self; } - (void)ctrlClicked:(NSString*)controlName onPage:(NSString*)pageName args:(NSDictionary*)args { NSLog(@"Clicked on Page(%@), controlName(%@), with args(%@)", pageName, controlName, args); } - (void)module:(NSString*)moduleName showedOnPage:(NSString*)pageName duration:(NSUInteger)duration args:(NSDictionary *)args { NSLog(@"module on Page(%@), controlName(%@), duration(%lu), with args(%@)", pageName, moduleName, (unsigned long)duration, args); } @end ``` ##### Add the tag 'controlName' to the view ```objc #import ... view.controlName=@"banner-0"; view.args=@{@"picName":@"pic1"}; ... ``` ##### Set pageName in viewDidAppear.It is recommended to set it in the base class。 ```objc #import ... - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [TMViewTrackerManager setCurrentPageName:@"Tab-1"]; } ... ``` ## Author - @圆寸 - @子央 ## LICENSE ViewTracker is available under the Apache2.0 license. See the LICENSE file for more info.