platformOS & Siteglide allows you to store additional information for a visitor by adding additional fields to their session when they take certain actions. You can then use these additional session fields to serve them more relevant page content.

Important Note: It is the responsibility of the client or agency to ensure that their site appropriately communicates the cookies they use as well as any potential functionality to enable or disable cookies.

You can find out more information about the required session cookies that all Siteglide sites use in our article on How we use Cookies at Siteglide.

How can you use custom session fields?

Step 1: Save a new session field

Saving session fields in Liquid is just like using the liquid "assign" tag to create a variable. Simply use the session tag and choose a field name on your page, template file or other:

{% session my_field_name = "any value" %}

  • my_field_name - Can be changed any word you would like the session name to be.
  • "any value" - The contents of these quote marks can be changed to anything you would like the contents of this session field to be.

Step 2: Read a session field

To output a session field on the Page, you can access under context.session:

{{context.session.my_field_name}} <!-- any value -->

You can use this in your logic to deliver more relevant content:

{% if context.session.my_field_name == "any value" %} <!-- Do something --> {% endif %}

This Article is heavily inspired by the platformOS documentation on their Liquid tags. We'd recommend you take a look to learn more about the tools you have as a Liquid developer.

Did this answer your question?