Session_Apps
Purpose
The Session_Apps collection logs user sessions and interactions within the ARShades Android and iOS applications. 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 user experience.
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",
"lineTagRef": "string",
"list_tried_variants": [
{
"catalogVariantRefs": "string",
"sizeRef": "string",
"timeStart": "timestamp",
"totalSeconds": "number"
}
],
"productName": "string"
}
],
"referrer": "string",
"sessionEndDate": "string",
"sessionStartDate": "string",
"totalTime": "number"
}
Indexes
- 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_catalogue_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 sessionRefDoc = doc(db, "Session_Apps", 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_Apps"),
where("list_catalog_product_refs", "array-contains", catalogueProductId)
);
// Query sessions for a specific catalogueVariant
const sessionsByCatalogueVariant = query(
collection(db, "Session_Apps"),
where("list_catalogue_variant_refs", "array-contains", catalogueVariantId)
);