Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share common installationId #74

Closed
duckworth opened this issue Nov 9, 2015 · 4 comments
Closed

Share common installationId #74

duckworth opened this issue Nov 9, 2015 · 4 comments
Labels
feature-request Request a new feature question General question

Comments

@duckworth
Copy link

The installationId that is sent up to lambda https://github.com/aws/aws-sdk-android/blob/a335077bb6a77a4bfce9b9263850d010518c5bce/aws-android-sdk-lambda/src/main/java/com/amazonaws/mobileconnectors/util/ClientContext.java#L95 is completely different then the clientId that the mobile analytics SDK sends up https://github.com/aws/aws-sdk-android/blob/a335077bb6a77a4bfce9b9263850d010518c5bce/aws-android-sdk-mobileanalytics/src/main/java/com/amazonaws/mobileconnectors/amazonmobileanalytics/internal/core/idresolver/SharedPrefsUniqueIdService.java#L46.

Would be great if these could be the same so that custom events could be reported by a lambda function and have them associated with the same client_id on the backend as the events reported by the client device itself.

@fosterzhang
Copy link
Contributor

There are a few concepts here. For Amazon Mobile Analytics, the app_id is generated for you during the app creation wizard. The app_id is used to group your data in the Mobile Analytics console. The client_id is a generated value by MobileAnalyticsManager. It's unique per app_id. It's used to identify the app under the given app_id. Amazon Mobile Analytics allows you to have multiple app_ids in the same app to route analytics data to different destinations. That said it's possible to have multiple client_ids and client_id isn't unique in the app as a result.

The installation_id is intended for AWS Lambda and is aiming to uniquely identify an app for the SDK. It is generated per app installation and will be persisted till the app is removed or data is cleared. Regardless how many AWS Lambda clients you have, there is only one installation_id per app installation. This value is recommended for tracking purpose in AWS Lambda.

Currently these values aren't associated due to the differences. If you want, you can send the client_id of Amazon Mobile Analytics to Lambda and form an connection yourself.

For more information, please see Amazon Mobile Analytics documentation.

@fosterzhang fosterzhang added question General question wontfix This may be a valid issue but is accepted as a known defect or existing behavior. and removed wontfix This may be a valid issue but is accepted as a known defect or existing behavior. labels Nov 10, 2015
@duckworth
Copy link
Author

OK, I understand they have differences. I guess my higher level point is that using Cognito, Lambda and MobileAnalytics together has been challenging and is lacking in cohesion when it comes to identifying specific device installations.

From what I can gather, Cognito represents a User and has no device identifier mechanism. Analytics will send you the Cognito IdentityId all the way to the backend (S3/Redshift) but it associates it with the client_id. Lambda conveniently provides an authenticated Cognito Identity but sends up installation_id. Like you said we can send up client_id manually as a parameter, but it feels like this should be in the context, since all the other data is there (including app name, version, etc.). The other challenge is that trying to submit an event to Analytics on the server from Lambda on behalf of the client is a challenge, as there is no way to submit the Cognito Identity Id to MobileAnalytics so that it shows up in the same attributes on the backend (have to force it into a custom attribute) see aws/aws-sdk-mobile-analytics-js#8.

Also, It would be great if the installation_id would be exposed in the client SDK in a public method. All we could find was getting the the whole ClientContext toBase64String and parsing it out.

@fosterzhang fosterzhang added the feature-request Request a new feature label Nov 12, 2015
@fosterzhang
Copy link
Contributor

@duckworth I see your point here. I'll keep it in mind in future improvements. I'll also think about exposing the installation_id as you suggested. Stay tuned.

@fosterzhang
Copy link
Contributor

This has been added to v2.2.10 release. Please check out the release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature question General question
Projects
None yet
Development

No branches or pull requests

2 participants