Skip to main content
Version: 1.0.0

Session_3DViewer

Purpose​

The Session_3DViewer collection logs user sessions and interactions within the 3D viewer. Each document tracks session metadata such as device information, session timing, viewed products, tried variants, consumed bandwidth, and user actions. This data is used for analytics, usage tracking, and improving the 3D viewing experience.

Document schema​

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

Indexes​

  • catalogProductRefsDoc is a string that refers to the ID of the CataloguesProducts collection;
  • 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_catalog_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 session3DViewerRefDoc = doc(db, "Session_3DViewer", sessionId);

// Get the Document Snapshot from the Reference Doc
const session3DViewerRefSnap = await getDoc(session3DViewerRefDoc);

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

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