> For the complete documentation index, see [llms.txt](https://foodcommerce-api-help.onlinesales.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://foodcommerce-api-help.onlinesales.ai/user-tracking-events/js-sdk/track-restaurant-view.md).

# Track Restaurant View

You can use the OnlineSales.ai pixel to track your website visitors' `product view` action. Tracked product views are used to compute the popularity score, user's affinity, and other signals.&#x20;

### Requirements

The pixel's [base code](/user-tracking-events/js-sdk/installing-the-tag.md#base-code) must already be installed on every page where you want to track product views.

### Trigger

`Restaurant View` event should be fired when a user visits a product page.

### JS API

All events are tracked by calling one of the library's function with a JSON object as it's parameters.

Following is a function call to track when a visitor has viewed a product on the website:

```javascript
// with minimum required parameters
_osViewRestaurant({
    "cli_ubid": "ubid-83789ssb",
    "restaurants": [{
        "restaurant_id": "SID-9999"
    }]
})
```

A list of all the standard events can be found [here](/user-tracking-events/js-sdk/references.md#standard-events).

### Object Properties of *Products* key

You can include the following predefined object properties with any events that support them. Format your parameter object data using JSON.

| sellerId  | The id of the restaurant who is selling this product. This is mandatory in the case of aggregators.                                                         |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| cli\_ubid | Client generated user id. If set, this takes precedence over ubid passed in the cookie. Once generated for a user, it should be same for all the API calls. |

A complete list of object properties can be found [here](/user-tracking-events/js-sdk/references.md).

An example call of a function with all the product properties:

```javascript
// with all parameters
_osViewRestaurant({
    "restaurants": [{
        "restaurant_id": "SID-9999"
    }],
    "cli_ubid": "ubid-83789ssb"
})
```
