doublesecretagency / craft-viewcount

View Count plugin for Craft CMS
Other
6 stars 4 forks source link

Add ability to not allow tracking for logged in users and certain IPs #1

Closed zizther closed 5 years ago

zizther commented 5 years ago

It would be a nice feature to be able to disable logged in users as one option. Another option which would be good is to not record an event from certain IPs

lindseydiloreto commented 5 years ago

Depending on how you are registering the view, you can simply wrap that in a conditional tag...

{% if not currentUser %}
    {% do craft.viewCount.increment(elementId) %}
{% endif %}

The conditional could be as complex as you want it to be.