Table of Contents

Google Analytics - Utmb cookie

About

The Utmb cookie is one of the Ga cookie that fulfill the role of session cookie

It's used to determine new sessions/visits.

Management

Structure

The utmb cookie contains the session identifier visitId (Doc. This is only unique to the user. For a completely unique ID, you should use a combination of fullVisitorId and visitId.

Example:

67809543.362.8.1578905981775

where:

How to read it programmatically ?

cookie_key = "__utmb";
regexp = new RegExp("(?:(?:^|.*;\\s*)"+cookie_key+"\\s*\\=\\s*([^;]*).*$)|^.*$");
var utmbValue = parent.document.cookie.replace(regexp, "$1");
console.log('Your utmb value is '+utmbValue);
utmbs = utmbValue.split('.');
console.log('Domain Hash is: '+utmbs[0]);
console.log('The visitId ? is:  '+utmbs[1]);
console.log('The number of visit ? is:  '+utmbs[2]);
console.log('The last interaction was at: '+(new Date(Number(utmbs[3]))));