Use "beforeunload" with jQuery bind to catch this event. It works with FF,
Chrome, and IE 7+ but not supported by Opera. Following is a sample code.

$(window).bind('beforeunload', function() {
                        //put code to save data
                        return "Give a message to alert the user. Or simply
remove the return statement.";
                });

thanks,
Chanaka


On Mon, Sep 1, 2014 at 3:00 PM, Dimuthu Leelarathne <dimut...@wso2.com>
wrote:

> Hi all,
>
> This feature is almost complete. But facing issues in identifying window
> abandoning events such as hitting the back button of the browser. Is there
> a possible way to do this? Otherwise background saving will have to done
> more frequently and would cause a lot more traffic.
>
> thanks,
> dimuthu
>
>
>
> On Fri, Aug 8, 2014 at 6:08 PM, Amila Maha Arachchi <ami...@wso2.com>
> wrote:
>
>> Hi Dimuthu,
>>
>> Thanks for the explanation.
>>
>> With this kind of recording, I see another great advantage. That is to
>> lineup all the activities done by a user. If we filter out activities of a
>> user and sort them by time we'll get something like
>>
>> Clicked Create new application -> submitted application creation ->
>> clicked application xyz -> clicker open button -> clicked repos and builds
>> page etc.
>>
>>
>> On Fri, Aug 1, 2014 at 11:25 PM, Dimuthu Leelarathne <dimut...@wso2.com>
>> wrote:
>>
>>> Hi Amila,
>>>
>>> This is how you can do it. Let me tell you by example.
>>>
>>> App creation page loads (we record timestamp here). And only one of the
>>> following happens and pls note we record all timestamps.
>>>
>>> 1 - App creation button clicked
>>> OR
>>> 2 - Page unloads (meaning user browsed away)
>>> OR
>>> 3 - You see 2 on the same page messages
>>> OR
>>> 4 - User hit cacle
>>>
>>> What you have to do is write queries to figure out which event occur
>>> after the app creation page loads - 1,2,3 or 4th. You can also calculate
>>> with what probability each of these events occur after app creation page
>>> occur. You can also measure average times.
>>>
>>> thanks,
>>> dimuthu
>>>
>>>
>>> On Fri, Aug 1, 2014 at 7:32 PM, Amila Maha Arachchi <ami...@wso2.com>
>>> wrote:
>>>
>>>> Hi Dimuthu,
>>>>
>>>> You have said that we want to know how much time did a user spend on
>>>> completing an action. For this you need to publish an event when a button
>>>> is clicked. And then, how are you going to publish the finished event?
>>>>
>>>>
>>>> On Thu, Jul 31, 2014 at 8:12 PM, Dmitry Sotnikov <dmi...@wso2.com>
>>>> wrote:
>>>>
>>>>> Looks good. I assume that Timestamp is Date/Time and not just time
>>>>> (examples just have time - but I assume this is a typo).
>>>>>
>>>>> Dmitry
>>>>>
>>>>>
>>>>> On Thu, Jul 31, 2014 at 6:13 PM, Dimuthu Leelarathne <
>>>>> dimut...@wso2.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> In addition let me give you some samples
>>>>>>
>>>>>>
>>>>>> Tenant Id | Username(email) | Item | Action  | Timestamp | Context
>>>>>> (Application) | App Type | Comments
>>>>>>   450 | d...@aha.com | X-Button | Clicked | 12:09:40 | app1 | WAR |
>>>>>> Additional data (optional)
>>>>>>  780 | d...@man.com | url of home page | loaded | 12:10:50 | none |
>>>>>> none |  Additional data (optional)
>>>>>>  thanks,
>>>>>> dimuthu
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>  On Thu, Jul 31, 2014 at 7:26 PM, Dimuthu Leelarathne <
>>>>>> dimut...@wso2.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> We can capture App Type event as well. So the even stream would be
>>>>>>> updated as follows.
>>>>>>>
>>>>>>> Tenant Id : Username(email) : Item : Action : Timestamp : Context
>>>>>>> (Application) : App Type : Comments
>>>>>>>
>>>>>>> thanks,
>>>>>>> dimuthu
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Jul 31, 2014 at 4:07 PM, Dmitry Sotnikov <dmi...@wso2.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Dimuthu,
>>>>>>>>
>>>>>>>> Are "comments" parameters of the action? For example, the type of
>>>>>>>> application user chose when creating the new app?
>>>>>>>>
>>>>>>>> That would be good to have so administrators know which app types
>>>>>>>> are in use in their App Factory deployment.
>>>>>>>>
>>>>>>>> Dmitry
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, Jul 31, 2014 at 1:57 PM, Dimuthu Leelarathne <
>>>>>>>> dimut...@wso2.com> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> A sample set of events a user would do,
>>>>>>>>>
>>>>>>>>> User x logged in
>>>>>>>>>
>>>>>>>>> App home loads
>>>>>>>>>
>>>>>>>>> Clicked on “Add New Application” button
>>>>>>>>>
>>>>>>>>> Create application page loads
>>>>>>>>>
>>>>>>>>> Clicked upload/create from scratch
>>>>>>>>>
>>>>>>>>> Clicked “Create Application”
>>>>>>>>>
>>>>>>>>> App home loads
>>>>>>>>>
>>>>>>>>> Clicked on application tile
>>>>>>>>>
>>>>>>>>> Clicked on repo url
>>>>>>>>>
>>>>>>>>> Did a commit === Not by browser but by a Git client
>>>>>>>>>
>>>>>>>>> Set the production URL
>>>>>>>>>
>>>>>>>>> Edit description
>>>>>>>>>
>>>>>>>>> Click on expand icons on current status on home page
>>>>>>>>>
>>>>>>>>> Clicked on “Open URL”
>>>>>>>>>
>>>>>>>>> Clicked on “Open Issues” from home page
>>>>>>>>>
>>>>>>>>> Clicked “Delete Application”
>>>>>>>>>
>>>>>>>>> User home loads
>>>>>>>>>
>>>>>>>>> User x logged out
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> *What we need to do*
>>>>>>>>>
>>>>>>>>> Record these user’s events with the objective of understanding
>>>>>>>>> user interactions with App Factory
>>>>>>>>>
>>>>>>>>> *What we need to understand about user interactions?*
>>>>>>>>>
>>>>>>>>> - How much time user spend to between start action and end action
>>>>>>>>> (Create application button and completing of that task)
>>>>>>>>>
>>>>>>>>> - What are the most frequent actions a user would perform
>>>>>>>>>
>>>>>>>>> - What are the actions user started but never completed and why?
>>>>>>>>> Session timeout, Hit Cancel, Or just browse away
>>>>>>>>>
>>>>>>>>> - What is the most frequently loaded page
>>>>>>>>>
>>>>>>>>> - What is the most frequently accessed application of a user?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> *This we are going record*
>>>>>>>>>
>>>>>>>>> Tenant Id : Username(email) : Item : Action : Timestamp : Context
>>>>>>>>> (Application) : Comments
>>>>>>>>>
>>>>>>>>> *Methodology*
>>>>>>>>>
>>>>>>>>> Each time an event happens we are going to keep it in the
>>>>>>>>> JavaScript data structure. Then these data will be transferred to 
>>>>>>>>> backend
>>>>>>>>>
>>>>>>>>> - Periodically (5 minutes) with another action called “on the same
>>>>>>>>> page after 5 mins”- this is because if a session invalidates we can
>>>>>>>>> identify it by this action
>>>>>>>>>
>>>>>>>>> - Or each time the page unloads
>>>>>>>>>
>>>>>>>>> When backend receive(Jaggery) the data it will be published to the
>>>>>>>>> BAM. Then in the Java layer also we'll identify points that user would
>>>>>>>>> interact for example - commits and publish it to BAM.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Any thoughts?
>>>>>>>>>
>>>>>>>>> thanks,
>>>>>>>>> dimuthu
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Dimuthu Leelarathne
>>>>>>>>> Architect & Product Lead of App Factory
>>>>>>>>>
>>>>>>>>> WSO2, Inc. (http://wso2.com)
>>>>>>>>> email: dimut...@wso2.com
>>>>>>>>> Mobile : 0773661935
>>>>>>>>>
>>>>>>>>> Lean . Enterprise . Middleware
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Architecture mailing list
>>>>>>>>> Architecture@wso2.org
>>>>>>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Dmitry Sotnikov
>>>>>>>> VP of Cloud; WSO2, Inc.;  http://wso2.com/
>>>>>>>> email: dmi...@wso2.com; cell: +1.949.303.9653; Skype: DSotnikov
>>>>>>>>
>>>>>>>> Lean . Enterprise . Middleware
>>>>>>>>
>>>>>>>>  <http://wso2.com/events/>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Architecture mailing list
>>>>>>>> Architecture@wso2.org
>>>>>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Dimuthu Leelarathne
>>>>>>> Architect & Product Lead of App Factory
>>>>>>>
>>>>>>> WSO2, Inc. (http://wso2.com)
>>>>>>> email: dimut...@wso2.com
>>>>>>> Mobile : 0773661935
>>>>>>>
>>>>>>> Lean . Enterprise . Middleware
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Dimuthu Leelarathne
>>>>>> Architect & Product Lead of App Factory
>>>>>>
>>>>>> WSO2, Inc. (http://wso2.com)
>>>>>> email: dimut...@wso2.com
>>>>>> Mobile : 0773661935
>>>>>>
>>>>>> Lean . Enterprise . Middleware
>>>>>>
>>>>>> _______________________________________________
>>>>>> Architecture mailing list
>>>>>> Architecture@wso2.org
>>>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Dmitry Sotnikov
>>>>> VP of Cloud; WSO2, Inc.;  http://wso2.com/
>>>>> email: dmi...@wso2.com; cell: +1.949.303.9653; Skype: DSotnikov
>>>>> Lean . Enterprise . Middleware
>>>>>
>>>>>  <http://wso2.com/events/>
>>>>>
>>>>> _______________________________________________
>>>>> Architecture mailing list
>>>>> Architecture@wso2.org
>>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> *Amila Maharachchi*
>>>> Senior Technical Lead
>>>> WSO2, Inc.; http://wso2.com
>>>>
>>>> Blog: http://maharachchi.blogspot.com
>>>> Mobile: +94719371446
>>>>
>>>>
>>>> _______________________________________________
>>>> Architecture mailing list
>>>> Architecture@wso2.org
>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>>
>>>>
>>>
>>>
>>> --
>>> Dimuthu Leelarathne
>>> Architect & Product Lead of App Factory
>>>
>>> WSO2, Inc. (http://wso2.com)
>>> email: dimut...@wso2.com
>>> Mobile : 0773661935
>>>
>>> Lean . Enterprise . Middleware
>>>
>>> _______________________________________________
>>> Architecture mailing list
>>> Architecture@wso2.org
>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>
>>>
>>
>>
>> --
>> *Amila Maharachchi*
>> Senior Technical Lead
>> WSO2, Inc.; http://wso2.com
>>
>> Blog: http://maharachchi.blogspot.com
>> Mobile: +94719371446
>>
>>
>> _______________________________________________
>> Architecture mailing list
>> Architecture@wso2.org
>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>
>>
>
>
> --
> Dimuthu Leelarathne
> Architect & Product Lead of App Factory
>
> WSO2, Inc. (http://wso2.com)
> email: dimut...@wso2.com
> Mobile : 0773661935
>
> Lean . Enterprise . Middleware
>



-- 
Chanaka Jayasena
Senior Software Engineer; WSO2, Inc.;  http://wso2.com/
email: chan...@wso2.com; cell: +94 77 785 5565
blog: http://chanaka3d.blogspot.com
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to