You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris <ch...@gmx.at> on 2015/05/10 22:43:19 UTC

measure time user stays on page

Hi all,

I would like to measure the time the user stays at a certain page. I would do this by querying the system’s time when loading the page (in the page constructor) and the system time when clicking on a link that refers the user to the next page.
However, if the user hits the browser back button, the last version of the page is displayed without loading the page via its constructor.

What would be the best solution to measure the time spent on a page?

Thanks, Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: measure time user stays on page

Posted by Martin Grigorov <mg...@apache.org>.
https://github.com/apache/wicket/blob/32af2c8cc8985fc8a52f492d854dbf3206b7c243/wicket-core/src/main/java/org/apache/wicket/markup/html/WebPage.java#L206

Wicket pages by default send "do not cache me" response headers.
Safari should obey the rules.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, May 11, 2015 at 5:51 PM, Chris <ch...@gmx.at> wrote:

> Hi Martin,
>
> Safari by default has turned cache on and therefore when clicking
> browser-back the page is loaded from the browser’s cache.
> Is there a way to circumvent this issue so that I can measure the time
> users spent on a current page somehow?
>
> best regards, Chris
>
>
>
> > Am 11.05.2015 um 08:22 schrieb Martin Grigorov <mg...@apache.org>:
> >
> > Wicket pages are not cached by default.
> > Navigating back in the browser should make a request to the server and
> > execute the RENDER phase (onConfigure, onBeforeRender, onRender,
> > onAfterRender, onDetach).
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Mon, May 11, 2015 at 12:23 AM, Marcel Barbosa Pinto <
> > marcel.power@gmail.com> wrote:
> >
> >> Hmm, it can be a browser cache issue,  or the Wicket cache.. Try call
> the
> >> setVersioned(false)
> >> Em 10/05/2015 18:09, "Chris" <ch...@gmx.at> escreveu:
> >>
> >>> Thanks but the methods such as onBeforeRender seem not be called on
> >>> browser back.
> >>>
> >>> Chris
> >>>
> >>>
> >>>> Am 10.05.2015 um 22:54 schrieb Marcel Barbosa Pinto <
> >>> marcel.power@gmail.com>:
> >>>>
> >>>> You could override the onRender method that is executed every time the
> >>> page
> >>>> is rendered on the browser.
> >>>> Em 10/05/2015 17:43, "Chris" <ch...@gmx.at> escreveu:
> >>>>
> >>>>> Hi all,
> >>>>>
> >>>>> I would like to measure the time the user stays at a certain page. I
> >>> would
> >>>>> do this by querying the system’s time when loading the page (in the
> >> page
> >>>>> constructor) and the system time when clicking on a link that refers
> >> the
> >>>>> user to the next page.
> >>>>> However, if the user hits the browser back button, the last version
> of
> >>> the
> >>>>> page is displayed without loading the page via its constructor.
> >>>>>
> >>>>> What would be the best solution to measure the time spent on a page?
> >>>>>
> >>>>> Thanks, Chris
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>
> >>>>>
> >>>
> >>>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: measure time user stays on page

Posted by Chris <ch...@gmx.at>.
Hi all,

thanks for your suggestions!

@Martin, even when I override the setHeaders method, Safari seems to ignore the settings „disableCaching“.

@Override
protected void setHeaders(WebResponse response) {
    super.setHeaders(response);
    response.disableCaching();
}

br Chris

> Am 11.05.2015 um 20:59 schrieb Marcel Barbosa Pinto <ma...@gmail.com>:
> 
> You  can create a pixel image and compare a session time on the server..
> Most likely the solution used by Google Analytics...
> Em 11/05/2015 13:38, "Christoph Läubrich" <la...@googlemail.com> escreveu:
> 
>> If you are really eager to do so (in fact this is some kind of user
>> tracking that might be problematic as well as you users might try to block
>> it ...) you can fire an AJAX call in the domReady and one in the close
>> callback or when clicking a link. In fact you can only GUESS the time a
>> user stays on page...
>> 
>> Am 11.05.2015 16:51, schrieb Chris:
>> 
>>> Hi Martin,
>>> 
>>> Safari by default has turned cache on and therefore when clicking
>>> browser-back the page is loaded from the browser’s cache.
>>> Is there a way to circumvent this issue so that I can measure the time
>>> users spent on a current page somehow?
>>> 
>>> best regards, Chris
>>> 
>>> 
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 


