Customer User IDs
Assign internal User IDs to tracked sessions
You can now assign your own internal user IDs to the visitors tracked by the fraud0 tag. This can support improved attribution, cross-session analysis, and help you connect data more effectively in your backend systems. The ID is sent client-side and linked to the current session on our servers — giving you a straightforward way to reference known users once they’ve been identified (e.g. after login).
What’s new? We’ve added a method to our Onsite script that allows you to send a customer_user_id
once the user is known (e.g. after login). The ID is automatically associated with the session server-side.
Step 1: Include the fraud0 tag early on your page
<script async src="https://api.fraud0.com/api/v2/fz.js?cid=YOUR_TAG_ID"></script>
Step 2: Once the user logs in or is identified, call:
window.fraud0?.setCustomerUserId?.("your-user-id");
Example:
login().then(() => {
const userId = getCurrentUserId();
window.fraud0?.setCustomerUserId?.(userId);
});
Step 3: Track conversions as usual
window.fraud0 = window.fraud0 || [];
window.fraud0.push(['purchase', 'order-123']);
You can call setCustomerUserId()
before or after a conversion — as long as it's in the same session, the ID will be included during session aggregation.
Note
You can call
setCustomerUserId()
multiple times; the latest value is used for the session.The value must be a string, 1–255 characters long.
This feature is backward-compatible with all existing conversion tracking methods (e.g.,
fraud0.push(['purchase'])
).
Need support?
Do you still have questions or require further details? Contact our support team for assistance!