
The actions described in this article are usually only performed when procedures from other articles require them.

## Generating UUIDv5

UUIDv5 is generated by providing a namespace and an identifier string. When working with Synerise, the identifier string is a concatenation of a salt string (identical for all of your customers, everywhere on the site) and an identifier. **The resulting UUID is always the same for a given `salt+identifier` combination.**  
Thanks to this, you can always assign the same UUID to a customer, regardless of where the UUID was generated.

<div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

- The salt can be any string.
- By default, the customer's unique identifier is email. You can configure Synerise to use [custom ID](/docs/settings/configuration/non-unique-emails) instead.

</div></div></div>


The following example shows how to generate a UUIDv5 in Python 3.8:

<pre><code class="language-python">import uuid

salt = "someString" # identical for the entire site
uniqueIdentifier = "customer@synerise.com" # email (default) or customId
generatedUuid = uuid.uuid5(uuid.NAMESPACE_URL, (salt + uniqueIdentifier))</code></pre>


The result of running the above code example is always `345d4c8f-5aff-591d-a19c-1ca48923d9ee`.

Synerise does not the decode the UUID and cannot re-construct the data the token was created from.

For more instructions on how to generate a UUIDv5, refer to the documentation of the language or framework you are using.

## Resetting customer UUIDs

You can reset the UUID of a customer to a value provided by your application. This can be used, for example, to separate the activities of several customers who share a device.

You can do this with:
- [a cookie](#with-cookie)
- [a query parameter](#with-query-parameter)
- [an SDK method](#with-sdk-method)


  <div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

  The UUID [should not be completely random](#generating-uuidv5). However, a fully random UUIDv4 is also allowed, depending on your integration and requirements.

  </div></div></div>


### With cookie

**Before initializing the SDK**, store the new UUID in a `_snrs_reset_uuid` cookie.

When the page is refreshed/SDK is initialized, the SDK detects the cookie, saves the new UUID to the `_snrs_uuid` cookie, and deletes the `_snrs_reset_uuid` cookie.

### With query parameter

You can add an `snrs_reset_uuid=NEW_UUID` query parameter to a link to force setting an UUID. The new UUID is saved in the `_snrs_uuid` cookie.  

This setting works independently from the [Managing user context feature](/docs/settings/configuration/non-unique-emails#managing-user-context). 

**Example**

<pre><code class="language-plaintext">https://site.example.com/?snrs_reset_uuid=a6663a59-9d16-5093-bd27-84a829d001eb</code></pre>


### With SDK method

Use the `SR.client.setUuid("new_uuid")` method:


<pre><code class="language-js">SR.client.setUuid("a6663a59-9d16-5093-bd27-84a829d001eb");</code></pre>


The new UUID is saved in the `_snrs_uuid` cookie.

## How to recognize a UUIDv5?

The first digit of the third group in a UUIDv5 is `5`. In a UUIDv4, that digit is `4`.

<pre><code class="language-plaintext">xxxxxxxx-xxxx-5xxx-xxxx-xxxxxxxxxxxx // UUIDv5
xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx // UUIDv4</code></pre>

