House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

How do I track

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
JT
05/30/2004 01:27 PM

How do I track How long someone has viewed a coldfusion page...any ideas would be apprciated.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Daniel Farmer
05/30/2004 02:07 PM

you could set a session variable... <cfset session.timeFirstView = Now()> Then on an unload javascript event...to detect when the page is left and have that trigger a second Now() CF function, then you'd have the start and end time.   How do I track How long someone has viewed a coldfusion page...any ideas   would be apprciated.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
JT
05/30/2004 02:58 PM

Hum... Why does this not work? <cfset session.timeFirstView = Now()> <cfscript> pagetime = structnew() pagetime.FirstView = session.firstTimeView pagetime. ExitTime = onunload(now()) pagetime.Visited = pagetime.Visited - pagetime.Firstview alert(time.Visited) </cfscript> Any help preciated, JT   you could set a session variable...   <cfset session.timeFirstView = Now()>   Then on an unload javascript event...to detect when the page is left and have that   trigger a second Now() CF function, then you'd have the start and end time.     How do I track How long someone has viewed a coldfusion page...any ideas     would be apprciated.

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Pascal Peters
05/31/2004 05:13 AM

You are mixing Javascript (client side) and CF (server side) here. This simply won't work. On your original question. This is a hard thing to do. Why do you need it? What do you mean by "How long someone has viewed a coldfusion page"? Start when it loads in the browser? What is defined by page? If you really need to do this, I would create a JS function to calculate this: initialize the time in onload and calculate the difference in onunload of the body. Then send a request through a popup or hidden frame (or even an img src) to the server. Pascal ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
JT
05/31/2004 09:41 AM

Thanks, I got it working yesterday using a image. JT   You are mixing Javascript (client side) and CF (server side) here. This   simply won't work.   On your original question. This is a hard thing to do. Why do you need   it? What do you mean by "How long someone has viewed a coldfusion page"?   Start when it loads in the browser? What is defined by page?   If you really need to do this, I would create a JS function to calculate   this: initialize the time in onload and calculate the difference in   onunload of the body. Then send a request through a popup or hidden   frame (or even an img src) to the server.   Pascal   > Hum...   >   > Why does this not work?   >   > <cfset session.timeFirstView = Now()>   >   > <cfscript>   >   > pagetime = structnew() ==> CF   >   > pagetime.FirstView = session.firstTimeView ==> CF   >   > pagetime. ExitTime = onunload(now()) ==> CF & JS   >   > pagetime.Visited = pagetime.Visited - pagetime.Firstview ==> CF   >   > alert(time.Visited) ==> JS   >   > </cfscript>   >   > Any help preciated,   >   > JT

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Daniel Farmer
05/31/2004 09:53 AM

  You are mixing Javascript (client side) and CF (server side) here. This   simply won't work. I've mixed the two technologies before with no problems.   Thanks,   I got it working yesterday using a image.   JT     You are mixing Javascript (client side) and CF (server side) here. This     simply won't work.     On your original question. This is a hard thing to do. Why do you need     it? What do you mean by "How long someone has viewed a coldfusion page"?     Start when it loads in the browser? What is defined by page?     If you really need to do this, I would create a JS function to calculate     this: initialize the time in onload and calculate the difference in     onunload of the body. Then send a request through a popup or hidden     frame (or even an img src) to the server.     Pascal     > Hum...     >     > Why does this not work?     >     > <cfset session.timeFirstView = Now()>     >     > <cfscript>     >     > pagetime = structnew() ==> CF     >     > pagetime.FirstView = session.firstTimeView ==> CF     >     > pagetime. ExitTime = onunload(now()) ==> CF & JS     >     > pagetime.Visited = pagetime.Visited - pagetime.Firstview ==> CF     >     > alert(time.Visited) ==> JS     >     > </cfscript>     >     > Any help preciated,     >     > JT

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Pascal Peters
05/31/2004 10:01 AM

NOT in the same statement (as in JT's code). You can't set a CF var to the value of a JS var without making a request. Due to the nature of the web, this is impossible! >   You are mixing Javascript (client side) and CF (server > side) here. This >   simply won't work. > > I've mixed the two technologies before with no problems.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Daniel Farmer
05/31/2004 10:15 AM

True Enough...   NOT in the same statement (as in JT's code). You can't set a CF var to   the value of a JS var without making a request. Due to the nature of the   web, this is impossible!   >   You are mixing Javascript (client side) and CF (server   > side) here. This   >   simply won't work.   >   > I've mixed the two technologies before with no problems.   >


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

February 08, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29