https://www.growthbook.io/ logo
#give-feedback
Title
# give-feedback
p

plain-lizard-13513

09/04/2021, 8:07 AM
although the notification seems to suggest that it will start a fresh?
f

future-teacher-7046

09/04/2021, 3:49 PM
When you go to start the experiment again, it asks for a "Start Time" and anything before that date should be ignored by the queries.
p

plain-lizard-13513

09/08/2021, 2:23 PM
hey @future-teacher-7046 hmmm that wasn't what i was experiencing - i can have another go
f

future-teacher-7046

09/08/2021, 2:25 PM
If it's still not working, can you paste in what you entered for "Start Time" and one of the SQL queries when you update results?
p

plain-lizard-13513

09/21/2021, 12:12 PM
hey! sorry, i've been on vacation
am back now and this is still happening for me!
this is the default time it wants to start with
Copy code
function main() {
  // Experiment results - User decide boost UI2
  const metrics = [
    {
      "id": "met_3bwgdd13ks6bu7nn",
      "name": "created_plan"
      },
      {
        "id": "met_19g614ks32p0cy",
        "name": "appointment_booked"
      }
    ];
    return Events({from_date: "2021-09-21", to_date: "2021-09-21"})
    .filter(function(e) {
      if(e.name === "Experiment Viewed" && e.properties["experiment_id"] === "user-decide-boost-ui2") return true;
      // Metric - created_plan
      if(e.name === "created_plan") return true;
      // Metric - appointment_booked
      if(e.name === "appointment_booked") return true;
      return false;
    })
    // Metric value per user
    .groupByUser(function(state, events) {
      state = state || {
        inExperiment: false,
        start: null,
        variation: null,
        m0: null,
        m1: 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 Viewed" && e.properties["experiment_id"] === "user-decide-boost-ui2") {
          state.inExperiment = true;
          state.variation = e.properties["variation_id"];
          state.start = e.time;
          continue;
        }
        // Not in the experiment yet
        if(!state.inExperiment) {
          continue;
        }
        // Metric - created_plan
        if(e.name === "created_plan" && e.time - state.start < 259200000) {
          state.m0 = Math.min(1,(state.m0 || 0) + 1);
        }
        // Metric - appointment_booked
        if(e.name === "appointment_booked" && e.time - state.start < 259200000) {
          state.m1 = Math.min(1,(state.m1 || 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 - created_plan
      mixpanel.reducer.numeric_summary('value.m0'),
      // Metric - appointment_booked
      mixpanel.reducer.numeric_summary('value.m1'),
    ])
    // 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;
    });
  }
ah! there is no time in the query, its just date
f

future-teacher-7046

09/21/2021, 12:29 PM
ok, I see. Mixpanel doesn't let you specify timestamp when getting the initial events. We can add a custom timestamp check in the first
filter
function though
p

plain-lizard-13513

09/21/2021, 1:01 PM
ok brilliant, thx
i'll just schedule it to start from tomorrow
14 Views