Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for sessions #4

Open
zwetan opened this issue Oct 3, 2015 · 2 comments
Open

support for sessions #4

zwetan opened this issue Oct 3, 2015 · 2 comments
Milestone

Comments

@zwetan
Copy link
Owner

zwetan commented Oct 3, 2015

see Session Control parameter

few things

  • automatically add a session start for the 1st hit request
  • support timers to support session stop
  • mobile AIR app background mode shoudl trigger a session stop
  • let user trigger a manual a session stop for special cases
    like: kiosk mode, idle screens, screensavers, etc.
  • let user trigger a manual session start for special cases
    like out of idle mode, out of screensaver, etc.
  • support Session unification

see How a session is defined in Analytics

@zwetan
Copy link
Owner Author

zwetan commented Oct 9, 2015

see wiki doc https://github.com/zwetan/as3-universal-analytics/wiki/TrackingDetailsAndTricks#session-management

maybe a helper for manual session

tracker.setOneTime( Tracker.SESSION_CONTROL, SessionControl.START );
tracker.screenview( "Home Screen" );

and a util class for automatic session management

private function onCreationComplete():void
{
    var na:NativeApplication = NativeApplication.nativeApplication;
    na.idleThreshold = 2 * 60; // In seconds -- the default is 5 minutes.
    na.addEventListener( Event.USER_IDLE, onUserIdle );
    na.addEventListener( Event.USER_PRESENT, onUserPresent );
)

private function onUserIdle( event:Event ):void
{
    tracker.setOneTime( Tracker.SESSION_CONTROL, SessionControl.END );
    tracker.event( "activity", "idle" );
}

private function onUserPresent( event:Event ):void
{
    tracker.setOneTime( Tracker.SESSION_CONTROL, SessionControl.START );
    tracker.event( "activity", "present" );
}

@zwetan
Copy link
Owner Author

zwetan commented Oct 9, 2015

also from doc

By default, Google Analytics will group hits that are received within 30 minutes of one another into the same session. This period is configurable at the property level.

we should add a session timeout in the config, default 30mn
allow the user to override it

and so add a global timer which follow the logic of How a session is defined in Analytics

the timer need to be connected to the tracker and/or the sender
so each time a hit is send we can reset the timer to 30mn (or other user defined time)

thje way to break the old session and start a new one should be as described

What happens if during a session to my site, Bob leaves open a page while he takes a 31-minute lunch break, then returns to continue browsing the site?

eg. use a Tracker.SESSION_CONTROL, SessionControl.START

@zwetan zwetan added this to the 0.9 milestone Oct 9, 2015
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

No branches or pull requests

1 participant