# 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
