|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
How do I track
How do I track How long someone has viewed a coldfusion page...any ideasJT 05/30/04 01:27 P you could set a session variable...Daniel Farmer 05/30/04 02:07 P Hum...JT 05/30/04 02:58 P You are mixing Javascript (client side) and CF (server side) here. ThisPascal Peters 05/31/04 05:13 A Thanks,JT 05/31/04 09:41 A You are mixing Javascript (client side) and CF (server side) here. ThisDaniel Farmer 05/31/04 09:53 A NOT in the same statement (as in JT's code). You can't set a CF var toPascal Peters 05/31/04 10:01 A True Enough...Daniel Farmer 05/31/04 10:15 A How do I track How long someone has viewed a coldfusion page...any ideas would be apprciated. 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. 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. 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 ----- 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 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 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. 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. >
|
February 08, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||