pod ‘Chartbeat’, '~> 0.0.1'
pod install
from your Xcode project directory to install the SDK and its dependencies, creating a new Xcode workspace.[CBTracker sharedTracker]
. Call this method directly in the applicationDidBecomeActive
method of your app delegate. 1234
and mysite.com
with your organization's account ID and site ID.[CBTracker sharedTracker]
. <Chartbeat/CBTracker.h>
in your framework header file. Doing so while importing Chartbeat in swift files will cause compile errors.trackView()
:setUserPaid()
to specify a user as a paid subscriber.setUserLoggedIn()
to specify a user as a registered user.setUserAnonymous()
to specify a user as unregistered.trackView
code (below) to any view you want Chartbeat to track.viewId
that does not conflict with other page paths from your site. Traffic for this view will then be tracked as a separate page in your dashboard. For example, you can track users in your app’s table of contents by setting the viewId
to something like /nativeapp/main-toc
.setSections
and setAuthors
with an array of strings for each before calling trackView
. Any sections and authors you set will stay set until you set a different set of values. If the user is navigating from a view with sections or authors to another view with no applicable sections or authors, you should set the sections or authors to an empty array.stopTracker
function if you want to pause tracking on certain views. Restart the tracker when the user navigates to a view you do want to track, by calling trackView
again with the appropriate new arguments.stopTracker
before the app is backgrounded. trackView
again with the appropriate new arguments.