Identity Settings
Cookieless mode — provide your own visitor identity with setUserToken
Copy this guide and your current settings as a prompt for your AI agent.
Preview agent promptSee the guide, code and settings included when you copy.
By default, Coframe assigns each visitor a persistent identity using a first-party cookie. If your site operates in a cookieless context — or if you already manage visitor identity in your own system — you can opt out of cookie-based tracking and supply the identity yourself.
01Cookieless Mode and setUserToken
Setting waitForUserToken: true in your SDK options disables Coframe’s
cookie-based visitor identity. When this option is enabled, Coframe waits
for your application to call setUserToken before assigning the visitor to
any experiment. No Coframe cookies are written.
Place the following snippet before the main Coframe SDK script, replacing
visitor-123 with the actual visitor or user ID from your application:
<script>
// User token - provide visitor identity from your application
const userToken = 'visitor-123'; // TODO: replace with your visitor/user ID
window.CFQ = window.CFQ || [];
if (userToken) {
window.CFQ.push({ setUserToken: userToken });
}
</script>The value you pass to setUserToken is forwarded as coframe_user_token in
the analytics treatment callback. This lets you join Coframe experiment data
back to your own user records in your analytics platform. See
Experiment Assignment & IDs
for the full list of fields emitted per treatment.
02When to Use This Setting
Use waitForUserToken when:
- Your site policy prohibits third-party or first-party tracking cookies.
- You have a logged-in user system and want experiment assignments tied to your own user ID rather than a cookie-based anonymous ID.
- You are stitching Coframe data to downstream analytics using a consistent user identifier across your stack.
If you do not set waitForUserToken: true, Coframe handles identity
automatically and no additional configuration is required.
# Identity Settings
Cookieless mode — provide your own visitor identity with setUserToken
By default, Coframe assigns each visitor a persistent identity using a
first-party cookie. If your site operates in a cookieless context — or if
you already manage visitor identity in your own system — you can opt out of
cookie-based tracking and supply the identity yourself.
## Cookieless Mode and setUserToken
Setting `waitForUserToken: true` in your SDK options disables Coframe’s
cookie-based visitor identity. When this option is enabled, Coframe waits
for your application to call `setUserToken` before assigning the visitor to
any experiment. No Coframe cookies are written.
Place the following snippet before the main Coframe SDK script, replacing
`visitor-123` with the actual visitor or user ID from your application:
HTML
```
<script>
// User token - provide visitor identity from your application
const userToken = 'visitor-123'; // TODO: replace with your visitor/user ID
window.CFQ = window.CFQ || [];
if (userToken) {
window.CFQ.push({ setUserToken: userToken });
}
</script>
```
The value you pass to `setUserToken` is forwarded as `coframe_user_token` in
the analytics treatment callback. This lets you join Coframe experiment data
back to your own user records in your analytics platform. See
[Experiment Assignment & IDs](../docs/experiment-assignment.html)
for the full list of fields emitted per treatment.
## When to Use This Setting
Use `waitForUserToken` when:
- Your site policy prohibits third-party or first-party tracking cookies.
- You have a logged-in user system and want experiment assignments tied to your
own user ID rather than a cookie-based anonymous ID.
- You are stitching Coframe data to downstream analytics using a consistent
user identifier across your stack.
If you do not set `waitForUserToken: true`, Coframe handles identity
automatically and no additional configuration is required.