Skip to content
On this page

Extending Sessions

Pirsch has the capability to keep sessions alive. We do not recommend using this feature for regular websites, but it can be useful for mobile applications, single page applications and other types of software where you have long running sessions. Otherwise, a session will only be kept alive if you send a pageview, which is usually the desired behaviour.

Extending a session prevents unnecessary page views from being generated.


A single session extension is counted as 10% of a page view and therefore counts towards your page view limit. Updating a session 10 times will be counted as one page view.

Extending Sessions Using Javascript

To extend sessions from the browser, add the pirsch-sessions.js snippet to your website and adjust the identification code.

<script defer type="text/javascript" src=""

This will automatically send a ping to Pirsch every 60 seconds. If you want to change the interval, add the data-interval-ms attribute. You can then specify the interval in milliseconds.

Alternatively, you can also use the pirsch-extended.js and enable it by including the data-enable-sessions attribute.

<script defer type="text/javascript" src=""

Extending Sessions Using the API

Sessions can be extended by sending a simple request to the API.


    "ip":               "123.456.789.0",
    "dnt":              "DNT header (optional)",
    "user_agent":       "User-Agent header"

The data must be identical to the data used to send a regular page view.