🦸Identifying Users

User identification snippet should be installed once you have Crunch script in your application. To learn about how to install Crunch, refer Crunch Installation posts.

Once your script is installed, you can use the identify method to successfully identify your product's users. It is recommended to include this code snippet in the section of your code where user sign-ups, logins, or account details updates are handled.

crunchit.identify({
    uniqueIdentifier:"134",(required)
    email:"my_users_email@example.com", (optional)
    customProperty:"my_custom_property", (optional)
})

Extra Point

  1. keep the object nested level at 1.To add Nested Objects flatten it :

Example : 
Original Object : 
    const payload = {
        "akey" : "aValue"
        "obj" : {
            "prop1" : "prop2"
            ....
        }
        ....
    }

After Flattening : 
   const payload = {
        "akey" : "aValue"
        "obj.prop1" : "prop2"
        ....
    }

Replace uniqueIdentifier with a unique identifier, preferably the user ID from your database. Including the user's email is also suggested, along with any additional "traits" like avatar, name, role, etc. This information will appear on the user's profile and can be used to filter users in reports.

Last updated