Best way to count page views in Plone

I work in a case requiring the integrated use of page views.

Each content object will have a page view, and it should be easy to access so that we can do various things with it (sorted by catalog result, display, calculation of a popular metric ...). The closest equivalent is watching youtube video.

I am thinking about possible ways to implement this:

  • Use the annotation store and indexer to create the index and metadata for the portal portal.

  • Use only the index (either use the volatile attribute, or the base of the update index for the previous index), so we don’t need to write frequently modified data twice. A page view is just a save to a brain object.

  • Use a relational database. Then how can we make it work with portal_catalog?

  • Use the wrapper layer in front of Plone to perform analytics and get the desired data through some API. This reduces flexibility, but helps to significantly reduce costs on the Plone side (recording event subscriber, verification session, cookie ...), and should performance be better?

Your ideas / experience on this?

+4
source share
6 answers

We used an external log analyzer for a client project (large private intranet). Architecture:

  • The js library adds a "web error", an empty gif with additional request parameters, downloaded from a dedicated nginx server.
  • The log handler selects nginx logs, rotates them, and parses the rows in the database, counting access along with additional metadata. Entries in db include the UID of the content, among other interesting angles.
  • The site has read-only access to the same database in order to make statistics requests.

Then the number of pages is easy, just query the database for the correct UID. Ranked lists are not much more complicated; request statistics, then use the UID to attach the catalog data to the result set.

The biggest problem we are facing right now is the lack of know-how of data warehousing (turning individual access rows into a database into efficient aggregates), and we are studying the redefinition of this setting to use Piwik as a statistics mechanism.

We cannot use Google Analytics in this particular case, but if you do not have such a restriction, I would advise you to look into collective.googleanalytics and see if you can do this in accordance with your use case.

+3
source

Have you seen this product yet ?: http://plone.org/products/collective.googleanalytics/

This seems to fit your needs, or at least it could be a good base for your settings.

+2
source

A record in each access is the worst case scenario for ZODB. Relational databases are usually pretty good at this, and I would look at that first.

Need to sort data? Just add utility or content type methods to request db. When you need to search, do a directory search, and then use the db-connect methods to annotate the data for sorting.

+2
source

We did it a long time ago (plone2.5). The customer wants this! Once this has been done, it is finally not a real necessity. these were the preferred articles, they are not equal to the most viewed ... so there was only one content rating.

So, first confirm this with your client.

Further, the best way to achieve your need is to install an analytics tool, googleanalytics or something else, but with an API to ask the most viewed page. If you need this in portal_catalog, you can index the value when the article is viewed + only every hour.

+1
source

I noticed that people from Nidelven just released the http://plone.org/products/Products.ZODBFriendlyCounter , which promises do this initially without over-writing the ZODB / bloat. It is worth checking, I would like to hear more expert opinions on this matter.

+1
source

If you use dexterity, you must adjust the page view behavior to add annotatin data to the main object, and a mutable attribute is used in the annotation date.

0
source

All Articles