New Feature: Deployment tracking!

Wish you could automatically track your website's performance each time you deploy?

Today we're releasing a new deployment tracking feature to let you do just that.

  • No more manually running Google Lighthouse before and after each deployment
  • View a list of your results and filter to only show deployments

I've personally used the feature to track performance improvements for PerfBeacon itself, and have reduced the app's time to interactive by more than half!

PerfBeacon results
Tracking PerfBeacon's deployments as I reduce TTI by more than half

For more detail on how I managed to more than half PerfBeacon's TTI, see this article.

Pre-requisites

Before we get started, you'll need two things:

  • An OS with support for Bash scripts
  • an API Token

  • a Site ID

    • You can find the Site ID in the Settings tab when you click into a Site
    • PerfBeacon Site ID

Let's track deployments!

  1. Create a bash script called runPerfBeacon.sh with the following contents:
#!/bin/bash

SITE_ID='<siteId>'
TOKEN='<token>'

curl --request POST \
 --url https://app.perfbeacon.com/v1/deploys \
 --header 'content-type: application/json' \
 --data "{\"token\": \"${TOKEN}\", \"site_id\": \"${SITE_ID}\"}"
  1. Make sure to replace <siteId> with the Site ID, and <token> with your token.
  2. Run chmod +x ./runPerfBeacon.sh
  3. You should now be able to run ./runPerfBeacon.sh in your Terminal, and have PerfBeacon's API respond with some metadata.

It's not particularly useful to just track deployments without knowing which git commit was deployed. We can also send PerfBeacon the hash of the deployed commit.

  1. Reopen runPerfBeacon.sh and change the contents to:
#!/bin/bash

CURRENT_HASH=$(git rev-parse HEAD)
SITE_ID='<siteId>'
TOKEN='<token>'

curl --request POST \
 --url https://app.perfbeacon.com/v1/deploys \
 --header 'content-type: application/json' \
 --data "{\"token\": \"${TOKEN}\", \"site_id\": \"${SITE_ID}\", \"commit_id\": \"${CURRENT_HASH}\"}"

At PerfBeacon, we run a similar script to this as part of our CI build process.

Enjoyed this post? Receive the next one in your inbox!