React
Identify Users
Trigger Swishjam user identification in your React app
Import Swishjam into your component
import { swishjam } from '@swishjam/react';
Identify your users
Simple Swishjam Import
swishjam.identify('your-unique-user-identifier', {
firstName: 'john',
lastName: 'doe',
email: 'john.doe@example.com',
// more attributes
})
Once a user is identified we will track events triggered during the same session to that user
Full Example Code
Standard Swishjam Import
import { swishjam } from '@swishjam/react';
export default function YourComponent() {
const logUserIn = () => {
// your login logic
swishjam.identify('your-unique-user-identifier', {
firstName: 'john',
lastName: 'doe',
email: 'john.doe@example.com',
// more attributes
})
}
return (
<button onClick={(e) => logUserIn()}>
Login
</button>
)
}