// After user logs in or data loadswindow.Asyntai = window.Asyntai || {};
window.Asyntai.userContext = {
"Customer name": currentUser.name,
"Email": currentUser.email,
"Subscription plan": currentUser.subscription.planName,
"Cart total": cart.total,
"Loyalty points": currentUser.loyaltyPoints
};
// You can update it anytime - changes apply to the next messagewindow.Asyntai.userContext["Cart total"] = newTotal;
チャットが開いたときにのみユーザーデータを取得します(パフォーマンスに最適):
// Define a function to fetch user contextwindow.Asyntai = window.Asyntai || {};
window.Asyntai.fetchUserContext = function() {
return fetch('/api/your-user-context-endpoint/')
.then(function(response) { return response.json(); })
.then(function(data) {
window.Asyntai.userContext = data;
});
};
// The widget automatically calls this when the chat opens
アクセス制御ではありません - User context is set by your page in the visitor's browser, so it must never be what stands between a visitor and restricted content. To restrict which knowledge items a visitor can retrieve at all, use Access Tags (Enterprise) — enforced on our servers with a claim signed by your own back end.
連携ステータス
After implementing, visit the User Context settings page to verify your integration is working. The status card will show:
コンテキストが受信されているかどうか
コンテキスト付きの最新メッセージ
送信されているコンテキストデータのプレビュー
Platform Guides
Using a specific CMS or e-commerce platform? We have step-by-step setup instructions for each — pick yours below to jump straight to the guide.