Re: measure time user stays on page

Posted by Marcel Barbosa Pinto <ma...@gmail.com>.
You  can create a pixel image and compare a session time on the server..
Most likely the solution used by Google Analytics...
Em 11/05/2015 13:38, "Christoph Läubrich" <la...@googlemail.com> escreveu:

> If you are really eager to do so (in fact this is some kind of user
> tracking that might be problematic as well as you users might try to block
> it ...) you can fire an AJAX call in the domReady and one in the close
> callback or when clicking a link. In fact you can only GUESS the time a
> user stays on page...
>
> Am 11.05.2015 16:51, schrieb Chris:
>
>> Hi Martin,
>>
>> Safari by default has turned cache on and therefore when clicking
>> browser-back the page is loaded from the browser’s cache.
>> Is there a way to circumvent this issue so that I can measure the time
>> users spent on a current page somehow?
>>
>> best regards, Chris
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: measure time user stays on page

Posted by Christoph Läubrich <la...@googlemail.com>.
If you are really eager to do so (in fact this is some kind of user 
tracking that might be problematic as well as you users might try to 
block it ...) you can fire an AJAX call in the domReady and one in the 
close callback or when clicking a link. In fact you can only GUESS the 
time a user stays on page...

Am 11.05.2015 16:51, schrieb Chris:
> Hi Martin,
>
> Safari by default has turned cache on and therefore when clicking browser-back the page is loaded from the browser’s cache.
> Is there a way to circumvent this issue so that I can measure the time users spent on a current page somehow?
>
> best regards, Chris
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: measure time user stays on page

Posted by Chris <ch...@gmx.at>.
Hi Martin,

Safari by default has turned cache on and therefore when clicking browser-back the page is loaded from the browser’s cache.
Is there a way to circumvent this issue so that I can measure the time users spent on a current page somehow?

best regards, Chris



> Am 11.05.2015 um 08:22 schrieb Martin Grigorov <mg...@apache.org>:
> 
> Wicket pages are not cached by default.
> Navigating back in the browser should make a request to the server and
> execute the RENDER phase (onConfigure, onBeforeRender, onRender,
> onAfterRender, onDetach).
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Mon, May 11, 2015 at 12:23 AM, Marcel Barbosa Pinto <
> marcel.power@gmail.com> wrote:
> 
>> Hmm, it can be a browser cache issue,  or the Wicket cache.. Try call the
>> setVersioned(false)
>> Em 10/05/2015 18:09, "Chris" <ch...@gmx.at> escreveu:
>> 
>>> Thanks but the methods such as onBeforeRender seem not be called on
>>> browser back.
>>> 
>>> Chris
>>> 
>>> 
>>>> Am 10.05.2015 um 22:54 schrieb Marcel Barbosa Pinto <
>>> marcel.power@gmail.com>:
>>>> 
>>>> You could override the onRender method that is executed every time the
>>> page
>>>> is rendered on the browser.
>>>> Em 10/05/2015 17:43, "Chris" <ch...@gmx.at> escreveu:
>>>> 
>>>>> Hi all,
>>>>> 
>>>>> I would like to measure the time the user stays at a certain page. I
>>> would
>>>>> do this by querying the system’s time when loading the page (in the
>> page
>>>>> constructor) and the system time when clicking on a link that refers
>> the
>>>>> user to the next page.
>>>>> However, if the user hits the browser back button, the last version of
>>> the
>>>>> page is displayed without loading the page via its constructor.
>>>>> 
>>>>> What would be the best solution to measure the time spent on a page?
>>>>> 
>>>>> Thanks, Chris
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>> 
>>>>> 
>>> 
>>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: measure time user stays on page

Posted by Martin Grigorov <mg...@apache.org>.
Wicket pages are not cached by default.
Navigating back in the browser should make a request to the server and
execute the RENDER phase (onConfigure, onBeforeRender, onRender,
onAfterRender, onDetach).

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, May 11, 2015 at 12:23 AM, Marcel Barbosa Pinto <
marcel.power@gmail.com> wrote:

