> ## Documentation Index
> Fetch the complete documentation index at: https://docs.depict.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Product Page Tracking

> How to make sure DPC tracks your Product Details Page (PDP) views correctly.

<Note>
  The product id used in `setProductId` and `addToCart` events must be the
  same id that our API returns in the displays as `product_id` — see [Which ID
  goes where](/api-guide/tracking/ids). For examples of valid product ids, see
  the bottom table on the "Tracking status" tab on
  [app.depict.ai](https://app.depict.ai).
</Note>

Every time after navigating to a page representing a product on your website, you need to send a `setProductId` event to register which product id is currently viewed. This includes client-side route changes in single-page apps: DPC detects the navigation and invalidates the previous product id, but it never infers the new one — send `setProductId` again on every PDP view.

<CodeGroup>
  ```typescript dpq theme={null}
  dpq("setProductId", "PRODUCT_ID_FOR_CURRENT_PDP");
  ```

  ```typescript DPC instance theme={null}
  dpc.setProductId("PRODUCT_ID_FOR_CURRENT_PDP");
  ```
</CodeGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.