putyourlightson / craft-entry-count Goto Github PK
View Code? Open in Web Editor NEWCounts and displays the number of times that an entry has been viewed in Craft CMS.
License: MIT License
Counts and displays the number of times that an entry has been viewed in Craft CMS.
License: MIT License
So sorry for being the noob here but as the title say, I'm pretty new to craft and i'm having a bit of trouble implementing this. I have a structure with over 100 entries and I'm trying to implement this on the template that list those entries. So each entry will have a count next to it.
Does the code go inside the loop, outside the loop, or the template that each entry links to ?
I already have this in my code
{% set entries = craft.entries.section('drinks').orderBy('lft desc') %}
Facing the issue after updating to the latest craft version
Error: Typed property putyourlightson\entrycount\models\EntryCountModel::$dateCreated must not be accessed before initialization
Craftcms Version: 4.3.1
I initialized the dateCreated and dateUpdated value in the models and it works.
I am not that familiar with twig and craft, is it possible to get top 5 posts based on count? As far as I understand the count is in another table and i can not simply do
{% set entries = craft.entries({ section:'instaBlog', limit:3, offset: 0, order: "count desc" })%}
I am using Elements API to create a JSON feed with entries, but I really need to sort them by the number of views. Is this possible?
Thanks!
I am trying to find a way that stops fake entry counts from users just refreshing the page or visiting it multiple times on multiple machines.
What is the best way to not have the count increment on every page/entry refresh?
Is there some logic that can wrap around the increment call that checks for logged-in and not logged-in users making requests to the page?
installed plugin via the store, and entries get counted (none listed in the admin). And no show up in templates.
I'm using the following template code:
{% set entries = craft.entryCount.entries.section('articles')
.limit(4)
.all() %}
{% for entry in entries %}
{% set count = craft.entryCount.count(entry.id)
%}
<li>
<a href="{{ entry.url }}">{{ entry.title }}</a>
</li>
{% endfor %}
Any plans to add in a daily count for entries? A use case would be for having a most popular section of the last days entries.
I'm currently looking for something, and this plugin is the closest I've seen. If not, I'll try to extend your plugin.
I've just added Entry Count Plugin included the {% set count = craft.entryCount.count(entry.id) %}
and {{ count }}
tags on an entry template.
The plugin is enabled, however, the count is alway returning '0'. I've tried switching the 'Ignore logged in users' option and the IP field is blank.
Nothing is being written to the DB, either for old and newly created entries. Though, if I manually add a row to the craft_entrycount table, it displays correctly.
Is there something I've missed? I'm on Craft Pro 2.5.2767
Is there a way to order an entry loop by view count for a Most Popular Articles list?
I may be missing something, but is there a way to sort entries by count?
I assume I'm supposed to see a summary of entries and counts in the Entry Count cp area - but I just see "No entries counted".
I am incrementing counts - and have confirmed that from the front end via Twig (ie. {{ craft.entryCount.count(entry.id) }}
but none of that is reflected in the CP.
Craft 3.4.4
MySQL 5.7.26
PHP 7.3.8
Entry Count 2.0.2
My website is running in five languages. Your plugin counts every entry view (in any language/site) for each entry variation in each site. When I want to sort my entries on view count (which I suppose your plugin is mainly intended for), I should be able to get only the entries for my current site. This can be achieved by changing line 80 of EntryCountService.php to ->site(Craft::$app->getSites()->currentSite)
(instead of '*'
as argument to the function). This is also more in line with your control panel view: it counts every view as a view for each site, but displays all sites (so I now have 5 identical lines on my control panel view of your plugin). I will create a pull request for this fix when I have more time later, if you don't find the time to implement this fix yourself.
I am wanting to exclude one or more entries (by their entry ID) from the entries output. The output would be displaying a limited number of the most viewed entries (e.g. 6) but there may be cases where certain entries shouldn't be displayed and therefore would need to be excluded. Is this possible?
Hi,
We would like to update the count from our mobile app (native iOS/Android). Is there a way to accomplish this?
Thanks!
Any Idea about this Topic? When the Plugin is activated the loadtime is +2-3 seconds as if the plugin is disabled? :/ I've it on my Homepage for 30 posts they all get a +1 after each reload. Are this to much posts?
Hi,
This is more of a feature request than an issue.
Would it be possible to make the plugin display count in a new column in standard list of entries in Craft admin?
Thanks!
Marijana
I have ~260,000 rows for Entry Count and the CP template tries to load all the entries, which then doesn't load.
This is the same for Entry Count and Entry Count Plus (Craft 2).
Thanks.
I have an entry structure that I'd like to get an entry count on.
They are all living on a page as a list.
When someone clicks on a list item, it doesn't go to the entry url, it goes to a document asset link in a new tab, I'd like to be able to add an entry count when the users clicks on a list item.
Is this something that is possible to do with this plugin in a link <a>
tag?
I have this error after finished the "Template Variables" video on Mijingo.
.../craft-cms-plugin-dev/craft/plugins/entrycount/variables/EntryCountVariable.php(28)
public function getCount($entryId)
17 {
18 return craft()->entryCount->getCount($entryId);
19 }
20
21 /**
22 * Returns counted entries
23 *
24 * @return ElementCriteriaModel
25 */
26 public function getEntries()
27 {
28 return craft()->entryCount->getEntries();
29 }
30
31 /**
32 * Increment count
33 *
34 * @param int $entryId
35 */
36 public function increment($entryId)
37 {
38 craft()->entryCount->increment($entryId);
39 }
I tried to copy and paste your code into the file but it did not go away.
Craft CMS 2.6.2973
Would be great ;-]
I have followed the installation/ templating instructions but yet in the dashboard and on the entry pages, but they aren't being counted and the dashboard still says "No entries counted". Any guidance would be appreciated.
I want to get the entry count in my json feed which is generated by Elements API. So I tried this:
use putyourlightson\entrycount\EntryCount;
$views = EntryCount::$plugin->getCount($entry->id);
But then I get:
{
"error": {
"code": 0,
"message": "Calling unknown method: putyourlightson\\entrycount\\EntryCount::getCount()"
}
}
Any help is appreciated, thanks!
The CP only shows enabled entries. How about an option to also show disabled entries, or just all entries that have an entry count > 0?
How I can get the aggregate sum of all entries count in front end
Is there a way to use the plugin with the {% paginate %} tag? So something like this
{% paginate craft.entryCount.entries.all() as pageInfo, entries %}
I tried this tag, but got this error
Argument 1 passed to craft\helpers\Template::paginateCriteria() must implement interface craft\elements\db\ElementQueryInterface, array given
I have added the plugin in my craft2 cms system and it doesn't show in plugin panel. Where i was wrong?
craft/plugins/entry-count
Hi Ben,
Any idea how I can sort entries by their view count? I've tried
order('count desc')
But no luck. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.