question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to pass demographic to Analytics.updateEndpoint()

See original GitHub issue

So 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:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
saadqcommented, Apr 19, 2019

I don’t remember when I fixed this, but I believe I just updated my version of aws-amplify and it just started working.

0reactions
github-actions[bot]commented, Jun 12, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enable Demographics and Interests reports - Analytics Help
To make the Demographics and Interests data available in Analytics, you need to: Update Analytics to support Advertising Reporting Features.
Read more >
Adding endpoints to Amazon Pinpoint
You can use Amazon Pinpoint by running commands with the AWS CLI. Example Update endpoint command. To add or update an endpoint, use...
Read more >
Analytics - Update Endpoint - JavaScript - AWS Amplify Docs
Analytics. Update Endpoint. An endpoint uniquely identifies your app within Pinpoint. In order to update your endpoint use the updateEndpoint() method:.
Read more >
Event Capture Copy to Mobile Applications through the AWS ...
which in this case will be demographic. import * as Device from 'expo-device';. Analytics.updateEndpoint({. channelType: 'APNS', demographic: {.
Read more >
altis/aws-analytics - Packagist
The optional 3rd parameter allows you to simulataneously update the endpoint data as if calling Altis.Analytics.updateEndpoint() . These attributes, metrics and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found