Profiles
Create customer profiles records in your warehouse using Jitsu Profile Builder.

Profile builder is an enterprise feature. Please contact support to enable it for your account.
What are Profiles?
Profiles are customer records stored in your warehouse, based on the events data you send to Jitsu.
Profile Builder generates profiles based on the traits object in identify events.
You can also define custom logic for profile generation using a JavaScript function, allowing you to leverage up to a year’s worth of user events data.
Configuring Profile Builder
To set up Profile Builder, navigate to the Customers -> Profile Builder section in the Jitsu UI.
Profile builder is an enterprise feature and initially will appear in a LOCKED state. Please contact support to enable it for your account.
While in a locked state, Profile Builder will not create profiles in your warehouse. However, you can still configure it, debug your custom profile generation function, and preview profile results based on example events data.
Profile Builder configuration consists of the following sections:
- Profile Function - code of a JavaScript function that generates profiles based on the events data.
- Transformation - allows setting up a chain of functions to filter or transform events before they are used for building a profile.
- Environment Variables - environment variables that can be used in your profile generation function.
- Settings - destination and other settings.
Events Sources
All sites added to the workspace act as event sources for Profile Builder.
By default, only non-anonymous events—those containing the userId field—are used to build profiles.
With Transformation, you can exclude events from profile building or, conversely, assign a profile ID to events that originally lacked a userId field.
Profile Function
The Code section is where you define the JavaScript function that generates profiles based on the events data.
Profile generation function has the following signature:
export default async function(events, user, context) {
context.log.info("Profile Id: " + user.profileId)
const profile = {}
for (const event of events) {
//count events by type
profile[event.type] = (profile[event.type] ?? 0) + 1
}
profile.anonId = user.anonymousId
return {
traits: profile
}
}
where:
eventsis an Iterable of events. Use thefor (const event of events)loop to iterate over events.useris a user object. It contains the following fields:profileId- ID of profileuserId- user IDanonymousId- anonymous IDtraits- user traits collected using built-in profile generation logic
contextthe function context. I contain various services that can be used in the functioncontext.log- logging servicecontext.store- persistent storagecontext.fetch- a standard fetch API to make HTTP requestscontext.getWarehouse- Warehouse API to query your data warehousescontext.profileBuilder- contains meta information about the current Profile Builder:id,version
Return value of the function is a profile object:
type ProfileResult = {
profileId?: string;
destinationId?: string;
tableName?: string;
traits: Record<string, any>;
}
where:
profileId- Allows to override the profile ID. If not specified, Jitsu will use profile ID assigned in Transformation oruserIdby default.destinationId- Allows to override the default destination. If not specified, Jitsu wil use the Default Destination from the Profile Builder settings.tableName- Allows to override the default table name. If not specified, Jitsu will use the Default Table Name from the Profile Builder settings.traits- object with profile properties. All custom profile properties should be placed in thetraitsproperty.
Traits returned by the function will be merged with the traits collected using built-in profile generation logic.
SDK
It is also possible to work on Profile Builder function code in your IDE and then sync it with Jitsu.
Jitsu SDK supports Profile Builder functions.
Profile Builder function should be located in the src/profiles directory and configured with the profileBuilderId config property within the function code.
Id of Profile Builder can be obtained from the Settings tab.
import { ProfileFunction } from "@jitsu/protocols/profile";
export const config = {
profileBuilderId: "[Profile Builder ID]", // Required: id of Profile Builder where this function will be used. Can be found in the Profile Builder Settings UI
slug: "profile.ts", //id (uniq per workspace) used to identify function in Jitsu
};
const profileExample: ProfileFunction = async (events, user, { log }) => {
//TODO
}
Transformation
Transformation allows you to filter or transform events before they are used for building a profile.
In the Transformation section you can set up the chain of standard Jitsu functions to process events before they are passed to the Profile Builder function.
Use return "drop" to exclude an event from profile building.
Custom Profile ID
Using transformation, you can assign a profile ID to events that originally lacked a userId field or had a different userId field.
To assign a profile ID to an event, add JITSU_PROFILE_ID property to the returned event object:
export default async function transform(event, { log, props, store }) {
event.JITSU_PROFILE_ID = event.propeties.internalId;
return event;
}
Publishing Profile Builder
Collecting of customers events history and profile-building logic starts after the initial version of Profile Builder is published.
To publish the Profile Builder, click the Publish button in the top right corner of the Profile Builder editor.
You can continue to work on your profile generation function after the initial version is published by utilizing the Drafts.
Saved Drafts can be used for debugging and previewing profile results based on example events data and don't affect the production profile generation process.
Each time you publish a new version of the Profile Builder, the following happens:
- Profile Builder's numeric
versionis incremented. - Profile Builder starts rebuilding profiles of all tracked customers based on the new version of the profile generation function.
This process may take some time depending on the number of customers and events and can be monitored on theBuild Progresstab. - After the rebuild is complete, the new version of the profile generation function is used to rebuild profiles in real-time based on new events coming.