---
title: "Tracking site visitors using REST APIs"
slug: "tracking-site-visitors-using-rest-apis"
abstract: "Describes how to track site visitors when using the REST API integration option."
---
# Tracking site visitors using REST APIs

If you integrate using REST APIs, you are responsible for tracking site visitors on your own. This means that you are responsible for assigning a cookie ID to each site visitor if they don't already have one stored in their browser. Then, you must pass the ID to Discover at runtime.

Unless you are working with a mobile native app, we recommend that you obtain the `uuid` using `rfk.uid()`. This saves you from having to assign IDs yourself.

If you do not have access to the beacon, you must assign each user an anonymous `user_id` that is stored either as a cookie or in local storage so that it can identify the same user across multiple sessions.

This `user_id` must not be personally identifiable information (PII) like email or membership ID. It must be different from the permanent user identifier, which is an internal ID or email that is only available upon login.

> [!note]
> If present, the permanent user ID can also be sent as part of the [user object](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/the-user-object.html "The user object") upon login.

To associate a user with their actions across your site, you must send the `user_id` and/or `uuid` as part of [the event object](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/the-event-object-model.md "The event object model") in calls to the [Events API](urn:resource:component:720935). It must also be sent in calls to the [Search and Recommendation API](urn:resource:component:783037).