What is a web session?

A web session is a series of contiguous actions by a visitor on an individual website within a given time frame. This could include your search engine searches, filling out a form to receive content, scrolling on a website page, adding items to a shopping cart, researching airfare, or which pages you viewed on a single website. Any interaction that you have with a single website is recorded as a web session to that website property.

Websites use a session ID to respond to user interactions during a web session.
Websites use a session ID to respond to user interactions during a web session.

To track sessions, a web session ID is stored in a visitor’s browser. This session ID is passed along with any HTTP requests that the visitor makes while on the site (e.g., clicking a link).

“Session” is the term used to refer to a visitor’s time browsing a web site. It’s meant to represent the time between a visitor’s first arrival at a page on the site and the time they stop using the site.

The code that initializes a session also includes an expiration, so a single session never lasts beyond a certain duration, at least as far as the web property is concerned. Depending on the site, a developer may define a web session as short as five minutes or as long as 1,440 minutes (an entire day).

What is a session on Google Analytics?

A session on Google Analytics begins when a user visits a site. There are two methods Google uses to expire an account:

  • Google Analytics sessions can expire on a time basis.
    • After 30 minutes of visitor inactivity
    • At midnight
  • Also, Google Analytics sessions can expire on a campaign basis.
    • If a user enters the site from one marketing campaign, leaves, and then returns via another marketing campaign.

What are cookies and sessions?

A cookie is a small piece of data from a web site that is stored on a visitor’s browser to help the website track the visitor’s activity on the web site. Sessions and cookies are sometimes conflated, creating confusion. More specifically, session IDs and cookie IDs are confused. While they are closely related, they are not the same thing. A cookie identifies, often anonymously, a specific visitor or a specific computer. Cookies can be used for authentication, storing site preferences, saving shopping carts, and server session identification

By knowing who is visiting a site and what they’ve done before, web developers can customize pages to create a personalized web experience. For example, a cookie may store information such as your name and preferences that it gathered when you filled out a form, then use that information to populate pages you visit throughout one or multiple web sessions.

Server logs typically contain both the session ID and cookie ID of a visitor. A web session ID is unique to a specific visit, while a cookie is unique to a specific visitor and thus (developers hope) remains the same through multiple web sessions. By mapping a single cookie ID to multiple session IDs, developers and analysts can get a clearer picture of how visitors interact with their web applications.

Why is a web session used? (Web session use case examples)

To avoid storing massive amounts of information in-browser, developers use session IDs to store information server-side while enabling user privacy. Every time a user takes an action or makes a request on a web application, the application sends the session ID and cookie ID back to the server, along with a description of the action itself.

Once a web developer accrues enough information on how users traverse their site, they can start to create very personalized, engaging experiences. Such experiences are both good for the company behind the site (they can convert more visitors to customers, for example) and the visitors themselves (they get to the information or products for which they are looking in a fast, hassle-free manner).

Web developers often cache web session information using fast, scalable in-memory processing technologies to ensure that their web sites deliver a very responsive personalized experience for many visitors at the same time.

Keep Reading