Closed DanilShkarupin closed 4 months ago
Hi @DanilShkarupin, thank you for reporting this problem!
Have you tried configuring the useragent when creating the tracker? I mean something like:
let subjectConfig = SubjectConfiguration()
.useragent("my-user-agent")
let networkConfig = NetworkConfiguration(endpoint: "https://snowplow-collector-url.com")
Snowplow.createTracker(
namespace: "appTracker",
network: networkConfig,
configurations: [subjectConfig]
)
Hi @matus-tomlein, thank you for your suggestion. It's a better way to configure Subject and it will work for my case as I don't expect useragent to change.
Unfortunately issue still persists and this value doesn't show up in outgoing requests.
Thanks for checking that @DanilShkarupin!
I have tried to reproduce the problem, but don't seem to be able to. I set the useragent using the SubjectConfiguration
and passed that to createTracker
. When I checked the tracked events in Snowplow Micro, I could see that the useragent
property under event
was correctly set.
To clarify, overriding the useragent in this way doesn't change the HTTP request headers – those will not change if you configure the subject useragent. However, inside the event body, you should be able to see the useragent property that will override the information in the HTTP headers.
Where are you checking the useragent property? Is it not present in the event body as well?
Thanks @matus-tomlein,
When I check ua
value inside event body it has expected value. I was expecting to see new value in headers, but from your response it seems it's not supposed to be here.
Issue is resolved then.
Describe the bug Setting
useragent
inTrackerController.Subject
doesn't seem to affect resulting request. In documentation it seems to be intended for this purpose.To Reproduce
TrackerController
setsubject?.useragent
to some custom valueExpected behavior user-agent header value in sent request equals your custom value
Screenshots If applicable, add screenshots to help explain your problem.
Device information (please complete the following information):
Additional context The only other way I found to override user agent was to set it in
DefaultNetworkConnection.requestHeaders
. When I was debugging this behaviour, I found that custom value ofuser-agent
gets lost inDefaultNetworkConnection
, when you createURLRequest
fromRequest
.