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
stringthat refers to the ID of theCataloguesProductscollection; - catalogRef is a
stringthat refers to the ID of theCataloguescollection; - list_catalog_product_refs is a
[]ofstrings that refer to the IDs of theCataloguesProductscollection; - list_catalog_variant_refs is a
[]ofstrings that refer to the IDs of theCataloguesVariantscollection; - list_line_tag_refs is a
[]ofstrings that refer to the IDs of theTagscollection; - In each map object in "list_viewed_products":
- catalogProductRef is a
stringthat refers to the ID of theCataloguesProductscollection; - lineTagRef is a
stringthat refers to the ID of theTagscollection; - catalogVariantRefs is a
strings that refers to the ID of theCataloguesVariantscollection.
- catalogProductRef is a
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)
);