To get started tracking your iOS app, be sure to download the 64-bit iOS SDK from our Mobile
Implementation page.
Getting Started
1
Tracking Views
Each view controller must import CBTracker.h and set authors/sections/zones on the shared
pinger instance, and call trackView.
When the app switches into a new view, you must call set authors, sections, and zones for the
new content. Then, call trackView for the new view and set a viewID and title.
You typically want to do this when the view is visible to the user. These methods should be
called in the `viewDidAppear` method.
Call setAuthors, setSections and setZones for the new view.
Each of these should be arrays of strings and refer specifically to the new view. If any of these
do not apply, just set to an empty array.
Authors and sections can take an array with multiple string elements, each of which will show up
as an author/section for that view. Note that there can only be one zone for a view.
Call trackView.
Tracking Video
1
When a user clicks to play a video from a given view, you also need to call trackMedia with the
following arguments:
title: A string for the video being tracked.
thumbnail: A string that identifies a URL for a thumbnail. Chartbeat will only be
able to display web-hosted thumbnails.
Your code should look similar to:
(IBAction)onVideoPlayClick:(id)sender {
NSURL *url = [NSURL URLWithString:@"http://media.w3.org/2010/05/sintel/
trailer.mp4"];
moviePlayer = [[MPMoviePlayerViewController alloc]
initWithContentURL:url];
moviePlayer.moviePlayer.shouldAutoplay = NO;
[self presentMoviePlayerViewControllerAnimated:moviePlayer];
[[CBTracker sharedTracker] trackMedia:moviePlayer.moviePlayer title:@"Your
video title thumbnail:@http://www.yoursite.com/media/img123.jpg"];
}
SUPPORT@CHARTBEAT.COM