philipwalton / analyticsjs-boilerplate

Examples and best practices for using analytics.js
ISC License
1.13k stars 59 forks source link

VISIBILITY_STATE #6

Closed peter-mouland closed 7 years ago

peter-mouland commented 7 years ago

Hi, thanks for putting the time in to come up with this repo and to blog about it!

I've noticed this little snippet in the example code, but it doesn't seem to be mentioned in the blog.

VISIBILITY_STATE: 'dimension8',

I'm new to implementing ga so i'm not all there with how scope works etc. buy I'm guessing it's hit scope?

philipwalton commented 7 years ago

Ahh, yeah, looks like I forgot to include that in the post, but it is a custom dimension I track (and yes, it's hit scoped).

Basically this will tell you things like whether or not a user opened the page in a hidden tab (e.g. by command clicking or something similar).

https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API

When I have a chance I'll add some info about it (and all the custom dimensions) to the README.