Tracking Users

One advantage of Amazon Pinpoint is it simplifies customer engagements. So let’s extend our Pinpoint setup to be able to run such campains.

First of all we need to enable email sending for our Pinpoint Service.

  1. Browse to the Amazon Pinpoint service console

  2. Go to Settings -> Email

  3. Select Edit at the Identities tab on the bottom

  4. Select Enable the email channel for this project

  5. Type in your Email address for verification

  6. Click on save

You’ll receive an email with your verification link. after verifying your address you’re ready to use Pinpoints Email sending function.

Next we need to extend our code to track our Users and collect data to generate campains or other fancy stuff.

edit src/App.js once again and add something like:

const mappedobjects = f => obj =>
  Object.keys(obj).reduce((acc, key) => ({ ...acc, [key]: f(obj[key]) }), {});
const Arrayofourstrings = value => [`${value}`];
const mapArrayofourstrings = mappedobjects(Arrayofourstrings);

async function trackUserIdforPinpoint() {
    const { attributes } = await Auth.currentAuthenticatedUser();
    const userAttributes = mapArrayofourstrings(attributes);
    Analytics.updateEndpoint({
      address: attributes.email,      
      channelType: 'EMAIL',      
      optOut: 'NONE',      
      userId: attributes.sub,      
      userAttributes,    
    });
  } 

trackUserIdforPinpoint();

Wait a few minutes and you should be able to see “Active targetable endpoints” in your Campaign Dashboard section:

pinpoint demographic

Extend your business with Amazon Pinpoint

As you might have noticed, Amazon Pinpoint offers much more than just user activity tracking in your application. Tinker around and try to generate value for your business using the analytics data! To get started you can use our Amazon Pinpoint workshop