Cross-device user reconciliation with setSiteUserId
Compass reconciles logged-in users across multiple devices by matching them to a single identity. Send your site’s user ID through setSiteUserId, and Compass links all sessions from that user into one profile visible in the Single Customer View.
Set the site user ID
Section titled “Set the site user ID”Call setSiteUserId with the user identifier your site already assigns. This connects all devices where the user logs in to the same Compass profile.
window.marfeel.cmd.push(['compass', function(compass) { compass.setSiteUserId(1);}]);Replace 1 with the specific user ID you use in the format of your choice. The provided UserId will be the one used internally on the Single Customer View.
Retrieve the Marfeel user ID
Section titled “Retrieve the Marfeel user ID”If you need to retrieve the Marfeel user ID for forwarding it to one of our APIs, use the getUserId() method.
To wait for the user ID to sync before reading it, use the userIdPromise property:
window.marfeel.cmd.push(["compass", async function(compass) { const userId = await compass.getUserId().userIdPromise; }]);This ensures the userIdPromise is resolved, confirming that the user is synced.
Once a user is reconciled, Compass can also track their journey stage (anonymous, registered, or subscriber) separately from their device identity.