philipwalton / analyticsjs-boilerplate

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

Visibility State and URL Query Params dimension Scope #16

Closed rickitan closed 7 years ago

rickitan commented 7 years ago

Hi Phil,

Thank you for all your work. I've started to learn more about analytics and your resources have been great. I've a question about the last two dimension on this object:

const dimensions = {
  TRACKING_VERSION: 'Tracking Version',
  CLIENT_ID: 'Client ID',
  WINDOW_ID: 'Window ID',
  HIT_ID: 'Hit ID',
  HIT_TIME: 'Hit Time',
  HIT_TYPE: 'Hit Type',
  HIT_SOURCE: 'Hit Source',
  VISIBILITY_STATE: 'Visibility State',
  URL_QUERY_PARAMS: 'URL Query Params',
};

What should the scope be? To fill this form:

image

Thank you, -Ricardo.

philipwalton commented 7 years ago

Set a "Hit" scope as these values can change within a session (and thus user).

In general, if you're unsure, the safest bet is "Hit" as it's the most flexible. This video on the Google Analytics data model might help you better understand when to choose which.