Foros de discusión

Display the total visitor count of the Portal in theme

thumbnail
Anuvab Ghosh, modificado hace 8 años.

Display the total visitor count of the Portal in theme

Regular Member Mensajes: 130 Fecha de incorporación: 18/04/15 Mensajes recientes
Hi,

I have a requirement to show the total visitor* count of the portal in the footer section. The footer section is designed and developed in liferay-theme and do not want to use the html counter from the market. I am using Liferay 6.1.1 ga2. How to do this in Liferay? Is there any option or configuration in Liferay? Please give some ideas and answers.

* Anyone will be the visitor among admin, users, guest, etc.


Thanks in advance.
thumbnail
Vilmos Papp, modificado hace 8 años.

RE: Display the total visitor count of the Portal in theme

Liferay Master Mensajes: 529 Fecha de incorporación: 21/10/10 Mensajes recientes
Do you want to show the current visitors' number or, the number your site was visited since you started the counter?
thumbnail
Anuvab Ghosh, modificado hace 8 años.

RE: Display the total visitor count of the Portal in theme

Regular Member Mensajes: 130 Fecha de incorporación: 18/04/15 Mensajes recientes
Thanks for the reply.

Vilmos Papp:
Do you want to show the current visitors' number or, the number your site was visited since you started the counter?


I want to show the total number of page/portal views/visit since the portal started. Moreover I do not want to use ready-made html hit counter from the market.

Thanks in advance.
thumbnail
Olaf Kock, modificado hace 8 años.

RE: Display the total visitor count of the Portal in theme

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
There's nothing in Liferay that does this as well. You'll have to count for yourself and duplicate what all those services already do: De-Duplicate the requests that are coming in, determine if you want to count robots (determine if a visitor is a robot), determine if several users come from a single IP, determine if a single user comes from multiple IPs, reset the counter if you want to start over at the end of the day, etc etc etc.

Liferay has integrations with Google Analytics as well as Piwik (starting on 6.2). Other implementations are possible (easy actually), but remain for you to do them yourself. Be aware that the integration is easy while the implementation of the business layer might be harder.
thumbnail
Anuvab Ghosh, modificado hace 8 años.

RE: Display the total visitor count of the Portal in theme

Regular Member Mensajes: 130 Fecha de incorporación: 18/04/15 Mensajes recientes
Thanks for the reply.
thumbnail
David H Nebinger, modificado hace 8 años.

RE: Display the total visitor count of the Portal in theme

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
To add to what Olaf pointed out, when you're in a cluster users are scattered amongst all nodes but they don't tell each other who has logged in; your job of tracking the count gets that much more difficult.
thumbnail
Vilmos Papp, modificado hace 8 años.

RE: Display the total visitor count of the Portal in theme

Liferay Master Mensajes: 529 Fecha de incorporación: 21/10/10 Mensajes recientes
So it seems the best thing would be to create a simple Service Builder portlet to store the visits and query the actual results. With Service Builder and caching in picture I think clustering shouldn't be an issue, as caches change events are replicated, hence always new data would be retrieved.
thumbnail
David H Nebinger, modificado hace 8 años.

RE: Display the total visitor count of the Portal in theme

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
The problem, of course, is still correctly identifying log outs.

Since browsers can be closed or systems crashed or mobiles lose connectivity, users might never actually log out.

So while you can track logins, you'd have a hard time lowering the count for when they are gone.

You'd have to track the session expirations to capture those kinds of events, but your count will always be off based on your session expiration timeout.
thumbnail
Olaf Kock, modificado hace 8 años.

RE: Display the total visitor count of the Portal in theme

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
On a reasonably high traffic site, I'd try to avoid write operations to the database on every read operation to the portal - rather respond with reading only the content. That's why it's so effective to delegate the counting to an external system which might scale independent of the portal. And you can determine for yourself if you want to deduplicate/filter/process the data right when they're being captured or in batch later.
thumbnail
Vilmos Papp, modificado hace 8 años.

RE: Display the total visitor count of the Portal in theme

Liferay Master Mensajes: 529 Fecha de incorporación: 21/10/10 Mensajes recientes
Maybe something with session listeners at application server /servlet container level could help: http://tomcat-configure.blogspot.hu/2009/01/tomcat-session-listener-example.html With some batch commits/queue usage, to avoid too high DB usage.
thumbnail
Anuvab Ghosh, modificado hace 8 años.

RE: Display the total visitor count of the Portal in theme

Regular Member Mensajes: 130 Fecha de incorporación: 18/04/15 Mensajes recientes
Olaf Kock:
On a reasonably high traffic site, I'd try to avoid write operations to the database on every read operation to the portal - rather respond with reading only the content. That's why it's so effective to delegate the counting to an external system which might scale independent of the portal. And you can determine for yourself if you want to deduplicate/filter/process the data right when they're being captured or in batch later.



Thanks for your suggestion.
Can you explain more please?