> 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) |
|                                    |                                                                              |

####


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.chartbeat.com/cbp/tracking/mobile-app-sdks/ios-sdk/api-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
