Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Support setting the clientId #165

Open
technolion opened this issue Mar 18, 2022 · 2 comments
Open

Support setting the clientId #165

technolion opened this issue Mar 18, 2022 · 2 comments

Comments

@technolion
Copy link

In order to support tracking a user across devices it would very handy to set the clientId manually.
Support for this could be easily added by providing a setter for clientId in usage_impl.dart.

@technolion
Copy link
Author

Any chance, my pull request gets merged?

@vorte
Copy link

vorte commented Nov 10, 2022

I think you're meant to use userId instead of clientId for cross-device tracking. https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#uid

You can achieve this using by setting a session value on app startup / login. Example code:

usage_io.Analytics analytics = usage_io.AnalyticsIO(...);
if (user != null && user.userId != null) {
  analytics.setSessionValue("uid", user.userId);
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants