Retrieve User ID using SDK


#1

Hi, is it possible to retrieve the auto generated User ID using the Android and iOS SDKs? Looking at the documentation it would appear not.

I need to find a way for the user of my App to be able to view their Countly ID but before they can do this I need to be able to retrieve it. Once they can view it they can then pass it on to customer support, thus allowing them to quickly find the user's analytics data and help resolve issues that they're facing. At the moment the User ID is automatically generated by Countly.

Any help gratefully received.

Thanks
Ian


#2

Hi Ian,

As for now there are ways, but it's rather not supported. I'd suggest switching to setting custom ID instead of autogenerated one, is this an option?


#3

Ok, thanks. Custom ID may be a bit tricky at the moment.

It is possible for me to use the Restful Web APIs in addition to the iOS and Android APIs, do they support the function I need?

Thanks for your reply.

Ian


#4

Countly generated IDs are quite lengthy and it may not be easy to remember / copy / paste etc.

How about generating an easier to remember ID for that user, and show it on mobile app instead so it's easier to report? Those would be custom user properties, which can be queried later via dashboard.


#5

Thanks for the reply. Maybe I've not explained what I'm looking for very well. The ID I need is quite short, at the moment when I look at the Countly dashboard each user has an ID along the lines of #c0172, it is this that I'm looking to retrieve.

Thanks
Ian


#6

Hello Ian,
well that is not that simple :slight_smile:

Firstly what you see in user profile is only the beginning of user id, the whole user id is available in url, as
http://domain.com/dashboard#/users/1840ba57d03793a538ad8b5159d0cf779bce733d

Now about how this id is generated for each user, then it is sha1 hash of app_key and device_id from sdk requests.

And it is mostly available for internal usage.

The way we usually recommend it, is to use plain device_id and use filter in User Profiles for ID property to filter by device_id.

But currently problem is that Android SDK does not support returning this device_id, we are working on new version of the SDK, redesigning it completely, and that is why current old version might be lacking some features like this.

The best workaround is to use custom property providing your internal customer id and then filter by it in user profiles filter, or use dbviewer API to fetch user id to get link directly to specific user profile, depending on your needs.

If you still want to go with device_id, then you will probably need to modify current Android SDK to be able to retrieve it programmatically.


#7

Thank you very much for your help. It's most appreciated.

Ian


#8

Just FYI, related links:
AP reference: http://resources.count.ly/v1.0/reference#odbdbsdbcollectioncollection

Tutorial on exporting DB using DBviewer