{"id":19423857,"url":"https://github.com/swizec/web-session-counter","last_synced_at":"2026-02-23T23:38:08.533Z","repository":{"id":65379252,"uuid":"90944850","full_name":"Swizec/web-session-counter","owner":"Swizec","description":"Utility to count a user's web sessions based on the definition GA uses.","archived":false,"fork":false,"pushed_at":"2019-06-26T21:29:37.000Z","size":7,"stargazers_count":24,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T04:05:36.337Z","etag":null,"topics":["analytics","es6","localstorage","momentjs","querystring","session"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Swizec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-11T06:22:43.000Z","updated_at":"2024-11-04T17:48:39.000Z","dependencies_parsed_at":"2023-01-20T08:45:48.171Z","dependency_job_id":null,"html_url":"https://github.com/Swizec/web-session-counter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swizec%2Fweb-session-counter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swizec%2Fweb-session-counter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swizec%2Fweb-session-counter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swizec%2Fweb-session-counter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Swizec","download_url":"https://codeload.github.com/Swizec/web-session-counter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250663544,"owners_count":21467366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","es6","localstorage","momentjs","querystring","session"],"created_at":"2024-11-10T13:41:03.554Z","updated_at":"2026-02-23T23:38:08.479Z","avatar_url":"https://github.com/Swizec.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Web Session Counter\n\nWhat do you do if your boss comes up to you and asks *\"So how many\ntimes must a person come to our app before they give us $500?\"*\n\nAs an engineer you might not care, but this is the stuff that keeps\nyour CEO and growth lead and head of product up at night. A business\nowner that can answer that 👆 question reliably is god amongst men.\n\nYou can use this repo :)\n\n## How to use\n\n```\n$ npm install --save web-session-counter\n```\n\n```javascript\n\nimport WebSessionCounter from 'web-session-counter';\n\n// Do this on user activity\nWebSessionCounter.update();\n\n// To get the total count of sessions\nconst count = WebSessionCounter.count;\n\n```\n\n`.update()` is called automatically every time you import\nWebSessionCounter. I recommend calling `.update()`, if you have a\nsingle page app that doesn't perform a lot of refreshes. Calling\n`.update` frequently, ensures your code will correctly detect every 30\nminute period of inactivity.\n\n## What is a session\n\nWe use the [same definition as Google Analytics](https://support.google.com/analytics/answer/2731565?hl=en). The tl;dr is that a new session starts after every:\n\n- 30 minutes of inactivity\n- midnight\n- `utm_campaign` query change\n\n\nEnjoy.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswizec%2Fweb-session-counter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswizec%2Fweb-session-counter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswizec%2Fweb-session-counter/lists"}