Foren

Number of views

thumbnail
Ruth Coca Izquierdo, geändert vor 16 Jahren.

Number of views

New Member Beiträge: 7 Beitrittsdatum: 10.10.07 Neueste Beiträge
Hi,

I was not be able to increase the content number of views.

Neither publishing the content with the Asset Publisher nor Journal Content...

It's a bug? or I am missing something


Txs,
Ruth
thumbnail
Ray Auge, geändert vor 16 Jahren.

Re: [Liferay Forums][Beta Testing]Number of views

Liferay Legend Beiträge: 1197 Beitrittsdatum: 08.02.05 Neueste Beiträge
It's not a bug. You are missing a counter artifact somewhere in either
the content of the article, the template or in the presentational
code...

This is a pretty new feature that we've only recently added and haven't
yet really documented it's use.

So, here goes... there are two ways to achieve the countability of
Assets.

1) by placing a token (@view_counter@) somewhere where the Article
processing logic can parse it (anywhere in Journal Article content OR in
output generated by Journal Template).
2) by placing some javascript code and giving it the appropriate Asset
fields of "className" (which is the java className of the asset type)
and the "classPK", which is the primaryKey of the resource used in the
asset reference... [:|]

e.g. here is an example of the javascript used for a Journal Article:

Liferay.Service.Tags.TagsAsset.incrementViewCounter({className:'com.liferay.portlet.journal.model.JournalArticle', classPK: 'articleResourcePK'});


So, my suggestion, right now, is option 1, embed the token
@view_counter@ in the Journal Template (cleaner and more
manageable) or in your article content (very easy, but harder to manage
across many articles).

The reason we haven't done this statically in, say the Journal Content
portlet, or the Asset publisher jsps, is because I believe that
the ajax we use to count views would be too costly in performance of the
portal overall for too little gain. My plan was to document it with the
intent that developers would apply it where they need it only, say in a
specific Journal Template... usually you know quite precisely WHAT you
want to count...

BUT, we're open to suggestions...

Where should we include this feature???
AND
How do we make it optional in such a way that it's useful from both
Asset publisher and Journal Content... for Assets other than Journal
Articles etc... (like those available to Asset publisher...)?

Would it be sufficient to document it as an "advanced" developers
feature?
OR
Do we try to cram it somewhere (or many somewheres) into the UI.

Cheers,

Ray
thumbnail
Jorge Ferrer, geändert vor 16 Jahren.

RE: Re: [Liferay Forums][Beta Testing]Number of views

Liferay Legend Beiträge: 2871 Beitrittsdatum: 31.08.06 Neueste Beiträge
Ray already knows my opinion on this, but here it goes for everybody else.

I think that we should add this by default for articles that do not have a template. Once we start providing default templates (hopefully soon) several of them will probably have the counter by default too.

The reason for this is that it's what most non-advanced people will want and is what most CMSs that I know of offer. The only counter argument would be not including it for performance issues, but I think that it shouldn't affect that much and also performance optimization is usually done by more advanced people than those that just use the CMS and want the article views counted.

Other opinions?
thumbnail
Shivani Chandna, geändert vor 16 Jahren.

RE: Re: [Liferay Forums][Beta Testing]Number of views

Junior Member Beiträge: 54 Beitrittsdatum: 17.07.07 Neueste Beiträge
I would suggest that the property for journal article be kept in portal.properties - keeping the default option as allow counter tracking to true.

But this has a drawback - what if only some journal articles need to be tracked and not all - in that case, it is best to think of keeping an option at GUI level to override the default settings for individual journal articles.
thumbnail
Tim Lewis, geändert vor 13 Jahren.

RE: Re: [Liferay Forums][Beta Testing]Number of views

New Member Beiträge: 17 Beitrittsdatum: 01.07.10 Neueste Beiträge
Hi Ray,
Can you think of any reason why @view_counter@ would show nothing when placed in an article or a velocity template? It just comes back empty for me. I am using 6.0 RC2.

Thanks,
Tim