how to add manual events to an user profile
Hi Luisa S., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> đ
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
In Mixpanel, you do not add "events" directly to a user profile. Instead, you track events (actions a user takes) and set user properties (attributes that describe the user). These are joined together in Mixpanel using a common distinct_id [User Profiles].If you want to manually send an event for a specific user or update their profile attributes, you can do so using the following methods:
1. Tracking an Event for a User
To manually attribute an event to a specific user, you must include that user's distinct_id in the event payload.**Example (Node.js/Server-side):**LBKSmixpanel.track("Sign Up", { distinct_id: "USER_ID", "Signup Type": "Referral", });LBKS[Track Events]
2. Setting User Profile Properties
To add or update attributes (like name, email, or plan) on a user's profile, use the identify and people.set methods. You must call identify first to ensure the properties are associated with the correct user.**Example (JavaScript SDK):**LBKS// Associate the session with a specific user ID mixpanel.identify('12345');LBKS// Set properties on that user's profile mixpanel.people.set({ 'plan': 'Premium', '$email': 'jane.doe@â[example.com](http://example.com)' });LBKS[Storing User Profiles; Identify Users]
3. Manual Updates via HTTP API
If you are not using an SDK, you can send a manual POST request to the Mixpanel Engage API to update a user profile.**Example (Python/Requests):**LBKSimport requestsLBKSurl = "[https://api.mixpanel.com/engage#profile-set](https://api.mixpanel.com/engage#profile-set)"LBKSpayload = [{ "$token": "YOUR_PROJECT_TOKEN", "$distinct_id": "USER_ID", "$set": { "plan": "Premium", "$email": "jane.doe@â[example.com](http://example.com)" } }]LBKSresponse = [requests.post](http://requests.post)(url, json=payload)LBKS[Identify Users Code]
Key Differences for Debugging
** Events: Reflect the value of properties at the time the action occurred. You can view these in the Events report. ** User Profiles: Reflect the most recent value of a property. You can view these and the user's historical activity feed in the Users page [Debugging].
kapa.ai is still learning and improving, please let me know how I did by reacting below.
âšī¸Â Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
