Tracking

To implement IVW Conformant tracking, implement the following method from the TickarooSDKDelegate protocol

- (void)tickarooSDK:(TickarooSDK *)tickarooSDK 
          trackView:(NSString *)view 
         identifier:(NSString *)identifier 
               type:(T2ViewTrackingType)type 
          userInfos:(NSDictionary *)userInfos;

Parameters

  • tickarooSDK: The TickarooSDK instance
  • trackView: The kind of view for which the event occurred, possible values are ‘screen’, ‘image’, ‘web’
  • identifier: An identifier to differentiate different views. For ‘screen’ the _id of the liveblog, for ‘image’ the _id of the media, for ‘web’ the url.
  • type: One of T2ViewTrackingTypeAppear and T2ViewTrackingTypeLoad
  • userInfos: User defined informations to provide more context to the delegate

There are two types of tracking types defined in the following Enum:

typedef enum : NSUInteger {
    T2ViewTrackingTypeAppear,
    T2ViewTrackingTypeLoad,
} T2ViewTrackingType;
  • T2ViewTrackingTypeAppear Will be called when a Liveblog is first displayed, a webembed is displayed or a user swipes to an image in the slideshow
  • T2ViewTrackingTypeLoad Will be called when a User initiated refresh occurred

To provide your own userInfos to your delegate, assign a NSDictionary to the trackingUserInfos property of the UIViewController instance you get from the TickarooSDK method + (void)requestViewControllerForRef:(TApiAbstractRef *)ref callback:(void (^)(UIViewController<TickarooSDKController> *viewController))callback.

Example code for assigning and retrieving the userInfos

Objective-C

- (void)showTicker:(NSString *)tickerId {
    TApiTickerRef *ref = [[TApiTickerRef alloc] init];
    ref.tickerId = tickerId;    
    [TickarooSDK requestViewControllerForRef:ref callback:^(UIViewController<TickarooSDKController> *vc) {
        vc.trackingUserInfos = @{@"myCustomTrackingId": @"1234"};
        [self.navigationController pushViewController:vc animated:true];
    }];
}

- (void)tickarooSDK:(TickarooSDK *)tickarooSDK trackView:(NSString *)view identifier:(NSString *)identifier type:(T2ViewTrackingType)type userInfos:(NSDictionary *)userInfos {
    [self sendDataToServer:userInfos[@"myCustomTrackingId"] forEvent:type == T2ViewTrackingTypeLoad ? @"load" : @"appear"];  
}

Swift

func showTicker(with id: String) {
    let ref = TApiTickerRef()
    ref.tickerId = id    
    TickarooSDK.requestViewController(for: ref) { [weak self] vc in
        vc.map {
            $0.trackingUserInfos = ["myCustomTrackingId": "1234"]
            self?.navigationController?.pushViewController($0, animated: true)
        }
    }
}

func tickarooSDK(_ tickarooSDK: TickarooSDK!, trackView view: String!, identifier: String!, type: T2ViewTrackingType, userInfos: [AnyHashable : Any]!) {
    if let customTrackingId = userInfos["myCustomTrackingId"] as? String {
        sendDataToServer(customTrackingId, forEvent:type == T2ViewTrackingTypeLoad ? "load" : "appear")
    }
}