kapa.ai i am sending group events and it works they get seen in mixpanel, but when i logout , the user events get a new id which is correct, but then the logged out events start appearing in group events but greyed out, which shouldtnt hppen on log out. am using a proxy in nextjs
Based on the knowledge sources, I can identify what's likely causing this issue.
The Root Cause: Group Key Persisting After Logout
When you call mixpanel.reset() on logout, it clears the distinct_id and generates a new anonymous ID — which is why you correctly see a new user ID for post-logout events. However, the group key (e.g., company_id) that was registered via mixpanel.add_group() or mixpanel.setGroup() may still be persisting in local storage and being attached to subsequent anonymous events.
This is why your logged-out events appear in the group analytics view (greyed out) — they still carry the group key property, so Mixpanel associates them with the group, even though they come from an anonymous/logged-out user.
What the Docs Say About Group Keys
"The group key(s) and their value should be present in every event you want associated with the group... we have convenience functions that allow you to store the group key(s) and values in the device so every event has that information (after it's registered and before the user logs out)." [Group Analytics Implementation]
The emphasis on "before the user logs out" implies you should remove the group key at logout.
Recommended Fix
On logout, before or after calling mixpanel.reset(), you should remove the group association. You can do this with mixpanel.remove_group() or by unregistering the group key super property:
function handleLogout() {
mixpanel.track('log out');
mixpanel.remove_group('company_id', 'your_company_value'); // remove group association
mixpanel.reset(); // clears distinct_id, generates new anonymous ID
}mixpanel.reset() clears cookies/local storage and generates a new $device_id [JS SDK Identity], but the knowledge sources do not explicitly confirm whether reset() alone clears group keys set via add_group/setGroup. Given your symptoms, explicitly removing the group before reset is the safest approach.
Since you're using a Next.js proxy, also verify that your server-side event tracking is not hardcoding or forwarding the group key for anonymous/logged-out requests, as server-side tracking requires you to manually manage which properties are included in each event. [Group Analytics Implementation]
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
kapa.ai no does not work see this"API Endpoint: api.mixpanel.com API Timestamp: 1777564477541 Browser: Chrome Browser Version: 147 Current URL: http://localhost:3000/business Device ID: 38155dbf-0df0-4dbe-8298-e50e7bacc281 Event Size: 682 Initial Referrer: http://localhost:3000/business/onboarding Initial Referring Domain: localhost:3000 Insert ID: z55upfbnh7 Library Version: 2.78.0 Mixpanel Library: web Operating System: Mac OS X Original Distinct Id: $device:38155dbf-0df0-4dbe-8298-e50e7bacc281 path: /business Referrer: http://localhost:3000/business/onboarding Referring Domain: localhost Screen Height: 900 Screen Width: 1440 Time: 6:54:37.000 pm, Thu, Apr 30, 2026 Time Processed (UTC): 3:54:37.900 pm, Thu, Apr 30, 2026 url:" group event and user event"API Endpoint: api.mixpanel.com API Timestamp: 1777564477541 Browser: Chrome Browser Version: 147 Current URL: http://localhost:3000/business Device ID: 38155dbf-0df0-4dbe-8298-e50e7bacc281 Distinct ID: $device:38155dbf-0df0-4dbe-8298-e50e7bacc281 Event Size: 682 Initial Referrer: http://localhost:3000/business/onboarding Initial Referring Domain: localhost:3000 Insert ID: z55upfbnh7 Library Version: 2.78.0 Mixpanel Library: web Operating System: Mac OS X path: /business Referrer: http://localhost:3000/business/onboarding Referring Domain: localhost Screen Height: 900 Screen Width: 1440 Time: 6:54:37.000 pm, Thu, Apr 30, 2026 Time Processed (UTC): 3:54:37.900 pm, Thu, Apr 30, 2026 url: http://localhost:3000/business", as you can see the distinct id , i do "mixpanel.reset(); mixpanel.merchant?.reset();""mixpanel.merchant?.unregister('merchant_id'); mixpanel.merchant?.unregister('branch_id');" on logout, as you can see the events i have sent they dont have groups like this "API Endpoint: api.mixpanel.com API Timestamp: 1777564471301 branch_id: rzk9Wxg0yGSrVQZwHFIx3F7pFH23 Browser: Chrome Browser Version: 147 Current URL: http://localhost:3000/business/onboarding Device ID: 4f03829a-195b-42c1-bfcb-87619ffc9637 Distinct ID: rzk9Wxg0yGSrVQZwHFIx3F7pFH23 Event Size: 852 Groups: {"branch_id":"rzk9Wxg0yGSrVQZwHFIx3F7pFH23","merchant_id":"rzk9Wxg0yGSrVQZwHFIx3F7pFH23"} Initial Referrer: http://localhost:3000/business/onboarding Initial Referring Domain: localhost:3000 Insert ID: asxsftsmmr Library Version: 2.78.0 merchant_id: rzk9Wxg0yGSrVQZwHFIx3F7pFH23 Mixpanel Library: web Operating System: Mac OS X Original Distinct Id: rzk9Wxg0yGSrVQZwHFIx3F7pFH23 Referrer: http://localhost:3000/business/onboarding Referring Domain: localhost Screen Height: 900 Screen Width: 1440 Time: 6:54:30.000 pm, Thu, Apr 30, 2026 Time Processed (UTC): 3:54:31.412 pm, Thu, Apr 30, 2026 User ID: rzk9Wxg0yGSrVQZwHFIx3F7pFH23" this for example, so why would they come to group events
Looking at the event data you've shared, I can see the issue clearly.
What's Happening
The post-logout event (the anonymous one) shows:
Distinct ID: $device:38155dbf-0df0-4dbe-8298-e50e7bacc281
No Groups property ✅
No branch_id or merchant_id properties ✅
So your logout cleanup (reset(), unregister) is actually working correctly — the post-logout events do not have group keys attached.
Why They Still Appear in Group Analytics (Greyed Out)
The reason these anonymous events show up greyed out in your group view is identity merging. Here's what's happening:
The pre-logout event shows:
Original Distinct Id: rzk9Wxg0yGSrVQZwHFIx3F7pFH23 (your authenticated user ID)
Device ID: 4f03829a-195b-42c1-bfcb-87619ffc9637
The post-logout anonymous event shows:
Original Distinct Id: $device:38155dbf-0df0-4dbe-8298-e50e7bacc281
These are different device IDs, which confirms reset() did generate a new anonymous ID. However, the greyed-out events in the group view are likely pre-logout events from the same session that Mixpanel is displaying as part of the group's timeline — not the post-logout events themselves.
What "Greyed Out" Means in Group Analytics
Events appear greyed out in group analytics when they belong to the user's journey but do not have the group key on them. This is expected behavior — Mixpanel shows the full user timeline, but only highlights events that were explicitly attributed to the group. [Group Analytics Implementation]
As the docs explain:
"Only events ingested with the group key in it would be associated with the group... the journey of the group starts with the login event."
So the greyed-out events you're seeing are not a bug — they are events from the same user's identity cluster that lack the group key, displayed for context but not attributed to the group. This is the intended behavior of Mixpanel's group analytics view.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
kapa.ai wait so the events appearing like that is normal. i mean when i login again, those events are not picked up again by group events (they dont get distinct id ever again) they remain greyed out. new group events after login get the distinct id again. example business landing page view (no user/ grey event group)> user logs in (that previous event / page view stays grey) > user is redirected to dashboard> those views are identified> log out again> those events group appear but grayed out. this is normal??
Yes, this is normal and expected behavior in Mixpanel. Here's why:
Why Pre-Login Events Stay Greyed Out in Group Analytics
An event is only attributed to a group if it has the group key as an event property at the time it was tracked. [Group Analytics Implementation]
Your pre-login "business landing page view" was tracked anonymously — without merchant_id or branch_id on it. Even after the user logs in and identity merging links that anonymous event to the authenticated user, Mixpanel does not backfill the group key onto that event. So it will never be attributed to the group — it stays greyed out permanently.
The docs confirm this directly:
"Only events ingested with the group key in it would be associated with the group. In this timeline, the journey of the user starts with the initial page_view event, but the journey of the group starts with the login event." [Group Analytics Implementation]
Your Flow, Explained
Event | Has Group Key? | Appears in Group? |
Landing page view (anonymous) | ❌ | Greyed out (context only) |
Login | ✅ | Attributed to group |
Dashboard views (logged in) | ✅ | Attributed to group |
Post-logout events | ❌ | Greyed out (context only) |
The greyed-out events are shown for context (they belong to the same user's identity cluster), but they are not counted as group events. This is the intended design — your implementation is working correctly.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
That's fair feedback! The behavior of greyed-out events in the group analytics activity feed isn't explicitly documented with a visual explanation in the current knowledge sources I have access to — the closest the docs come is this passage:
"Only events ingested with the group key in it would be associated with the group... the journey of the user starts with the initial page_view event, but the journey of the group starts with the login event." [Group Analytics Implementation]
This implies the behavior but doesn't explicitly call out the greyed-out visual state or explain what it means to users. It's a reasonable documentation gap that could cause confusion — especially for developers using proxies or server-side setups who are carefully inspecting their event payloads and suspect a tracking issue.
For what it's worth, your proxy setup is not the cause — the event data you shared confirmed your group keys and reset() logic are working correctly. The greyed-out events are simply anonymous/non-group events displayed for timeline context in the group profile view.
If you'd like to submit this as a documentation improvement suggestion, Mixpanel has a GitHub repo for their docs where you can raise feedback.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
kapa.ai how do is set group properties particlary location "setGroupProperties("merchant_id", hqId, { categories: categoryHandles, town: listerData.town?.townSlug, county: listerData.county?.countySlug, latitude: listerData.exactLocation?.geoPoint?.latitude, longitude: listerData.exactLocation?.geoPoint?.longitude, is_hq: merchantData?.is_hq ?? true, is_branch: merchantData?.is_branch ?? false, }, '/business/onboarding');" can i set geopoint to goup "export const setGroupProperties = (groupKey, groupId, properties, pathname = '') => { if (typeof window === 'undefined') return; initMixpanel(); const isBusiness = pathname.startsWith('/business'); if (isBusiness && mixpanel.merchant) { // If we're setting merchant properties, sync both merchant_id and branch_id groups // for now only merchant_id is used, but we're future-proofing for branch_id later if (groupKey === 'merchant' || groupKey === 'merchant_id') { mixpanel.merchant.get_group('merchant_id', groupId).set(properties); mixpanel.merchant.get_group('branch_id', groupId).set(properties); } else { mixpanel.merchant.get_group(groupKey, groupId).set(properties); } } };"
Yes, you can set geolocation on group profiles using $latitude and $longitude, but there's an important caveat for how you pass them.
Setting Lat/Long on Group Profiles
According to the docs, for user profile updates via the API, $latitude and $longitude must be placed outside the $set dictionary. [Geolocation docs]
The raw API payload looks like this:
{
"$token": "mytoken",
"$distinct_id": "13793",
"$latitude": 37.77,
"$longitude": -122.42,
"$set": {
"My_property": "my_value"
}
}The Problem With Your Current Approach
In your setGroupProperties function, you're passing latitude and longitude inside the properties object, which gets passed directly into .set(properties). This means they'll be stored as regular group profile properties named latitude and longitude — not as the special $latitude/$longitude fields that trigger Mixpanel's reverse geocoding.
What You Should Do
The knowledge sources confirm that $latitude and $longitude need to be at the top level of the payload (outside $set) for reverse geocoding to work on profiles. However, the JS SDK's .get_group().set() method passes everything inside $set under the hood.
The knowledge sources do not explicitly document whether the JS SDK's group .set() method supports top-level $latitude/$longitude for reverse geocoding on group profiles. The reverse geocoding note in the docs specifically says:
"Reverse geocoding for user profiles is not supported via client-side SDKs." [Geolocation docs]
This is stated for user profiles — and by extension, it's likely the same limitation applies to group profiles via client-side SDKs.
Recommended Alternative
Instead of relying on reverse geocoding, manually set the geolocation properties directly in your group properties:
setGroupProperties("merchant_id", hqId, {
categories: categoryHandles,
town: listerData.town?.townSlug,
county: listerData.county?.countySlug,
$city: listerData.town?.townSlug, // Mixpanel reserved city prop
$region: listerData.county?.countySlug, // Mixpanel reserved region prop
$country_code: "IE", // e.g. your country
latitude: listerData.exactLocation?.geoPoint?.latitude, // stored as plain prop
longitude: listerData.exactLocation?.geoPoint?.longitude, // stored as plain prop
is_hq: merchantData?.is_hq ?? true,
is_branch: merchantData?.is_branch ?? false,
}, '/business/onboarding');Manually defining $city, $region, and $country_code inside $set is explicitly supported and will be prioritized over IP-based geolocation. [Geolocation docs] Since you already have town and county slugs, this is the most reliable approach for your use case.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
For setting a list of categories on a group profile, you have a few options depending on your use case:
Setting a List Property on a Group
Initial set — just pass the array directly in .set():
mixpanel.merchant.get_group('merchant_id', groupId).set({
categories: ['food', 'retail', 'services']
});Updating the List Later
Add new values without duplicates — use .union():
mixpanel.merchant.get_group('merchant_id', groupId).union('categories', ['food', 'wellness']);
// 'food' ignored if already exists, 'wellness' added if newRemove a specific value — use .remove():
mixpanel.merchant.get_group('merchant_id', groupId).remove('categories', 'retail');Applied to Your setGroupProperties Function
For the initial set, your current code already handles this correctly — just pass categories as an array:
setGroupProperties("merchant_id", hqId, {
categories: categoryHandles, // e.g. ['food', 'retail']
town: listerData.town?.townSlug,
// ...
}, '/business/onboarding');If you need to add to an existing categories list later without overwriting it, you'd want a separate helper that calls .union() instead of .set(), since .set() will replace the entire list each time.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
