> For the complete documentation index, see [llms.txt](https://docs.chartbeat.com/cbp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chartbeat.com/cbp/tracking/mobile-app-sdks/ios-sdk/api-reference.md).

# API Reference

### API Reference

All methods live on \[CBTracker sharedTracker] unless noted otherwise.

#### Lifecycle

| Method                                              | Description                                                                    |
| --------------------------------------------------- | ------------------------------------------------------------------------------ |
| + sharedTracker                                     | Singleton accessor                                                             |
| <ul><li>setupTrackerWithAccountId:domain:</li></ul> | Recommended entry point — initialize account + domain                          |
| <ul><li>stopTracker</li></ul>                       | Pause tracking; resume by calling trackView again                              |
| <ul><li>active:</li></ul>                           | Manually mark the user inactive/active (default: YES)                          |
| <ul><li>setInterval:</li></ul>                      | Minimum seconds between beacons (default: 15) — takes effect on next trackView |

#### View tracking

| Method                                    | Description                                                                                |
| ----------------------------------------- | ------------------------------------------------------------------------------------------ |
| <ul><li>trackView:viewId:title:</li></ul> | Track a view (call in viewDidAppear:). viewId should look like a URL path starting with /. |

#### Metadata

| Method                                      | Description                                    |
| ------------------------------------------- | ---------------------------------------------- |
| <ul><li>setAuthors:</li></ul>               | Array of author-name strings                   |
| <ul><li>setSections:</li></ul>              | Array of section names                         |
| <ul><li>setZones:</li></ul>                 | Array of zone names                            |
| <ul><li>setDomain: (via property)</li></ul> | Main domain to report to                       |
| <ul><li>setSubDomain:</li></ul>             | Report-to sub-domain (usually equal to domain) |
| <ul><li>setAppReferrer:</li></ul>           | App referrer identifier                        |
| <ul><li>setPushReferrer:</li></ul>          | Push-notification referrer identifier          |
| <ul><li>setLocation:</li></ul>              | CLLocation for geo metadata                    |

#### User state

| Method                             | Description                                                                  |
| ---------------------------------- | ---------------------------------------------------------------------------- |
| <ul><li>userEngaged:</li></ul>     | YES = writing, NO = reading/interacting                                      |
| <ul><li>setUserPaid</li></ul>      | Mark user as paid subscriber                                                 |
| <ul><li>setUserLoggedIn</li></ul>  | Mark user as logged in                                                       |
| <ul><li>setUserAnonymous</li></ul> | Mark user as anonymous                                                       |
| <ul><li>setIdSync:</li></ul>       | NSDictionary\<NSString\*, NSString\*> for cross-product ID sync (e.g. GA ID) |
|                                    |                                                                              |

####
