{% unset_session %}

Unsets custom properties from the user session.

Syntax

{% unset_session [property1] [property2] [etc...] %}

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

If no properties are specified, then ALL custom session properties will be unset

Examples

Unset Session

Copy
{% if client_permissions.do_not_track %} {% unset_session %} {% endif %}

Unset multiple Session properties

Copy
{% if request.query_params.ad_setting == "false" %} {% set_client_permission deny ads %} {% unset_session facebook_advertiser_id google_ads_id other_third_party_ids %} {% endif %}

Unset Session Properties dynamically

Copy
{% var props = request.query_params.clearprops | split: ',' %} {% for prop in props %} {% unset_session &prop %} {% endfor %}