Answers.Body: <p>You can use the <a href="https://github.com/nystudio107/craft-cookies" rel="nofollow noreferrer">cookies</a> Plugin (or <a href="https://github.com/lewisjenkins/craft-lj-cookies" rel="nofollow noreferrer">for Craft 2</a>)  to store the value of the timestamp when the users has visited the page for the last time. Or you can create your custom code like explained in the question: <a href="https://craftcms.stackexchange.com/questions/648/prescribed-way-to-set-cookies-from-plugin-or-twig">How to set a cookie</a></p>
  
  <p>You can get the current timestamp like it's stated in the <a href="https://craftcms.com/docs/templating/datetime#see-also" rel="nofollow noreferrer">docs</a> </p>
  
  <pre><code>{% set currentTimestamp = now|date('U') %}
  </code></pre>
  
  <p>And store the cookie like <a href="https://github.com/nystudio107/craft-cookies#setting-cookies" rel="nofollow noreferrer">explained</a></p>
  
  <pre><code>{# Set the cookie using 'set' variable #}
  {% do craft.cookies.set( NAME, VALUE, DURATION, PATH, DOMAIN, SECURE, HTTPONLY) %}
  {% set yourTimeStamp = getCookie( NAME ) %}
  </code></pre>
  
  <p>Then you'll search for entries <a href="https://craftcms.stackexchange.com/questions/2083/fetch-all-entries-with-dateupdated-after-a-given-time">after the specific date</a></p>
  
  <pre><code>{% set newEntries = craft.entries.postDate('&gt;= ' ~ yourTimeStamp)|length %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-15T10:57:58.077Z
Answers.LastActivityDate: 2018-02-15T21:04:01.367Z
Answers.LastEditDate: 2018-02-15T21:04:01.367Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I'm relatively new to craft, but thanks to this board I am making great progress :-) But here is my first question, which is not answered in here:</p>
  
  <p>I would like to get the count of entries of a certain section, which have been published <strong>since the last visit of a user</strong>. I'm pretty sure I have to somehow use a cookie for this, but am completely unaware of how to do this in combination with twig :(</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-15T10:16:40.947Z
Comments.Text: Are you talking about logged in users?
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-15T10:17:36.483Z
Comments.Text: Sorry for being unclear about this. I mean normal, frontend visitors without any account.
Comments.UserDisplayName: Michal Mladekson
Tags: <entries><count>
Title: Get count of new entries since last visit
ThreadText: # Get count of new entries since last visit
  
  (Asked by: username_0 on 2018-02-15)
  
  I'm relatively new to craft, but thanks to this board I am making great progress :-) But here is my first question, which is not answered in here:
  
  I would like to get the count of entries of a certain section, which have been published **since the last visit of a user**. I'm pretty sure I have to somehow use a cookie for this, but am completely unaware of how to do this in combination with twig :(
  
  **Tags:** entries, count
  
  > **Comments:**
  > **username_1**: Are you talking about logged in users?  
  > **username_0**: Sorry for being unclear about this. I mean normal, frontend visitors without any account.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-02-15. Score: 1 | Accepted answer
  
  You can use the [cookies](https://github.com/nystudio107/craft-cookies) Plugin (or [for Craft 2](https://github.com/lewisjenkins/craft-lj-cookies)) to store the value of the timestamp when the users has visited the page for the last time. Or you can create your custom code like explained in the question: [How to set a cookie](https://craftcms.stackexchange.com/questions/648/prescribed-way-to-set-cookies-from-plugin-or-twig)
  
  You can get the current timestamp like it's stated in the [docs](https://craftcms.com/docs/templating/datetime#see-also)
  
  ```
  {% set currentTimestamp = now|date('U') %}
  
  ```
  
  And store the cookie like [explained](https://github.com/nystudio107/craft-cookies#setting-cookies)
  
  ```
  {# Set the cookie using 'set' variable #}
  {% do craft.cookies.set( NAME, VALUE, DURATION, PATH, DOMAIN, SECURE, HTTPONLY) %}
  {% set yourTimeStamp = getCookie( NAME ) %}
  
  ```
  
  Then you'll search for entries [after the specific date](https://craftcms.stackexchange.com/questions/2083/fetch-all-entries-with-dateupdated-after-a-given-time)
  
  ```
  {% set newEntries = craft.entries.postDate('>= ' ~ yourTimeStamp)|length %}
  
  ```
  
  
  ---
  
  