keolo / mixpanel_client

Ruby interface to the Mixpanel Data API
MIT License
148 stars 72 forks source link

Example "engage" endpoint documentation #50

Closed afgarcia86 closed 8 years ago

afgarcia86 commented 8 years ago

https://mixpanel.com/docs/api-documentation/data-export-api#engage-default

I guess this isn't technically an issue but I am hoping you can explain how I would use the engage endpoint? How would I properly pass a value in the where field?

ex: I want to query for a user that has the ID that equals X

keolo commented 8 years ago

I haven't tried it but I'd imagine it'd be something like this:

client = Mixpanel::Client.new(
  api_key:    'changeme',
  api_secret: 'changeme'
)

data = client.request(
  'engage',
  where: 'expression'
)
afgarcia86 commented 8 years ago

Ah I figured, I am still have trouble properly writing the expression, not on you but the mix panel docs are not super clear to me as a more novice developer. If you are familiar with it mind writing a sample expression?

keolo commented 8 years ago

I'm not familiar with the syntax of the expression unfortunately. However, if you find the solution, feel free to post it here.

agirlnamedsophia commented 7 years ago

@afgarcia86 I have found this to work for me:

props = [ (properties[\"uid\"] == \"#{mixpanel_id_a}\") or (properties[\"uid\"] == \"#{mixpanel_id_b}\") ]

parameters = { 'selector' => props }
client.request('engage', parameters)