Provide ability to conditionally append key-value pair in amp-analytics
In some analytics platforms, when a parameter is empty the expected behavior is to not include that parameter in the request. For example, if there was an optional user-defined authors variable and the user left the value undefined, the request would not contain an authors parameter.
Is this blocking for your integration?
Is this blocking for your integration?
No. We've tested our systems with empty query params and everything is working as expected. At this time, this issue is not a high priority from Chartbeat's perspective.
@cramforce @avimehta LMK if this works:
I intend to implement this as a new boolean config option, skipEmptyUrlParams, which, when true, will omit "vars" and "extraUrlParams" if the value is anything other than a non-empty string.
vars can't be omitted like that. For example, lets say this is my config:
{
"requests": { "foo": "/foo?bar=${baz}" },
"vars": { "baz" = "" }
}
In this case, regardless of the value of `baz`, the parameter `bar` will always be there. It's value will be empty if `baz` is empty but it will still be sent over wire.
This hasn't been discussed in awhile. Closing since it's pretty low in priority but we can reopen if anyone has a specific need for this.