hi - we’re seeing a few cases where calling `set_g...
# questions
s
hi - we’re seeing a few cases where calling
set_group
in the browser API doesn’t appear to be correctly setting the group ID. This specifically seems to be happening if the user logs in on a device where they have not yet opted in to tracking, so when they opt in, all the events that happen after the opt in do not contain the organisation ID. Our code looks a bit like this
Copy code
mixpanel.set_group("organisation", [user.org.id]);
  mixpanel.identify(user.id);

  if (user.acceptTracking === "ALLOW" && !mixpanel.has_opted_in_tracking()) {
    mixpanel.opt_in_tracking();
  } else if (user.acceptTracking !== "ALLOW" && !mixpanel.has_opted_out_tracking()) {
    mixpanel.opt_out_tracking();
  }
Should the
set_group
work here, is this a bug, or are we calling it in the wrong order? Thanks