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
Thanks to this, you can always assign the same UUID to a customer, regardless of where the UUID was generated.
- The salt can be any string. For example, you can use the name of your domain.
- By default, the customer’s unique identifier is email. You can configure Synerise to use custom ID instead.
The following example shows how to generate a UUIDv5 in Python 3.8:
import uuid salt = "yourdomain.com" # identical for the entire site uniqueIdentifier = "firstname.lastname@example.org" # email (default) or customId generatedUuid = uuid.uuid5(uuid.NAMESPACE_URL, (salt + uniqueIdentifier))
The result of running the above code example is always
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.
Before initializing the SDK, store the new UUID in a
When the page is refreshed/SDK is initialized, the SDK detects the cookie, sets the customer’s UUID, and automatically deletes the cookie.
How to recognize a UUIDv5?
The first digit of the third group in a UUIDv5 is
5. In a UUIDv4, that digit is
xxxxxxxx-xxxx-5xxx-xxxx-xxxxxxxxxxxx // UUIDv5 xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx // UUIDv4