views:

198

answers:

2

Hi i am Dhananjay,

I need to keep track of the number of visitors to a web page.

I have planned like this: on load of the home page, I will call a javascript callCounter(); From javascript, I need then to call an action and update a record in database.

Please help me with this. How do i call the action? I should be in the same home jsp after updating database.

Thanks in advance, Dhananjay

+3  A: 

I'd suggest using a popular, ready-to-use counter solution, like:

Otherwise you'll need to call a struts action via ajax.

Bozho
Can i call struts action via AJAX?I yes please let me kow how.. suggest a similar example if u kno..I am a newbee to struts..
Dj
in the ajax tutorial I linked you just have to use the URL of your struts action. But I'd recommend using the ready-to-use solutions.
Bozho
Hi Bozho,Thanks for your answer.One clarification is needed.i will call ajax function onload of home page. from there i will call struts action. Struts action execute method will return type ActionForward. But i need to come back to the same page. If jsp refreshes, body onload will execute again. please suggest.
Dj
i am a developer. i need to stick to requirement.is there any other simpla way to accomplish this?Im using Liferay portal,struts 1.x
Dj
you can just ignore the returned result.
Bozho
So i in struts config, i will not hav forwards..Thanks for ur time and suggestions.. im seeing clicky.. i will suggest it to my team.Thanks
Dj
Which version of liferay???
Shashi Bhushan
if you are using 4.2, then this link may be help you http://www.liferay.com/community/wiki/-/wiki/Main/Ajax+Toolkit;jsessionid=EEA2BF201510485B3BB337D6105E5708.node-1
Shashi Bhushan
liferay 5.2....
Dj
I need to have the statistics of a web site and generate reports. I am using liferay portlet. Is there any built in CMS for web analytics in Life ray? if yes please help how to configure it?
Dj
A: 

Hi, I am using Google Anlytics now,

I don't know how to figure out the pagevisits based on individual pages of my website. Like number of visits to home page (URL for home page), number of visits to offer page and so on..
how do categorize the counts. now the report looks lik this- Visits · 1,867 Pageviews · 9,383 Pages/Visit · 5.03 Bounce Rate · 27.85% Avg. Time on Site · 00:05:36 % New Visits · 45.31%

Please give some suggestions

Dj