voxa-ama
v0.2.5
Published
Integrate Amazon Mobile Analytics analytics into your Alexa apps using the voxa framework
Downloads
5
Readme
Voxa AWS Mobile Analytics
An AWS Mobile Analytics plugin for voxa
Installation
Just install from npm
npm install --save voxa-ama
Usage
const voxaAma = require('voxa-ama');
const amaConfig = {
appId: 'appId',
appTitle: 'appTitle',
make: 'Amazon',
platform: 'Alexa',
cognitoIdentityPoolId: 'cognitoIdentityPoolId',
suppressSending: false, // A flag to supress sending hits. Useful while developing on the skill
};
voxaAma(skill, amaConfig);
Suppressing State Events
Sometimes smaller intermediary states can flood the pathways diagram. Suppress a state from logging as follows:
skill.onState('my-state', (voxaEvent) => {
voxaEvent.ama.ignore();
return { reply: 'Greeting', to: 'my-next-state' };
})
Logging custom variables
You can also add additional values which will be logged along with the state custom event
skill.onState('my-state', (voxaEvent) => {
voxaEvent.ama.logEvents('response', 'hello');
return { reply: 'Greeting', to: 'my-next-state' };
})
Specific Events
You can also log custom events from a state.
skill.onState('my-state', (voxaEvent) => {
voxaEvent.ama.logEvents('my-custom-event', { myVariable: 'hello' });
return { reply: 'Greeting', to: 'my-next-state' };
})
Creating AWS Mobile Analytics project
AWS Mobile Analytics works hand on hand with Pinpoint and Cognito Pools. The values we need for tracking analytics are:
- App ID
- App Name
- Cognito Identity Pool ID
For creating the property, you should follow the next steps:
Log in with your AWS account, then in the AWS Dashboard, look for mobile analytics
In the main menu of AWS Analytics hit the Get Started with Amazon Pinpoint button
You will see here your pinpoint apps. Hit the Create a project in Mobile Hub button
Enter the name and select the region, the default region is US East (Virginia)
Once created, make sure the Analytics checkbox is enabled
In this step, some resources will be automatically created: a specific role with S3, Pinpoint and Analytics permissions, a Cognito Pool Identity to manage authentication from users and an Amazon S3 Bucket to export your data.
Now, go to the AWS Mobile Analytics menu and you will see your analytics project ready to receive events from your skill
You will see the App Name at the top of the page. Click on it and hit the Manage Apps butotn
Here there are all the mobile analytics project including the one you just created. In the second column you will see the App Id for your project
After that, look for Cognito
Hit the Manage Federated Identities button
You will see your cognito pool identities, click on the one created for your project
You might need to fix something in the configuration, you need to specify the role for your cognito pool. You can either hit the Click here to fix or Edit identity pool link to go to the configurations.
In this screen you can grab the Identity Pool ID and add the role missing.
Once you have the App ID, App Name, and Cognito Pool ID you can add them to the voxa plugin configuration and start tracking the events in your skill. Keep in mind the events will last up to 1 hour to show up in the dashboard and it will look like this: