Track Web Page visits in CFM 
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.
| 
April 29th, 2009, 11:07 AM
|  | 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.
| 
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
| 
April 30th, 2009, 11:19 AM
|  | 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.
| 
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
| 
May 6th, 2009, 11:38 AM
|  | 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.
| 
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 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
| 
May 7th, 2009, 01:25 PM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,517
Provided Answers: 12 | | | re: Track Web Page visits in CFM
No problem :)
| 
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 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
| 
May 7th, 2009, 04:08 PM
|  | 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?
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,662 network members.
|