---
title: "Troubleshooting personalization and tracking events"
slug: "troubleshooting-personalization-and-tracking-events"
abstract: "Investigate issues with rendering personalized pages and missing or incorrect Page View event data"
---
# Troubleshooting personalization and tracking events

If personalized pages do not render as expected or XM Cloud Pages Analyze does not show the data you were expecting to see, you must troubleshoot your implementation.

## Personalized page rendering issues

If personalized pages do not render as expected, you can troubleshoot the Personalize middleware. The middleware has extensive debug trace logging that can prove helpful.

To troubleshoot the Personalize middleware:

1. Turn on [debug logging](https://doc.sitecore.com/xmc/en/developers/jss/217/jss-xmc/en/debug-logging-in-jss-apps.html) for the middleware by setting the `DEBUG` environment variable value to the Next.js Personalize add-on namespace. For example: `DEBUG=sitecore-jss:personalize`.
2. Verify that the `SITECORE_EDGE_CONTEXT_ID` environment variable has the correct values for your environment and that you are using the correct variant of it (Live or Preview).
3. If you notice requests to CDP or Edge time out, increase the timeout value by setting the corresponding `PERSONALIZE_MIDDLEWARE_CDP_TIMEOUT` or `PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT` environment variable to a value higher than the default 400 milliseconds. We also recommend adding a `cacheTimeout` property (with a value in seconds of between `600` and `1200`) to the `cdpConfig` or `edgeConfig` configuration objects within `personalize.ts` , as shown in the following example:

    ```typescript
    edgeConfig: {
      ...
      cacheTimeout: 1000,
    },
    ```

## Unexpected data in XM Cloud Pages Analyze

If you do not see the expected data in XM Cloud Pages Analyze, you can troubleshoot the Page View events.

Page View events are triggered client-side.

To start troubleshooting Page View events:

1. In the browser, open the developer tools and check the console for any errors. Failing requests provide detailed error messages such as *client key is not valid*.
2. Verify that the `SITECORE_EDGE_CONTEXT_ID` environment variable has the correct values for your environment and that you are using the correct variant of it (Live or Preview).