User Context

Tracking user context with optional fields

📘

The only mandatory field is the user id, the other fields are optional attributes you can track for deeper observability

Creating custom user and subscription attributes can be done under Settings > Attribute Settings

Basic user context

const context = {
    user: {
        id: '7d8da9a5-53f3-4bc0-8921-1cceecb8107', // mandatory
    },
    subscription: {
        id: 'subscription-12345' // mandatory
         // add custom attributes here after creating them in your subscription
    }
}

foldspace('when', 'ready', () => {
    foldspace.identify(context);
});

Passing custom user attributes (optional)

const context = {
    user: {
        id: '7d8da9a5-53f3-4bc0-8921-1cceecb8107', // mandatory
        email: '[email protected]',
        name: 'John Doe',
        role: 'admin',
        image: 'https://example.com/images/user12345.jpg',
        phone: '+1234567890',
        timezone: 'America/New_York',
        signUpDate: 1707164462000,
        location: {
            country: "USA",
            region: "Northeast",
            state: "New York",
            city: "New York City",
            postalCode: "10001"
        }
        // add custom attributes here after creating them in your subscription

    },
    subscription: {
        id: 'subscription-12345' // mandatory
         // add custom attributes here after creating them in your subscription
    }
}

foldspace('when', 'ready', () => {
    foldspace.identify(context);
});