Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not showing properties with false values in Mixpanel's Live view #82

Open
AngelaBinogi opened this issue Oct 30, 2020 · 3 comments
Open
Assignees

Comments

@AngelaBinogi
Copy link

When sending an event with a boolean property that can have the value of true or false, the property is shown when there is true value on the property and is not shown when it’s false.
For instance, I have an event called ‘Test event’ and a db property test_property that has a boolean value (true or false).

$this->mixPanelClient->track("Test event", ['Test property' => is_null($test_property) ?: false]);

Unit testing is working in a case when test_property is false, but when I go to Mixpanel Live view and check the event the property is not there. It only shows it when it is true.

@mikebronner mikebronner self-assigned this Oct 30, 2020
@mikebronner
Copy link
Owner

Hi @AngelaBinogi , this sounds like a MixPanel issue, or rather how mix panel functions. You could try logging the bool as a string instead?

$this->mixPanelClient
    ->track("Test event", [
        'Test property' => is_null($test_property)
            ? "true"
            : "false"
        ]);

@jason-vault
Copy link

@mikebronner @AngelaBinogi I don't believe this is a Mixpanel issue.

The track() method in this package uses array_filter without a callback specified to filter the event properties.

By default, array_filter will use empty() to filter the array if no callback is specified. This means that any keys with a value that evaluates to true when run through empty() will be filtered out.

<?php
var_dump(array_filter(['foo' => 'bar', 'something_falsy' => false]));
var_dump(empty(false));

array(1) {
  ["foo"]=>
  string(3) "bar"
}
bool(true)

@ozanhazer
Copy link

This causes properties with false, 0 and '0' values not shown in the event detail which creates confusion in the team like is it because the events are sent wrong or the value was filtered out.
Also, it'd make it impossible to analyze props with 0 values I think.

Even filtering out nulls and empty strings might make sense, I believe the data should not be filtered out at all and the developer should have the freedom to decide on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants