Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Tracking pages within a site

Posted on 2000-03-30
3
Medium Priority
?
175 Views
Last Modified: 2013-12-24
I need some code or a custom tag that will track the exact page within a Web site where the user left off so that the next time he/she visits the site they are returned to the page they were on when they last left the site. For example, if I have a 50 page site which is intended to be viewed in order (page 1, 2, 3,...) and I get up to page 25 and the leave the site and come back to it the next day, that once I log in I will be returned to page 25, which is where I left off.
0
Comment
Question by:cfcode
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Expert Comment

by:nathans
ID: 2670892
What I would do is set a cookie

either
1. for the user and keep track of where they are in a database.
2. or let the cookie say where the last page was by setting the cookie with the page number or something.
0
 

Accepted Solution

by:
bdemarzo earned 100 total points
ID: 2674412
If a user is actively logging off, store the page number in a cookie using <CFCOOKIE ...>. When they log back in, retrieve the cookie value and go to that page.

If the user is not actively logging off, you need to set the cookie at the top of each page, to ensure the cookie points to the page. Then use some logic - if the user re-enters the ordered pages, and they have a cookie defined, go to the appropriate page, otherwise go to page 1. (To do this effectively, the FIRST page of your ordered pages shouldn't be page 1; rather, it should be a page of pure CF code that just redirects to the appropriate page.)

Example:

On each page (page1.cfm, page2.cfm, etc.), insert the following:

<cfcookie name="pagenum" value="1">

Make sure you set the "value" to the page number.

When the user clicks the link to start viewing your page list, go to a page that will check to see if this is a new visit or a returning visit (say, "page0.cfm"):

<cfif IsDefined("cookie.pagenum")>
  <cflocation url="page#cookie.pagenum#.cfm">
<cfelse>
  <cflocation url="page1.cfm">
</cfif>

Not the most glorious solution, but it should work.
0
 

Author Comment

by:cfcode
ID: 2691141
bdemarzo forgot to mention that in the cfcookie tag you need to set the EXPIRES attribute to "never" or to "365" or to some date in the future or else the cookie will expires when the browser is closed. This is a critical issue as the application will not work as intended if the expires attribute is ommitted.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question