{"action":"created","issue":{"url":"https://api.github.com/repos/mixpanel/mixpanel-android/issues/198","labels_url":"https://api.github.com/repos/mixpanel/mixpanel-android/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/mixpanel/mixpanel-android/issues/198/comments","events_url":"https://api.github.com/repos/mixpanel/mixpanel-android/issues/198/events","html_url":"https://github.com/mixpanel/mixpanel-android/issues/198","id":66249543,"number":198,"title":"Feature request: screen orientation in default event properties","user":{"login":"jfsso","id":409515,"avatar_url":"https://avatars.githubusercontent.com/u/409515?v=3","gravatar_id":"","url":"https://api.github.com/users/jfsso","html_url":"https://github.com/jfsso","followers_url":"https://api.github.com/users/jfsso/followers","following_url":"https://api.github.com/users/jfsso/following{/other_user}","gists_url":"https://api.github.com/users/jfsso/gists{/gist_id}","starred_url":"https://api.github.com/users/jfsso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfsso/subscriptions","organizations_url":"https://api.github.com/users/jfsso/orgs","repos_url":"https://api.github.com/users/jfsso/repos","events_url":"https://api.github.com/users/jfsso/events{/privacy}","received_events_url":"https://api.github.com/users/jfsso/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-03T23:36:42Z","updated_at":"2015-04-06T17:58:55Z","closed_at":null,"body":"A great addition to the default event properties would be the screen orientation at the time the event happened. This was a very important state for us to know in some analysis and I guess many more people would benefit from this one if it is available in the SDK from the beginning.\r\n\r\nAn even more nicer addition would be to let us developers set some sort of event interceptor that we could use to add needed properties for events as they happen. Perhaps an API like `MixpanelAPI.getInstance(this, MIXPANEL_API_TOKEN, new EventInterceptor())`."},"comment":{"url":"https://api.github.com/repos/mixpanel/mixpanel-android/issues/comments/90176295","html_url":"https://github.com/mixpanel/mixpanel-android/issues/198#issuecomment-90176295","issue_url":"https://api.github.com/repos/mixpanel/mixpanel-android/issues/198","id":90176295,"user":{"login":"arittr","id":5742859,"avatar_url":"https://avatars.githubusercontent.com/u/5742859?v=3","gravatar_id":"","url":"https://api.github.com/users/arittr","html_url":"https://github.com/arittr","followers_url":"https://api.github.com/users/arittr/followers","following_url":"https://api.github.com/users/arittr/following{/other_user}","gists_url":"https://api.github.com/users/arittr/gists{/gist_id}","starred_url":"https://api.github.com/users/arittr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arittr/subscriptions","organizations_url":"https://api.github.com/users/arittr/orgs","repos_url":"https://api.github.com/users/arittr/repos","events_url":"https://api.github.com/users/arittr/events{/privacy}","received_events_url":"https://api.github.com/users/arittr/received_events","type":"User","site_admin":false},"created_at":"2015-04-06T17:58:55Z","updated_at":"2015-04-06T17:58:55Z","body":"@jfsso I agree that this would be killer, and I'm going to put in a request to get this added. for now you might want to try grabbing orientation with Activity.getResources().getConfiguration().orientation or something similar. you can then manually add this to the event:\r\n\r\nJSONObject props = new JSONObject();\r\ntry {\r\n     props.put(\"orientation\", this.getResources().getConfiguration().orientation);\r\n} catch (JSONException e) {\r\n     e.printStackTrace();\r\n}\r\nmMixpanel.track(\"some event\", props);\r\n\r\nORIENTATION_PORTRAIT=1 and ORIENTATION_LANDSCAPE=2 - you can parse these names out if you want more human-readable info. you can also infer the orientation by the default screen height and screen width properties - if width > height you know the device is in landscape mode. \r\n\r\ncan you explain this EventInterceptor a bit more - I just want to make sure I understand the use case before I bring it to engineering. thanks for all the feedback here! "}}