What is a session and how is it counted?

A session is a visit to your site or app from a single visitor. It consists of events like page views, downloads, ecommerce conversions and the like.

A session starts with the first event and ends 30 minutes after the last event. This means that when the time gap between two events is longer than 30 minutes, a new session is created with the second event. 

During the first session, a visitor is marked as New visitor. When they visit again, they are marked as Returning visitor.

Piwik PRO recognizes visitors using three methods:

  • Visitor ID: Our JavaScript tracker sets a vistior cookie (_pk_id.*)  in the visitor’s browser and assigns a unique identifier called a visitor ID. The tracker uses that ID to recognize the visitor. 

    The cookie expires after 13 months by default. Also, a visitor can clear cookies at any time. If that happens, the tracker will set a cookie again with a new visitor ID.

    Note: If you turn off Use a session ID (Administration > Sites & Apps > Privacy > Ask visitors for consent (off) > Use a session ID (off)), the tracker will only use Visitor ID to recognize visitors.

  • Session ID: Our JavaScript tracker creates a hash for each session based on the visitor’s IP address, operating system, browser name, browser version, browser language and enabled browser plugins. The tracker uses that hash to recognize events belonging to the same session. 

    The hash expires 30 minutes after the last event. If a visitor returns to the site or app after these 30 minutes, a new session is created.

    The tracker uses Session ID as a fallback mechanism to recognize sessions when he can’t create cookies and use Visitor ID.

  • User ID: This is an additional method that the JavaScript tracker can use only after you’ve set up a user ID. The User ID is any unique identifier that you can pass from your site or app to the tracker. It can be an email address, username, phone number and the like. It can also be a hash based on visitor’s unique identifiers.

    The User ID has the highest rank among mentioned identifiers. If available, the tracker uses it instead of other methods.

Was this article helpful?

Technical support

If you still have some questions, visit our community.
There’s always someone ready to help!

Back to help center