Schmijos' Blog

Track Hotjar User ID in Sentry

Stuff goes wrong on your website. It happens. We know it. We have measures to
log all kind of stuff. At Renuo we use an external service
called Sentry to log errors happening in our web apps.
We use it for backend and frontend. With it, we can log user email addresses
to find out who was affected by which error and then we try to reproduce it.

Wouldn’t it be cool to have a video which let’s us see exactly what steps the
user undertook to produce the error?

It’s easily possible. For usability tests we use
Hotjar already. So let’s simply configure Sentry
in the frontend to log the Hotjar user:

var hotjarUserId = hj.pageVisit.property.get('userId').split("-").shift();

Raven.setExtraContext({
  hotjar_user_id: hotjarUserId
})

With the next error happening we’ll see an extra field called
hotjar_user_id. Then we can filter our Hotjar video recordings for the
value in this field and we see exactly what the user did.

Be aware that this doesn’t work for all the errors happening since Hotjar
only tracks samples.

Git Tag: Sort by Version

You can list all the tags with the command git tag. The output looks like
that if you use tag your commits with versions:

2.1.2
2.10.0
2.2.0

With semantic versioning being in place you probably would like to see
the following listing:

2.1.2
2.2.0
2.10.0

Actually you can achieve that with the option
--sort.
There’s even a configuration option present for that:

git config --global tag.sort version:refname

Cloudflare and document.write

Cloudflare’s Rocket Loader is being intercepted by the new Chrome (v54) and
Firefox rules regarding document.write (more here.

Because of that, pages where Cloudflare decided to inject the rocket loader (for
example not if you visit a page with Safari) doesn’t load any scripts sourced
with data-rocketsrc.

Change the Rocket Loader mode in Cloudflare to manual or wait for a
solution.