Unset_session

Unset_session

{% unset_session %}

Removes custom properties from the session.

{% unset_session properties? %}

{% unset_session
properties
 
One or more values. May use the variable arguments syntax. The names of the properties to remove. If not included, all properties will be removed
%}

Related

{% unset_dictionary %}

Removes properties from an editable dictionary object. If the dictionary does not exist an empty one will be created and stored on the current scope. If the dictionary exists but is not editable this will throw an error.

{% set_session %}

Saves custom properties on the session. Note that this doesn't mean much unless the user (or the developer) has granted permission for sessions.

{% unset_client %}

Removes custom properties from the client.

{% unset_client_permission %}

Removes the specified permissions from the permissions cookie. Note that this is not the same as denying permission since there will be no record that permission was either granted or denied after the permission has been unset.

{% unset_profile %}

Removes custom properties from the attribute dictionary of the currently logged-in profile. Note that this is meaningless unless the user is logged in.

{% unset_profile_setting %}

Removes custom values from the profile settings for the currently logged-in profile. Note that this is meaningless unless the user is logged in. For settings with a default value this will reset them to the default, and for all other settings this will set them to empty/unselected/false. Profile settings may be required and include validation, in which case all settings will be validated before being removed and any validation error will prevent any settings from being set. Validation errors may optionally be output to a variable.

{% unset_cookie %}

"Unsets" one or more cookies. Because of how cookies work, this will actually ADD the cookie to the response with an expiration date in the past.

{{ session }}

The session object is available on every page, and contains information about the user's current session. Note that most of these properties are only meaningful if the user has allowed permission for sessions. Additionally, sessions require cookies in order to work. Requests made without cookies (such as by bots or browsers with cookies disabled) or without permission for sessions will always behave like an initial page-load without existing session information. The session object is one of a handful of simple mechanisms to enable personalization on your site. Used well, these can be powerful tools for developers and website owners.

{% auth unset_setting %}

Unsets the specified profile settings from the auth profile (which is not necessarily the same as the currently-logged in profile). For settings with default values this will set them back to their defaults. For settings without default values this will set them to empty/unselected/false. If any of the specified settings is required, it will result in an invalid_value error and will prevent any of the new settings from being unset. If the auth is aborted then the unset settings will not be saved in between requests.

{% auth unset_setting settings %}

{% auth
unset_setting
settings
 
One or more values. May use the variable arguments syntax. The settings to unset on the auth profile
%}

Error Codes:
command_disabled - Indicates that the current method has been disabled at the site level. This will be set for any auth method if profiles are disabled.
no_init - Indicates that no initialization method has been called yet.
aborted - Indicates that the method could not be performed because {% auth abort %} has been called.
invalid_value - One or more of the settings is required.

Related

{% auth set_setting %}

Sets the specified profile settings to their new values on the auth profile (which is not necessarily the same as the currently-logged in profile). If any of the specified settings has validation, the new settings will be validated before being set. An invalid value for any setting will prevent any of the new settings from being set. If the profile exists and the auth is not aborted before the end of the request the new values will be saved to the profile. If the auth is aborted then the new values will not be saved in between requests. If the profile does not exist but is registered in the same request then the new values will be saved on the new profile.

{% set_profile_setting %}

Saves custom values to predefined profile settings that will be accessible whenever the current profile is logged in. Note that this is meaningless unless the user is logged in. Profile settings may include validation, in which case all settings will be validated before being set and any validation error will prevent the setting(s) from being set. Validation errors may optionally be output to a variable.

{% unset_profile_setting %}

Removes custom values from the profile settings for the currently logged-in profile. Note that this is meaningless unless the user is logged in. For settings with a default value this will reset them to the default, and for all other settings this will set them to empty/unselected/false. Profile settings may be required and include validation, in which case all settings will be validated before being removed and any validation error will prevent any settings from being set. Validation errors may optionally be output to a variable.

{% auth unset_attribute %}

Removes the specified profile attributes from the auth profile (which is not necessarily the same as the currently-logged in profile). If the auth is aborted then the removed attributes will not be saved in between requests.

Examples

Demonstrates how to unset Session.

Unset Session

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

Demonstrates how to unset Session Properties dynamically.

Unset Session Properties dynamically

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

Demonstrates how to unset multiple Session properties.

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 %}