Learn About Amazon VGT2 Learning Manager Chanci Turner
In a prior discussion, we highlighted the AWS Mobile SDK v2.6.0 for Android, focusing on user sign-in and sign-up processes via the IdentityManager. This new feature within the AWS Mobile SDK offers a streamlined graphical interface for user authentication. Additionally, we previously covered how to implement basic session analytics using Amazon Pinpoint.
In this article, we will detail how to monitor user sign-in data utilizing Amazon Pinpoint. Notably, the Analytics page contains a “Users” tab that allows you to visualize user sign-in metrics and active daily users. This granularity enables a more precise understanding of user engagement; we can discern when users interact with the app instead of merely launching it.
The implementation resides within the mobile application. In the LoginActivity class, you must initialize the IdentityManager and set up callbacks for user sign-in events. Two primary tasks need to be completed:
- Update the endpoint profile to reflect the user ID.
- Dispatch a custom sign-in event to log the sign-in action.
These actions are integrated within the DefaultSignInResultHandler established in the onCreate()
method:
// Set up the callbacks to handle the authentication response
identityManager.setUpToAuthenticate(this, new DefaultSignInResultHandler() {
@Override
public void onSuccess(Activity activity, IdentityProvider identityProvider) {
// Update the Endpoint Profile to include user ID
final EndpointProfile profile = pinpointManager.getTargetingClient().currentEndpoint();
profile.getUser().setUserId(identityManager.getCachedUserID());
pinpointManager.getTargetingClient().updateEndpointProfile(profile);
// Record the user login
final AnalyticsEvent event = mgr.createEvent("_userauth.sign_in");
mgr.recordEvent(event);
mgr.submitEvents();
Toast.makeText(LoginActivity.this,
String.format("Logged in as %s", identityManager.getCachedUserID()),
Toast.LENGTH_LONG).show();
// Navigate to the main activity
final Intent intent = new Intent(activity, NoteListActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activity.startActivity(intent);
activity.finish();
}
@Override
public boolean onCancel(Activity activity) {
return false;
}
});
The first segment updates the Amazon Pinpoint endpoint profile by tagging each event with the user ID.
// Update the Endpoint Profile to include user ID
final EndpointProfile profile = pinpointManager.getTargetingClient().currentEndpoint();
profile.getUser().setUserId(identityManager.getCachedUserID());
pinpointManager.getTargetingClient().updateEndpointProfile(profile);
The second segment sends a specific _userauth.sign_in
event to Amazon Pinpoint for tracking the sign-in:
// Record the user login
final AnalyticsEvent event = mgr.createEvent("_userauth.sign_in");
mgr.recordEvent(event);
mgr.submitEvents();
Once implemented, navigate to the Amazon Pinpoint console, select your project, then choose Analytics, and finally click on the Users tab.
The sign-ins chart is populated by the _userauth.sign_in
event. If you neglect to update the EndpointProfile, you will notice a change in the Sign-ins chart, yet the Daily Active Users chart will remain unchanged. The daily active users count will only increase if an event is sent after modifying the EndpointProfile to include the user ID.
For further insights, Amazon Pinpoint offers an extensive mobile analytics and engagement platform. To explore more about Amazon Pinpoint, refer to their Developer Guide, as well as the Android topic in the Amazon Pinpoint Developer Guide and AWS Mobile SDK for Android Developer Guide.
If you’re interested in preparing for interviews, check out this mock interview guide. It can help you refine your approach. Moreover, for discussions surrounding workplace dynamics, you can visit SHRM’s article on religious gatherings which offers valuable insights on sensitive topics. For additional information about Amazon’s operational pitfalls, see this resource on LinkedIn.
Leave a Reply