How to set cookie and redirect to page one time How can I redirect a member to account page on first visit with a cookie set? My redirect is looping now. 

{% if currentUser %}
   {% set name = currentUser.firstName %}
   {% do craft.lj_cookies.set('account', name) %}



   {% set redirect = craft.lj_cookies.get('account') %}

   {% if redirect == name %}
       {% redirect name %}
   {% endif %}

{% endif %}


It's not possible to visit any other URL anymore.
Try this:

{% if currentUser %}
    {% set name = currentUser.firstName %}
    {% if craft.lj_cookies.get('account') != name %}
        {% do craft.lj_cookies.set('account', name) %}
        {% redirect name %}
    {% endif %}
{% endif %}


In you're original code you're setting the cookie before getting it into the redirect variable, so the {% if redirect == name %} conditional is always true.