Currently working implementing web and mobile analytics via AWS Amplify and Pinpoint.
I've noticed that analytics section of the Amplify docs for JS differs from the related section for iOS and Android, specifically in the extra parameters/keys/values that an event object can include.
JS docs specify an attributes
property, while the iOS and Android versions both specify something referred to as properties
. See snippets below:
JavaScript
Analytics.record({
name: 'albumVisit',
// Attribute values must be strings
attributes: { genre: '', artist: '' }
});
iOS
func recordEvents() {
let properties: AnalyticsProperties = [
"eventPropertyStringKey": "eventPropertyStringValue",
"eventPropertyIntKey": 123,
"eventPropertyDoubleKey": 12.34,
"eventPropertyBoolKey": true
]
let event = BasicAnalyticsEvent(name: "eventName", properties: properties)
Amplify.Analytics.record(event: event)
}
Android
val event = AnalyticsEvent.builder()
.name("PasswordReset")
.addProperty("Channel", "SMS")
.addProperty("Successful", true)
.addProperty("ProcessDuration", 792)
.addProperty("UserAge", 120.3)
.build()
Amplify.Analytics.recordEvent(event)
Are attributes
and properties
interchangeable? I'm going to be using Amazon QuickSight to build out analytics dashboards, ultimately the collected event data will end up on S3, and queried using Athena. I'll need to define a schema for the table in Athena and I'm uncertain, based on the above, what format I can expect the data attributes
/properties
to be in. It seems like Amazon intended for attributes
and properties
to contain the same type of event-related information. But I'm confused as to why the naming convention differs between platforms.
On iOS & Android, Amplify Analytics' String & Boolean properties are mapped to Pinpoint attributes. Double & Integer properties are mapped to Pinpoint metrics.
Or, expresssed as a table:
Amplify property type (in) | Pinpoint type (out) |
---|---|
String | Attribute |
Boolean | Attribute |
Integer | Metric |
Double | Metric |
(Refer to Amplify's Android code, iOS code.)