{% set_session %}

Sets properties to the user session. Note that this doesn't mean anything unless the user (or the developer) has granted permission for the session.

Syntax

{% set_session property1:value1 [property2:"value 2"] ... %}

You may also include reference variables as properties, which will be dereferenced to their property names before setting the session properties.

Examples

Set Session

Copy
{% if request.query_params.sortby %} {% set_session sortby:request.query_params.sortby %} {% endif %} {% var sortby = session.sortby | default: 'post_date' %} {% blog_post_collection posts sort_by:sortby %}

Set Session advanced

Copy
{% if submission.is_valid %} {% var forms_submitted = session.submittedForms | to_int | plus: 1 %} {% var session_formname = form.name.value | prepend:'submitted' %} {% set_session formSubmitted:"true" submittedForms:forms_submitted domain:submission.domain &session_formname:'true' %} {% endif %}