Skip to main content
Version: 1.0.0

Session_WebVto

Purpose​

The Session_WebVto collection logs user sessions and interactions within the Web Virtual Try-On (VTO) feature. Each document tracks session metadata such as device information, session timing, viewed products, and tried variants. This data is used for analytics, usage tracking, and improving the VTO experience on the web platform.

Document schema​

{
"catalogRef": "string",
"device": "string",
"deviceId": "string",
"deviceOs": "string",
"isFirstSession": "boolean",
"list_catalog_product_refs": ["string"],
"list_catalogue_variant_refs": ["string"],
"list_line_tag_refs": ["string"],
"list_size_refs": ["string"],
"list_viewed_products": [
{
"catalogProductRef": "string",
"date": "timestamp",
"lineTagRef": "string",
"list_tried_variants": [
{
"catalogVariantRefs": "string",
"lastUpdate": "timestamp",
"sizeRef": "string",
"timeStart": "timestamp",
"totalSeconds": "number"
}
],
"productName": "string",
"totalSeconds": "number"
}
],
"referrer": "string",
"sessionEndDate": "string",
"sessionStartDate": "string",
"totalTime": "number"
}

Indexes​

  • catalogRef is a string that refers to the ID of the Catalogues collection;
  • list_catalog_product_refs is a [] of strings that refer to the IDs of the CataloguesProducts collection;
  • list_catalogue_variant_refs is a [] of strings that refer to the IDs of the CataloguesVariants collection;
  • list_line_tag_refs is a [] of strings that refer to the IDs of the Tags collection;
  • In each map object in "list_viewed_products":
    • catalogProductRef is a string that refers to the ID of the CataloguesProducts collection;
    • lineTagRef is a string that refers to the ID of the Tags collection;
    • catalogVariantRefs is a strings that refers to the ID of the CataloguesVariants collection.

Query examples​

// Fetch the Reference Doc from Firebase
const sessionRefDoc = doc(db, "Session_WebVto", sessionId);

// Get the Document Snapshot from the Reference Doc
const sessionRefSnap = await getDoc(sessionRefDoc);

// Query sessions for a specific catalogueProduct
const sessionsByCatalogueProduct = query(
collection(db, "Session_WebVto"),
where("list_catalog_product_refs", "array-contains", catalogueProductId)
);

// Query sessions for a specific catalogueVariant
const sessionsByCatalogueVariant = query(
collection(db, "Session_WebVto"),
where("list_catalogue_variant_refs", "array-contains", catalogueVariantId)
);