amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-analytics uach brands is stringified to object Object

Open fredsh2k opened this issue 5 years ago • 2 comments

Description

using ${uach(brands)} results in "[object Object],[object Object],[object Object]" instead of an array of the brands, for example in my case:

brands: Array(3)
0: {brand: 'Google Chrome', version: '95'}
1: {brand: 'Chromium', version: '95'}
2: {brand: ';Not A Brand', version: '99'}

Reproduction Steps

  1. create an analytics.json config with
"transport": {
    "useBody": true,
  1. in extraUrlParams section use
      "extraUrlParams": {
        "brands": "${uach(brands)}",

Relevant Logs

No response

Browser(s) Affected

No response

OS(s) Affected

No response

Device(s) Affected

No response

AMP Version Affected

No response

fredsh2k avatar Oct 28 '21 15:10 fredsh2k

Opened a PR for a fix by JSON.stringifying non-primitive UACH values.

Can you take a look and see if this matches your expectation?

kristoferbaxter avatar Oct 28 '21 16:10 kristoferbaxter

Resolved with #36648.

kristoferbaxter avatar Oct 28 '21 18:10 kristoferbaxter