iOS - multiple trackers/multiple sites

Hey there,

What I want to achieve is to log same event twice to different sites from mobile application, is it possible from within Objective-C/Swift API code?
I achieved this in Android SDK using two tracker instances, but iOS version seems to cache things internally and doesn’t allow to create PiwikTracker objects on it’s own.

Hi @MTomczynski,

thanks for getting in contact. The current version of the SDK actually doesn’t support multiple instances within one app. But there is a running discussion about supporting that. There is an issue and a pull request about that.

Can you please elaborate the reason why you want to log to different sites? I have no such use case and would like to understand your needs.

Feel free to join the discussion on Github.

Use case for this actually came up from other problem, we can’t restrict users on Piwik site to view only specific portion of data (e.g. segments), so the idea was to elevate the data itself to site level and create specific group of users for this site but still keep the original one.

Thanks for the info.

EDIT–
Is there any expected date for this change to be merged into production?

Hi @MTomczynski, thanks for the followup! Regarding the timeline of the PR: The basics are set up so far. There is one issue left, where we are searching for a solution and that is migrating users of the old singleton over to the new method. This is important so that existing users aren’t losing any sessions of their users.
I hope I can tackle this in between the years and am ably to find a solution.