hey guys, do you know if there is a delay between ...
# announcements
h
hey guys, do you know if there is a delay between when events show up in Mixpanel and when they are available to be queried by Growthbook? I confirmed our new experiment has started and is generating events in Mixpanel but when I press update data in Growthbook it’s saying no data
f
I don't believe there is any delay. As soon as the event shows up in the Mixpanel UI, it should also be available via the API we use to run the query.
When you click the update button, is it immediately showing you a "no data" message or does it show a loading state for a bit first?
It's possible it's hitting our query cache. You can force it to bypass the cache if you click on the 3 dots next to "Update Data" and click "re-run all queries"
h
Did that, still showing “No data yet. Make sure your experiment is tracking properly.”
Copy code
function main() {
  // Experiment results - 
  const metrics = [
    {
      "id": "met_19g61mkzeo90t4",
      "name": "Signed Up"
      },
      {
        "id": "met_19g61nkzydqvaz",
        "name": "Landed on Home"
        },
        {
          "id": "met_19g61pkzex04ba",
          "name": "User Activated"
          },
          {
            "id": "met_19g61ukzeo5jpf",
            "name": "In-app purchase event (trial or subscription)"
          }
        ];
        return Events({from_date: "2022-02-23", to_date: "2022-02-23"})
        .filter(function(e) {
          if(e.name === "$experiment_started" && e.properties["Experiment name"] === "condensed-onboarding" && e.time >= 1645635600000) return true;
          // Metric - Signed Up
          if(e.name === "Signed Up") return true;
          // Metric - Landed on Home
          if(e.name === "Page Load" && e.properties["page"] === "Home") return true;
          // Metric - User Activated
          if(e.name === "User Activated") return true;
          // Metric - In-app purchase event (trial or subscription)
          if(e.name === "Subscribed Successfully") return true;
          return false;
        })
        // Metric value per user
        .groupByUser(function(state, events) {
          state = state || {
            inExperiment: false,
            start: null,
            variation: null,
            m0: null,
            m1: null,
            m2: null,
            m3: null, 
          };
          for(var i=0; i<events.length; i++) {
            const e = events[i];
            // User is put into the experiment
            if(!state.inExperiment && e.name === "$experiment_started" && e.properties["Experiment name"] === "condensed-onboarding" && e.time >= 1645635600000) {
              state.inExperiment = true;
              state.variation = e.properties["Variant name"];
              state.start = e.time;
              continue;
            }
            // Not in the experiment yet
            if(!state.inExperiment) {
              continue;
            }
            // Metric - Signed Up
            if(e.name === "Signed Up" && e.time - state.start < 259200000) {
              state.m0 = Math.min(1,(state.m0 || 0) + 1);
            }
            // Metric - Landed on Home
            if(e.name === "Page Load" && e.time - state.start < 3600000 && e.properties["page"] === "Home") {
              state.m1 = Math.min(1,(state.m1 || 0) + 1);
            }
            // Metric - User Activated
            if(e.name === "User Activated" && e.time - state.start < 259200000) {
              state.m2 = Math.min(1,(state.m2 || 0) + 1);
            }
            // Metric - In-app purchase event (trial or subscription)
            if(e.name === "Subscribed Successfully" && e.time - state.start < 259200000) {
              state.m3 = Math.min(1,(state.m3 || 0) + 1);
            }
          }
          return state;
        })
        // Remove users that are not in the experiment
        .filter(function(ev) {
          if(!ev.value.inExperiment) return false;
          if(ev.value.variation === null || ev.value.variation === undefined) return false;
          return true;
        })
        // One group per experiment variation with summary data
        .groupBy(["value.variation"], [
          // Total users in the group
          mixpanel.reducer.count(),
          // Metric - Signed Up
          mixpanel.reducer.numeric_summary('value.m0'),
          // Metric - Landed on Home
          mixpanel.reducer.numeric_summary('value.m1'),
          // Metric - User Activated
          mixpanel.reducer.numeric_summary('value.m2'),
          // Metric - In-app purchase event (trial or subscription)
          mixpanel.reducer.numeric_summary('value.m3'),
        ])
        // Convert to an object that's easier to work with
        .map(row => {
          const ret = {
            variation: row.key[0],
            dimension: '',
            users: row.value[0],
            metrics: [],
          };
          for(let i=1; i<row.value.length; i++) {
            ret.metrics.push({
              id: metrics[i-1].id,
              name: metrics[i-1].name,
              count: row.value[i].count,
              mean: row.value[i].avg,
              stddev: row.value[i].stddev,
            });
          }
          return ret;
        });
      }
that’s the query that is in GrowthBook and that’s what I’m seeing in Mixpanel
27 experiment started events already for this key
time for the latest one (and I think all of them) is after the experiment start time
1645635600000 is the value in the query and 1645644778 is the time in the event
f
I'm looking through the GrowthBook query now, seeing if I spot anything
Can you show me the mixpanel.track call you used to fire the event?
h
note that for react-native-mixpanel
trackWithProperties
is an alias for
track
, the library author just added separate methods per Obj C convention for each variant of arguments
f
I don't see anything obvious in the code or the query. I guess next step for debugging would be running the JQL directly in the mixpanel UI and seeing at which part the events are getting filtered out
I'm happy to help debug in Mixpanel if you wanted to hop on a quick call
h