Loops AI

Product & User Context

Send relevant product and user data so the assistant can answer with better context.

Context lets the assistant understand who the user is and what they are viewing.

Send context during init

window.LoopSmartAI.q.push([
  "init",
  {
    agentId: "YOUR_AGENT_ID",
    productContext: {
      productCode: "SKU-123",
      productName: "Premium Headphones",
      category: "audio",
    },
    userContext: {
      id: "user-456",
      email: "user@example.com",
      name: "Jane Doe",
    },
  },
]);

Update context dynamically

Use these methods when page state changes in a SPA, after login, or after product navigation.

window.LoopSmartAI.setProductContext({
  productCode: "SKU-999",
  productName: "Travel Backpack",
});

window.LoopSmartAI.setUserContext({
  id: "user-789",
  membership: "premium",
});

You can also update both in one call:

window.LoopSmartAI.updateContext(
  {
    productCode: "SKU-777",
  },
  {
    id: "user-789",
  },
);

Product context

FieldTypeNotes
productCodestringMost useful identifier
productNamestringUser-friendly display name
categorystringOptional but useful for hints
pricenumberOptional
currencystringOptional

User context

FieldTypeNotes
idstringStable internal user ID
customerIdstringLegacy alias used in older setups
emailstringOptional if available
namestringOptional
membershipstringOptional segment or plan value

Data minimization

Only send the fields required for conversation quality. Avoid sensitive personal data.

Continue to JavaScript API.

On this page