brown_squirrel
brown_squirrel

Reputation: 83

How do you reference today's date in Mixpanel JQL API?

event = "function main(){return Events({from_date: '2020-11-01', to_date: ... , event_selectors: [{event:'Search'}]}).groupByUser(['properties.Completion'], mixpanel.reducer.count())}"

What should I put after "to_date" to pull automatically pull today's date?

Upvotes: 0

Views: 443

Answers (1)

M.M
M.M

Reputation: 36

You can add a variable for today like in the following example:

function main() {
   //Get today's date
  var today = new Date ( (new Date())).toISOString().split('T')[0];
  return Events({
    from_date: '2020-11-01',
    to_date:   today,
  })
  .groupByUser(['properties.Completion'], mixpanel.reducer.count());
}

Upvotes: 2

Related Questions