Skip to content

Conversation

@kfreytag
Copy link

I've added some simple code to detect if the user is at the beginning of a new session. This allows me, as a web developer, to use the "amplitude.isNewSession()" function to trigger certain tracking behavior only at the beginning of a session.

The use case I'm solving here is capturing utm_* parameters only once (avoiding a back-button problem), tracking referrers, and generally attaching anything we need to in a "Started Session" event -- a key building-block for web application event tracking.

@curtisliu
Copy link
Member

If I'm understanding this correctly, isNewSession will be true for all calls to it on the first page load for a given session, and will turn false after navigating to a new page in the same session. Is that the desired behavior?

@kfreytag
Copy link
Author

Yes. That's the desired behavior (for us, and, if imagine, for most web clients).

It allows us to do things like process incoming utm_ URL query parameters only once (without worrying about the back button) and record referrer for all new sessions.

Does that make sense?


Sent from Mailbox

On Sun, Feb 22, 2015 at 9:43 PM, Curtis Liu notifications@github.com
wrote:

If I'm understanding this correctly, isNewSession will be true for all calls to it on the first page load for a given session, and will turn false after navigating to a new page in the same session. Is that the desired behavior?

Reply to this email directly or view it on GitHub:
#4 (comment)

@kfreytag
Copy link
Author

@curtisliu - any feedback on this? I'd like to use this in our instrumentation if accepted.

@curtisliu
Copy link
Member

@kfreytag sorry for the delay. this looks good to me, thanks!

curtisliu added a commit that referenced this pull request Feb 24, 2015
Added support for detecting new sessions
@curtisliu curtisliu merged commit d8fb051 into amplitude:master Feb 24, 2015
@kfreytag
Copy link
Author

thanks @curtisliu!

How often do you do a release?

@curtisliu
Copy link
Member

We do releases fairly soon after updates to the SDK. Should have one out with these changes by the end of the week!

@kfreytag
Copy link
Author

Great news. Thanks, Curtis.

Kurt Freytag

Head of Product

CrunchBase - The Business Graph

c: 415-891-7761

f: 888-806-6753

On Wed, Feb 25, 2015 at 12:56 PM, Curtis Liu notifications@github.com
wrote:

We do releases fairly soon after updates to the SDK. Should have one out with these changes by the end of the week!

Reply to this email directly or view it on GitHub:
#4 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants