DavidWells / DavidWells/analytics

Analytics Util Session - utilSessions.extendSession().isNew (Always False)

Open
#197 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.7k
Forks
267
PR merge metrics
No merged PRs in 30d

Description

Thanks for the awesome tools in this area, much needed. Also, not a huge issue here but thought I'd share.

I'm hoping to use this plugin to track sessions to a custom backend, followed the documentation here: https://github.com/DavidWells/analytics/blob/master/packages/analytics-util-session/example/index.html

Including the libs in the browser directly as such:

<!-- Include from CDN -->
<script src="https://cdn.jsdelivr.net/npm/analytics@0.7.13/dist/analytics.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@analytics/session-utils@0.1.9/dist/browser/session-utils.umd.js"></script>

I am essentially hoping to avoid calling getSession() and instead just fire the extendSession() whenever activity has been detected (page view, clicks etc) or whenever I call Analytics.track() for example but whenever I call extendSession() after clearing out cookies to "reset" the session, it successfully creates the new session but the parameter isNew always returns false. Should this be true sine all cookies were removed? Thinking that the isNew should return true whenever it is a new session despite what method is called?

Only when I run getSession() and it is in fact a new session (cookies cleared) do I get a isNew: true. Attaching a screengrab below.

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/analytics-util-session/example/index.html and the @analytics/session-utils entry points for extendSession() and getSession(). Reproduce the cookie-clearing case in the browser, then verify that extending a newly created session reports isNew: true consistently with getSession().

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.