Custom session data
Attach your own identifiers and attributes to sessions, manage them in Seena, and let the Librarian use them safely.
Custom session data lets you attach your own key-value metadata to a visitor session as it happens. Think customer IDs, account IDs, plan tiers, experiment variants, environments, or any other small piece of context that helps you interpret a session later.
Once attached, the data shows up in Seena in four places:
- Site settings — to see observed keys, mark a key as PII, and inspect rejected writes.
- Session detail — as a Custom Data card on the individual session page.
- Dashboard filters — so you can narrow session and interview lists to a cohort.
- The Librarian — so you can ask questions like "show me enterprise sessions" or "what are Pro users struggling with?"
Custom data needs a visitor's opt-in
Custom session data is only collected from visitors who opt in to enhanced analytics. Seena works without cookies for every visitor by default, and in that mode it does not accept custom data. The one thing Seena may store on a device before an opt-in is the choice a visitor makes on Seena's own banner.
Until a visitor opts in, the data you set stays in the browser, in memory. Nothing is sent to Seena, and nothing is written to the visitor's device. The moment they opt in, Seena receives what you have set so far and attaches it to the visit. If they decline, withdraw, or leave the page first, the held data is dropped.
A visitor can opt in through any of these:
- Your cookie banner ("Use my cookie banner"). Seena reads Google Consent Mode v2, IAB TCF v2.2, OneTrust and Cookiebot automatically. For anything else, call
Seena.consent.grant()andSeena.consent.revoke()from your banner's callback; both work before the script loads, when called through theSeenaReadyqueue. On these sites the script tag can carrydata-seena-consent="required", which makes Seena start without cookies and wait for your banner. It is optional and only makes Seena stricter; the snippet the dashboard gives you for this setting includes it, and if you installed earlier, Seena still follows your setting without it. - Seena's banner ("Use Seena's banner"), for sites that don't run a consent manager. A "Privacy" link of your own that calls
Seena.consent.open()lets visitors change their choice later. Seena's banner stores only the visitor's choice. - An interview. When a visitor takes part in an interview, that one visit becomes enhanced. Your custom data for it is linked to the conversation. Nothing is stored on their device, and the visit isn't linked to any other.
Seena honours Global Privacy Control. For the four consent managers Seena reads automatically, when the browser sends it, a consent the manager stored earlier or granted by default isn't enough, and Seena waits for a fresh choice the visitor makes on that page. If you call Seena.consent.grant() yourself, Seena treats it as the visitor's choice, so your banner should apply Global Privacy Control before it calls. A visitor's earlier Allow on Seena's own banner is remembered even when the browser sends it, because it was an explicit click.
On a site set to "Cookie-less only", custom data is therefore only collected from visits where the visitor takes part in an interview. You choose the setting in the analytics agent's setup, under Visitor consent. The install guide explains each option.
Customer IDs and other identifiers can tie a visit, and an interview answer, to a specific person. Where the data goes: onto the session in Seena, where your team sees it in session details, filters and the Librarian. Keys you mark as PII are masked in the dashboard and tokenized before they reach a model provider (see below). Treat anything that identifies a person as identifying.
Good uses for custom session data
Good examples:
customer_idaccount_idplan_tierexperiment_variantenvironmentsigned_in
Custom session data is best for small, stable identifiers or attributes that help you slice behavior and interviews into meaningful cohorts.
It is not meant for large payloads, nested objects, event streams, or whole user profiles.
Trust model
Custom session data is client-provided context.
That makes it very useful for:
- research and cohorting
- stable customer or account references
- plan, experiment, environment, or signed-in state
But it is not a verified identity system, and it should not be treated as an authorization or billing source of truth.
In practice, that means:
- use it to help Seena interpret sessions
- do not use it as proof that a visitor really belongs to a specific account
- keep your own backend or data warehouse as the source of truth for entitlements, permissions, and revenue events
How to send it
There are two supported ways to attach custom session data.
1. JavaScript API
Call window.Seena.setCustomData(...) any time after the widget is available:
<script>
window.SeenaReady = window.SeenaReady || [];
window.SeenaReady.push(function () {
Seena.setCustomData({
customer_id: 'cus_123',
plan_tier: 'enterprise',
signed_in: true
});
});
</script>
Use the SeenaReady queue when you are not certain the widget script has already loaded.
Call it as early as you like, for example at sign-in. Seena holds the values in memory until the visitor opts in, then sends them. See Custom data needs a visitor's opt-in.
2. Script tag attribute
If the values are known at page render time, you can put them directly on the script tag:
<script
src="https://app.seenalabs.io/widget/seena.js"
data-site-id="YOUR_SITE_ID"
data-custom-data='{"environment":"production","plan_tier":"pro"}'
async
></script>
This is a good fit for attributes that do not change during the session. The same rule applies: Seena holds them in the browser until the visitor opts in.
Merge behavior
Custom session data is merged into the current session over time.
Seena.setCustomData({ plan_tier: 'pro', signed_in: false });
Seena.setCustomData({ signed_in: true });
The session ends up with:
{
"plan_tier": "pro",
"signed_in": true
}
To remove a key, send null:
Seena.setCustomData({ plan_tier: null });
Limits
Phase 1 custom session data has hard caps:
- 20 keys per session
- 64 characters max per key name
- 500 characters max per string value
- 4 KB total across the whole object
- Values must be string, number, boolean, or null
Arrays and nested objects are rejected.
Key naming rules
Keys must:
- start with a letter
- use only letters, numbers,
_,.,:, or-
Examples:
- valid:
customer_id,plan.tier,signup:step - invalid:
1customer,has space,user@email
Marking a key as PII
In Settings → your Site → Custom Data, you can mark a key as PII.
Do that for keys whose values should never be sent raw to LLM providers. Typical examples:
customer_idaccount_id- email-like identifiers
- internal IDs that can identify a specific user
When a key is marked as PII:
- Seena still stores it on the session
- the session detail view masks it by default
- the Librarian gets a tokenized form instead of the raw value
- the UI can still detokenize it for the human reading the answer
This means you can still use the key operationally without leaking raw values into model context.
Where to find it in Seena
Site settings
Open Settings, select your site, then open Custom Data.
This is where you:
- see every observed key
- rename a key for display in the dashboard
- mark a key as PII
- inspect recent rejected writes
Session detail
Open any session and look for the Custom Data card. PII-marked values are hidden by default.
Behavior and interview filters
On the session and interview list pages, Seena can filter by exact custom-data matches. This is useful for questions like:
- "show me only enterprise users"
- "show me sessions from experiment B"
- "show me signed-in traffic only"
The Librarian
The Librarian can use custom session data to find cohorts and explain what they did:
- "Show me enterprise sessions from this week"
- "What are Pro users struggling with?"
- "Compare sessions where signed_in is true versus false"
What custom session data does not do yet
Today, custom session data is not yet part of interview-agent trigger conditions.
You can use it for:
- filtering
- session interpretation
- Librarian queries
But you cannot yet say:
- "only trigger this interview agent when
plan_tier = enterprise"
That is planned follow-up work, not part of the current rollout.
Recommendations
Keep custom session data small and intentional.
Start with 2-5 keys that will clearly improve your analysis, for example:
- one stable identifier like
customer_id - one cohort field like
plan_tier - one product context field like
environmentorexperiment_variant
If you add too many keys too early, you create a taxonomy problem before you create useful insight.
What to read next
- Analytics data pages — filter sessions into meaningful cohorts.
- Interview data pages — inspect the underlying conversations.
- Explore with The Librarian — ask natural-language questions over your tagged sessions.