Unable to pass demographic to Analytics.updateEndpoint()
See original GitHub issueSo as a preface to the issue I mentioned in the title, I wanted to first mention another issue I saw in the docs for Analytics. The updateEndpoint()
docs seem to say to pass in an object like so for user attributes:
Analytics.updateEndpoint({
// User attributes
userAttributes: {
interests: ['football', 'basketball', 'AWS']
// ...
}
})
However this led to UserAttributes
being undefined
when inspecting the debug logs with Amplify.Logger.LOG_LEVEL = 'DEBUG'
. I was only able to get it to work when using UserAttributes
instead of userAttributes
.
So the current issue I’m facing is that I can’t seem to get the demographic
passed no matter what I do. The docs mention to do something like:
Analytics.updateEndpoint({
demographic: {
appVersion: 'xxxxxxx', // The version of the application associated with the endpoint.
locale: 'xxxxxx', // The endpoint locale in the following format: The ISO 639-1 alpha-2 code, followed by an underscore, followed by an ISO 3166-1 alpha-2 value
make: 'xxxxxx', // The manufacturer of the endpoint device, such as Apple or Samsung.
model: 'xxxxxx', // The model name or number of the endpoint device, such as iPhone.
modelVersion: 'xxxxxx', // The model version of the endpoint device.
platform: 'xxxxxx', // The platform of the endpoint device, such as iOS or Android.
platformVersion: 'xxxxxx', // The platform version of the endpoint device.
timezone: 'xxxxxx' // The timezone of the endpoint. Specified as a tz database value, such as Americas/Los_Angeles.
}
})
However, no matter what I pass to updateEndpoint
, it doesn’t seem to get actually get sent in the request. As a simple example, let’s say I just wanted to pass in an appVersion
(though I tried several other things as well like make
, model
, etc). I have tried doing different variations with casing like:
Analytics.updateEndpoint({
...
demographic: {
appVersion: '0.1.0'
}
})
and
Analytics.updateEndpoint({
...
Demographic: {
appVersion: '0.1.0'
}
})
and
Analytics.updateEndpoint({
...
Demographic: {
AppVersion: '0.1.0'
}
})
…etc
but none of them seemed to work. No matter what I pass to the demographic section, I always see something like this in the logs when testing on the iOS simulator:
[22:04:57] "[DEBUG] 04:57.128 AWSPinpointProvider - updateEndpoint with params: ": Object {
[22:04:57] "ApplicationId": "...",
[22:04:57] "EndpointId": "...",
[22:04:57] "EndpointRequest": Object {
[22:04:57] "Address": "...",
[22:04:57] "Attributes": undefined,
[22:04:57] "ChannelType": "APNS",
[22:04:57] "Demographic": Object {
[22:04:57] "AppVersion": "ios/12.1",
[22:04:57] "Make": "iPhone",
[22:04:57] "Model": "iPhone 6/7/8 plus",
[22:04:57] "ModelVersion": "12.1",
[22:04:57] "Platform": "ios",
[22:04:57] },
[22:04:57] "EffectiveDate": "...",
[22:04:57] "OptOut": undefined,
[22:04:57] "RequestId": undefined,
[22:04:57] "User": Object {
[22:04:57] "UserAttributes": Object {
[22:04:57] "email": Array [
[22:04:57] "...",
[22:04:57] ],
[22:04:57] "email_verified": Array [
[22:04:57] "...",
[22:04:57] ],
[22:04:57] "name": Array [
[22:04:57] "...",
[22:04:57] ],
[22:04:57] "sub": Array [
[22:04:57] "...",
[22:04:57] ],
[22:04:57] },
[22:04:57] "UserId": "...",
[22:04:57] },
[22:04:57] },
[22:04:57] },
Notice that the Demographic
object in there ignores the app version I pass to it. Additionally, if I try to pass in other things like locale
or whatever, it still always sticks to this same exact Demographic
object passed in to the request. It seems like it just doesn’t use my Demographic
object I pass to it no matter what.
This is v1.1.8
. Let me know if I can provide any other info, and any help would be appreciated. Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
I don’t remember when I fixed this, but I believe I just updated my version of
aws-amplify
and it just started working.This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels or Discussions for those types of questions.