Test ID in UA?

So I know that test agents append PTST to the UA, which is useful for identifying WPT in server logs. I wonder if it’s feasible to do something along those lines to give servers a backlink to the test results. What I had in mind was if the test agents knew the ID and run number of the test, that data could be included in the UA as well. A link to the corresponding test results page could be reconstructed from the server logs.

My use case is a monitoring service that schedules tests automatically using the API. Instead of getting the ID from the API and querying for the results, I’d like to use my existing RUM pipeline to log the perf metrics. So if the UA of the test machine was logged by the RUM service, conceivably I’d be able to get back to the WPT test results page for any particular test run.
[hr]
There are actually three pieces of information needed to reconstruct the test results URL: test ID, run number, and first/repeat view.

So for example we could append the following to a UA string: “PTST/160106_ZT_13T3-r:3-c:0” which would correspond with these results: http://www.webpagetest.org/result/160106_ZT_13T3/3/details/

This could either be added by default just like PTST or enabled in the custom UA setting as a template value, like “PTST/{{test_id}}-r:{{run_number}}-c:{{repeat_view}}”. The test agent would substitute the placeholders accordingly. I think it’d be easier to do by default, but the template option adds more versatility.

WDYT?
[hr]
Filed Include test info in UA · Issue #548 · WPO-Foundation/webpagetest · GitHub

Done. It is api-only and you specify how you want the string formatted.

i.e. something like keepua=1&appendua=PTST/%TESTID%-r:%RUN%-c:%CACHED% would give you the UA string above (properly urlencoded when submitting). The keepua=1 would be needed if you want to modify the PTST string. If you just want to append something else you can leave that there.

Thanks for the quick fix! I sent Support appendua and keepua URL params on home by rviscomi · Pull Request #549 · WPO-Foundation/webpagetest · GitHub to add support for these params on the home page.