matomo-org / matomo-sdk-ios

Matomo iOS, tvOS and macOS SDK: a Matomo tracker written in Swift
MIT License
390 stars 164 forks source link

Add support for userID #46

Closed mattiaslevin closed 9 years ago

mattiaslevin commented 10 years ago

Add support for the new userID feature added in Piwik 2.7.0 http://piwik.org/docs/user-id/

How does uid related to cid and _id?

mattab commented 10 years ago

Hi @mattiaslevin

How does uid related to cid and _id?

to keep things simple here is proposal:

Does it help?

mattiaslevin commented 10 years ago

Thanks, just a few more questions:

-Is the _id a unique identifier for the user or for the current session (should I generate the _id just one time for the same user or change each session)? -I am guessing the SDK should always generate the _id behind the scenes and pass to the Piwik server. The user can optionally set a uid? -This would mean that if the same user is running on two different devices (e.g. iOS and Android) each device will have its own randomly generated _id but can set the same uid. Piwik will then be able to combine the events for the same uid? -Just for curiosity, what is cid? (and alternative to uid)?

mattab commented 10 years ago

-Is the _id a unique identifier for the user or for the current session (should I generate the _id just one time for the same user or change each session)?

_id is an identifier for the current user. (it maps to Visitor Id)

-I am guessing the SDK should always generate the _id behind the scenes and pass to the Piwik server. The user can optionally set a uid?

Sounds good!

-This would mean that if the same user is running on two different devices (e.g. iOS and Android) each device will have its own randomly generated _id but can set the same uid. Piwik will then be able to combine the events for the same uid?

As soon as &uid= is set then Piwik will simply ignore the _id= parameter even when it is set. uid always takes precedence over &_id and &cid

-Just for curiosity, what is cid? (and alternative to uid)?

cid was in some way the feature we exposed because we hadnt yet implemented User ID. now that user id exists it's better to use this instead of cid. cid still works but it's less convenient to use since you must pass a 16 chars hex string which is less convenient than setting any arbitrary user id.

mattiaslevin commented 9 years ago

Fixed in 3.0.0