Menu
Amazon Pinpoint
Developer Guide

Registering Endpoints

When a user starts an app session (the app comes to the foreground), the AWS Mobile SDK for iOS automatically registers (or updates) an endpoint with Amazon Pinpoint. The endpoint uniquely identifies the user's mobile device. It includes attributes that describe the device, and it can include custom attributes that you define.

After your app registers endpoints, you can segment your audience based on endpoint attributes, and you can engage these segments with tailored messaging campaigns. You can also use the Analytics page in the Amazon Pinpoint console to view charts about endpoint registration and activity, such as New endpoints and Daily active endpoints.

While the endpoint uniquely identifies the mobile device, you can assign user IDs to endpoints to uniquely identify users. You can assign a single user ID to multiple endpoints. In this case, the user ID would represent an individual who uses your app on multiple devices, such as an iPhone and an iPad. After you assign user IDs to your endpoints, you can view charts about user activity in the console, such as Daily active users and Monthly active users.

Adding Custom Endpoint Attributes

Use the targetingClient of the AWSPinpoint class to add custom attributes to endpoints. The following examples add a favoriteTeams custom attribute.

Objective-C

Copy
[[_pinpoint.targetingClient addAttribute:@[@"Lakers",@"Clippers"] forKey:@"favoriteTeams"]; [_pinpoint. targetingClient updateEndpointProfile];

Swift

Copy
let pinpointTargetingClient = AWSMobileClient.sharedInstance.pinpoint!.targetingClient pinpointTargetingClient.addAttribute([“Lakers”,”Clippers”], forKey: "favoriteTeams") pinpointTargetingClient.updateEndpointProfile()

Assigning User IDs to Endpoints

Assign user IDs to endpoints by doing either of the following:

  • Manage user sign-up and sign-in with Amazon Cognito user pools.

  • Use the AWSPinpoint class to assign user IDs to endpoints.

Amazon Cognito user pools provide user directories that make it easier to add sign-up and sign-in to your app. When the Mobile SDK for iOS registers an endpoint with Amazon Pinpoint, Amazon Cognito automatically assigns a user ID from the user pool. For more information, see Using Amazon Pinpoint Analytics with Amazon Cognito User Pools in the Amazon Cognito Developer Guide.

If you don't want to use Amazon Cognito user pools, you can use the targetingClient of the AWSPinpoint class to assign user IDs to endpoints, as shown in the following examples.

Objective-C

Copy
AWSPinpointEndpointProfile *profile = [_pinpoint.targetingClient currentEndpointProfile]; profile.user.userId = @"UserIdValue"; [[_pinpoint targetingClient] updateEndpointProfile:profile];

Swift

Copy
let profile: AWSPinpointEndpointProfile = (pinpoint?.targetingClient.currentEndpointProfile())!; profile.user?.userId = "UserIdValue"; pinpoint?.targetingClient.update(profile);