You can add scripts to the URLs you test. When you edit a Site in your Settings, there's a script icon next to each URL that allows you to add scripts.
With scripting, you're able to do all sorts of things like add headers, set cookies, step through a number of pages or perform actions on a page like logging in or adding an item to a shopping cart.
SpeedCurve scripting caveats
There are a few things to be aware of when writing scripts for synthetic tests.
Results must contain a single step
More complex scripts will sometimes end up generating results with multiple steps, like this:
SpeedCurve will not be able to parse these results, because it does not know which step to use as the final result. You can avoid generating multiple steps by putting
combineSteps at the top of your script.
The setEventName command is not supported
setEventName command creates an extra step in the test results, which SpeedCurve cannot parse (see above). You should avoid using this command in your scripts.
Scripts don't work in Lighthouse
Lighthouse doesn't support synthetic scripting.
Extra SpeedCurve Script options
We've added support for preserving the user agent string and not adding "PTST". Some ad providers block all requests which include "PTST" in the user agent and this can skew your metrics if you're wanting to test the full page load with ads. To remove "PTST" from the user agent string you can add "speedcurve_removePTST", a tab, and then "1" to your script to remove it.
Clears the OS certificate caches which causes IE to do OCSP/CRL checks during SSL negotiation if the certificates are not already cached.
There are a number script templates available that will generate a script for you using the URL field.
Loads the page a second time allowing you to measure the cached performance of the page.
Block Third Party
Only allows requests for the first party domains listed. Great for blocking all third party requests to ad providers, analytics tags etc. so you can measure the performance of the assets you control. Once you add the script you can manually edit it to add more space delimited first party domains if needed.
PWA: Repeat View While Offline
Progressive Web Apps are great for delivering content while offline. This script loads your PWA, then blocks all network requests and reloads the page again allowing you to check what the offline performance is like and ensure that the user experience is still rendering via the filmstrips.
Don't add 'PTST' to user agent
Some ad providers block all requests which include "PTST" in the user agent and this can skew your metrics if you're wanting test the full page load including ads. This script adds "speedcurve_removePTST" which does what it says on the tin.