Connecting Tech Pros Worldwide Help | Site Map

Track Web Page visits in CFM

  #1  
Old April 29th, 2009, 08:35 AM
Member
 
Join Date: Mar 2007
Posts: 94
Hello,

I have never done any web page tracking in CFM, and now I have been asked to.

I can create a table in my database to hold the information but as a newbie can someone tell me how I start? An overview would be great as I really don't have a clue beyond creating a table to hold whatever data (and I think I know how to create the query to retrieve it).

Cheers!
Neil
best answer - posted by acoder
You can serve HTML pages using Coldfusion too. If you want to pass validation with iframes, either use Transitional, or use JavaScript to generate the iframe onload.
  #2  
Old April 29th, 2009, 11:07 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,517
Provided Answers: 12

re: Track Web Page visits in CFM


Depends exactly what you want to track. Unique visitors, page visits, site visits, etc.
  #3  
Old April 29th, 2009, 03:44 PM
Member
 
Join Date: Mar 2007
Posts: 94

re: Track Web Page visits in CFM


Hi acoder,

It's an intranet site, so all I need to store is the username, date and time and page name. Basically its to justify the existence of the website if noone is using it!

Thanks
Neil
  #4  
Old April 30th, 2009, 11:19 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,517
Provided Answers: 12

re: Track Web Page visits in CFM


So, you can create a table with 3 fields (plus one for ID): user name, a date/time field and page name field.

In either application.cfm or onrequestend.cfm, add a bit of code which inserts a record in this table: GetAuthUser() for the user name, now() for the date/time and cgi.script_name for page name.
  #5  
Old May 6th, 2009, 09:39 AM
Member
 
Join Date: Mar 2007
Posts: 94

re: Track Web Page visits in CFM


Thanks acoder. I also needed it to track normal HTML pages so what I did was create a small iframe:

<iframe src="http://marlin/engeastl/scripts/RepairWorkshops/tracker.cfm?name=RWD_HomePage" height="1px" width="1px" frameborder="0">

And used the tracker.cfm page to add the info to the database.

Not Strict HTML compliant, but its works!

Cheers
Neil
  #6  
Old May 6th, 2009, 11:38 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,517
Provided Answers: 12

re: Track Web Page visits in CFM


You can serve HTML pages using Coldfusion too. If you want to pass validation with iframes, either use Transitional, or use JavaScript to generate the iframe onload.
  #7  
Old May 6th, 2009, 02:05 PM
Member
 
Join Date: Mar 2007
Posts: 94

re: Track Web Page visits in CFM


Quote:
Originally Posted by acoder View Post
You can serve HTML pages using Coldfusion too. If you want to pass validation with iframes, either use Transitional, or use JavaScript to generate the iframe onload.
Good idea!

I'll give that a try as well. Thanks for your help.

Neil
  #8  
Old May 7th, 2009, 01:25 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,517
Provided Answers: 12

re: Track Web Page visits in CFM


No problem :)
  #9  
Old May 7th, 2009, 03:49 PM
Member
 
Join Date: Mar 2007
Posts: 94

re: Track Web Page visits in CFM


Quote:
Originally Posted by acoder View Post
No problem :)
Also acoder, do you know how I can grab the url of the page I'm tracking, to store it? I have been looking at #CGI.REFERER# but I can't get it to work!

Thanks
Neil
  #10  
Old May 7th, 2009, 04:08 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,517
Provided Answers: 12

re: Track Web Page visits in CFM


Try #cgi.script_name# or do you mean the page that refers to the current one?
Reply