1

As part of collecting my custom attributes for my Fabric Anwers events, I would like to obtain the birth year of my users.

This is set in app and ranges from 1920 to 2002. So, when an event is triggered, the users birth year is associated with the event as a custom attribute with type Int. For example:

Answers.logSearch(withQuery: searchText, customAttributes: ["BirthYear" : 1978])

On observing the event in the Fabric web app, I noticed that my custom attribute, "BirthYear" has been rounded to 2000 (2k in the Events dashboard). This is not granular enough for me for obvious reasons.

Is there any way to prevent this rounding from occuring, or would the best way to overcome this be by giving each birth year a value from 1 to 82, where 1 represents 1920 and 82 represents 2002. Would this still be rounded? Such that 82 would be rounded to 100? I want to be able to use this data to work out the average age of my users when certain events are triggered in my app.

I know this next part should be posted as a separate question, but can i delete the event(s) that have been rounded to 2000?

pho_pho
  • 672
  • 11
  • 30

1 Answers1

2

From personal experience, there isn't a way to disable the effect you're seeing. Also, I don't believe it is rounding but, from our analytics, it appears to be averaging the number sent in. If you want to retain the value, I suggest you send it in as a string.

Answers.logSearch(withQuery: searchText, customAttributes: ["BirthYear" : "1978"])

Josh Hrach
  • 1,238
  • 8
  • 15
  • 1
    Interestingly, if you use a string value of "NotSet" or "Undefined" for one of your custom attribute dictionary keys, the values do not show up in the dashboard... I have had to use N/A when a user doesn't provide their birth year – pho_pho Sep 26 '18 at 23:21
  • @pho_pho That's interesting. I like Fabric for a lot of things, but little quirks like this are making it hard to go with it for some new projects. – Josh Hrach Sep 27 '18 at 18:03
  • 1
    Mike from Fabric here. Josh's answer is correct and it depends on if you use a number or a string. From our docs, but good to know this is too hard to find. A couple of things to know on how we treat NSNumbers and NSStrings which are the two supported types of attributes. NSNumbers - As this data is collected, you will see the distribution of values over time. NSStrings are used as categorical data so that you can compare the data across the different values. – Mike Bonnell Sep 28 '18 at 15:36
  • 1
    @MikeBonnell Thanks for the official confirmation! – Josh Hrach Sep 28 '18 at 19:06