# Category Tracking

## Category Tracking

Use the `category` and `categoryview` tracking commands to capture when a visitor views a page that presents product categories. This improves the accuracy of interaction tracking for product catalog, category landing pages, or filtered category views.

### Purpose

Category tracking:

* Signals that the user is browsing a **category page**
* Enables better segmentation and reporting on **category-level interactions**

### Tracking Commands

* `category` (for each category shown)
* `product` (if any products are displayed)
* `categoryview` (once per page)
* `submit` (finalizes the state)

### 1. `category` Object

Push one `category` object for each category shown on the page.

#### Mandatory Properties

| Name   | Description                     | Type   | Example       |
| ------ | ------------------------------- | ------ | ------------- |
| `id`   | Internal identifier of category | string | `"C8"`        |
| `name` | Display name of the category    | string | `"Furniture"` |

#### Example

```javascript
_jts.push({
  track: "category",
  id: "C8",
  name: "Furniture"
});
```

### 2. `categoryview` Command

Push this command **once**, after all `category` and `product` pushes are complete.

#### Example

```javascript
_jts.push({
  track: "categoryview"
});
```

No additional properties are required.

***

### Full Example

```javascript
// [START] General Pageview
_jts.push({ track: "pageview" });

// [CATEGORY] Category information
_jts.push({
  track: "category",
  id: "C8",
  name: "Furniture"
});

// [PRODUCTS] Products shown under the category
_jts.push({ track: "product", type: "categoryview", id: "1" });
_jts.push({ track: "product", type: "categoryview", id: "2" });

// [CATEGORYVIEW] Category view summary
_jts.push({ track: "categoryview" });

// [SUBMIT] Final submission
_jts.push({ track: "submit" });
```

### Summary

* Use one `category` push per category displayed
* Trigger `categoryview` once to finalize the interaction
* Include any `product` pushes if products are shown under categories
* Finalize the interaction state with a `submit`

This approach ensures category pages are clearly marked and measurable across your tracking stack.
