Closed mateostabio closed 2 years ago
This would require either making an AJAX request to a template in which the increment takes place before redirecting, or by setting the link to an intermediate template that performs the increment and then forwards them onwards, for example:
{# Increment the entry count #}
{% set entryId = craft.app.request.get('entryId') %}
{% if entryId %}
{% do craft.entryCount.increment(entry.id) %}
{% endif %}
{# Perform the redirect #}
{% set redirectUrl = craft.app.request.get('redirectUrl') %}
{% if redirectUrl %}
{% redirect(redirectUrl) %}
{% endif %}
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?