Hi there! I’m working on an implementation of Grow...
# announcements
h
Hi there! I’m working on an implementation of GrowthBook where a logged-out user sees a Pricing page, and after they login or sign up, we want to show the same version of the pricing page they saw before - to accomplish this we set a cookie that forces the correct AB Test version between those two states. That all works fine. My other requirement is that I track revenue of the new pricing and old pricing versions via Mixpanel at invoice pay time, in which only logged-in users are tracked via the trackingCallback, which is their logged in ID - which also seems to work fine. However, (and correct me if I’m wrong) each of these pieces work by setting the
id
attribute, which in my context would be overwritten as soon as someone logs in and is associated with their logged in
id
. So my question: how do I get both of these pieces to work at the same time?
f
We use distinct_id when analyzing mixpanel results (which mixpanel generates and stores in a cookie), not the logged in user id. So as long as the mixpanel cookie is the same, we'll be able to tie together the initial trackingCallback event with the invoice payment event.
h
ah! that makes sense! so i can just use the mixpanel cookie instead of my two opposing ids?
f
yes. We have some sample Mixpanel code in our docs on how to pass the mixpanel cookie into GrowthBook https://docs.growthbook.io/app/datasources#mixpanel
Copy code
// Can only get the distinct_id after Mixpanel fully loads
mixpanel.init("YOUR PROJECT TOKEN", {
  loaded: function (mixpanel) {
    growthbook.setAttributes({
      ...growthbook.getAttributes(),
      id: mixpanel.get_distinct_id(),
    });
  },
});
🙏 1
h
thank you!