> Hmm, it can be a browser cache issue,  or the Wicket cache.. Try call the
> setVersioned(false)
> Em 10/05/2015 18:09, "Chris" <ch...@gmx.at> escreveu:
>
> > Thanks but the methods such as onBeforeRender seem not be called on
> > browser back.
> >
> > Chris
> >
> >
> > > Am 10.05.2015 um 22:54 schrieb Marcel Barbosa Pinto <
> > marcel.power@gmail.com>:
> > >
> > > You could override the onRender method that is executed every time the
> > page
> > > is rendered on the browser.
> > > Em 10/05/2015 17:43, "Chris" <ch...@gmx.at> escreveu:
> > >
> > >> Hi all,
> > >>
> > >> I would like to measure the time the user stays at a certain page. I
> > would
> > >> do this by querying the system’s time when loading the page (in the
> page
> > >> constructor) and the system time when clicking on a link that refers
> the
> > >> user to the next page.
> > >> However, if the user hits the browser back button, the last version of
> > the
> > >> page is displayed without loading the page via its constructor.
> > >>
> > >> What would be the best solution to measure the time spent on a page?
> > >>
> > >> Thanks, Chris
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > >> For additional commands, e-mail: users-help@wicket.apache.org
> > >>
> > >>
> >
> >
>

Re: measure time user stays on page

Posted by Marcel Barbosa Pinto <ma...@gmail.com>.
Hmm, it can be a browser cache issue,  or the Wicket cache.. Try call the
setVersioned(false)
Em 10/05/2015 18:09, "Chris" <ch...@gmx.at> escreveu:

> Thanks but the methods such as onBeforeRender seem not be called on
> browser back.
>
> Chris
>
>
> > Am 10.05.2015 um 22:54 schrieb Marcel Barbosa Pinto <
> marcel.power@gmail.com>:
> >
> > You could override the onRender method that is executed every time the
> page
> > is rendered on the browser.
> > Em 10/05/2015 17:43, "Chris" <ch...@gmx.at> escreveu:
> >
> >> Hi all,
> >>
> >> I would like to measure the time the user stays at a certain page. I
> would
> >> do this by querying the system’s time when loading the page (in the page
> >> constructor) and the system time when clicking on a link that refers the
> >> user to the next page.
> >> However, if the user hits the browser back button, the last version of
> the
> >> page is displayed without loading the page via its constructor.
> >>
> >> What would be the best solution to measure the time spent on a page?
> >>
> >> Thanks, Chris
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
>
>

Re: measure time user stays on page

Posted by Chris <ch...@gmx.at>.
Thanks but the methods such as onBeforeRender seem not be called on browser back.

Chris


> Am 10.05.2015 um 22:54 schrieb Marcel Barbosa Pinto <ma...@gmail.com>:
> 
> You could override the onRender method that is executed every time the page
> is rendered on the browser.
> Em 10/05/2015 17:43, "Chris" <ch...@gmx.at> escreveu:
> 
>> Hi all,
>> 
>> I would like to measure the time the user stays at a certain page. I would
>> do this by querying the system’s time when loading the page (in the page
>> constructor) and the system time when clicking on a link that refers the
>> user to the next page.
>> However, if the user hits the browser back button, the last version of the
>> page is displayed without loading the page via its constructor.
>> 
>> What would be the best solution to measure the time spent on a page?
>> 
>> Thanks, Chris
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 


Re: measure time user stays on page

Posted by Marcel Barbosa Pinto <ma...@gmail.com>.
You could override the onRender method that is executed every time the page
is rendered on the browser.
Em 10/05/2015 17:43, "Chris" <ch...@gmx.at> escreveu:

> Hi all,
>
> I would like to measure the time the user stays at a certain page. I would
> do this by querying the system’s time when loading the page (in the page
> constructor) and the system time when clicking on a link that refers the
> user to the next page.
> However, if the user hits the browser back button, the last version of the
> page is displayed without loading the page via its constructor.
>
> What would be the best solution to measure the time spent on a page?
>
> Thanks, Chris
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>