Skip to Content
The Makinari API repo now includes an MCP Server — connect your AI models directly. View on GitHub →

Practical Use Cases

By Specific Pages

function initContextualChat() { const currentPage = window.location.pathname; switch(true) { case currentPage.includes('/pricing'): window.MarketFit.openChatWithTask({ welcomeMessage: "Need help choosing the perfect plan?", task: "I want to compare Pro and Enterprise plans", clearExistingMessages: true }); break; case currentPage.includes('/demo'): window.MarketFit.openChatWithTask({ welcomeMessage: "Excellent! I'll help you schedule a demo.", task: "I would like to schedule a demo for next week", clearExistingMessages: true }); break; case currentPage.includes('/support'): window.MarketFit.openChatWithTask({ welcomeMessage: "I'm here to solve any technical issues.", task: "I have a problem with ", clearExistingMessages: true, newConversation: true }); break; default: window.MarketFit.openChatWithWelcomeMessage( "Hello! How can I help you today?" ); } }

Integration with Authentication

// Complete login function with chat identification async function loginUser(credentials) { try { // 1. Authenticate user in your system const user = await authenticateUser(credentials); // 2. Identify user in chat if (window.MarketFit) { await window.MarketFit.identify({ name: user.fullName, email: user.email, phone: user.phone, userId: user.id, subscriptionType: user.subscription, company: user.company, role: user.role }); console.log('User identified in chat'); } // 3. Optional: open chat with personalized welcome window.MarketFit.openChatWithWelcomeMessage( `Hello ${user.firstName}! How can I help you today?` ); } catch (error) { console.error('Error in login:', error); } } // Logout function with cleanup function logoutUser() { // 1. Logout from your system clearUserSession(); // 2. Clear chat identification if (window.MarketFit) { window.MarketFit.clearUserIdentity(); } }

Specific Action Buttons

// Schedule Demo function scheduleDemo() { window.MarketFit.openChatWithTask({ welcomeMessage: "Perfect! I'll help you schedule a personalized demo.", task: "I want to see a platform demo", newConversation: true, clearExistingMessages: true }); } // Get Quote function getQuote() { window.MarketFit.openChatWithTask({ welcomeMessage: "I'll help you get a personalized quote.", task: "I need a quote for my company", newConversation: true, clearExistingMessages: true }); } // Contact Sales function contactSales() { window.MarketFit.openChatWithTask({ task: "I want to speak with someone from the sales team", autoSend: true, newConversation: true, clearExistingMessages: true }); } // Technical Support function technicalSupport() { window.MarketFit.openChatWithTask({ welcomeMessage: "I am a technical support specialist. What problem do you have?", task: "I have a technical problem with ", newConversation: true, clearExistingMessages: true }); }

Chat Initially Hidden

// Initialize with hidden chat and show it under specific conditions window.MarketFit.init({ siteId: 'your-site-id', apiEndpoint: 'https://api.your-domain.com', chatHidden: true, // Chat starts hidden chat: { enabled: true, agentName: 'Support', welcomeMessage: 'Hello! How can I help you?' } }); // Show chat after certain time or action setTimeout(() => { window.MarketFit.showWidget(); window.MarketFit.openChatWithWelcomeMessage( "Hello! I noticed you've been browsing. Do you need help?" ); }, 30000); // 30 seconds // Or show chat when user scrolls let chatShown = false; window.addEventListener('scroll', () => { if (!chatShown && window.scrollY > 500) { chatShown = true; window.MarketFit.showWidget(); } });

Automatic Triggers

// Time on page setTimeout(() => { window.MarketFit.openChatWithTask({ welcomeMessage: "I noticed you've been exploring our site. Any questions?", task: "Yes, I have questions about ", clearExistingMessages: false }); }, 45000); // 45 seconds // Exit Intent document.addEventListener('mouseleave', function(e) { if (e.clientY <= 0) { window.MarketFit.openChatWithTask({ welcomeMessage: "Wait! Is there anything I can help you with before you go?", task: "I need more information about ", clearExistingMessages: true }); } }); // Deep Scroll let deepScrollTriggered = false; window.addEventListener('scroll', () => { if (!deepScrollTriggered && window.scrollY > document.body.scrollHeight * 0.8) { deepScrollTriggered = true; window.MarketFit.openChatWithTask({ welcomeMessage: "I see you've read a lot of content. Would you like to speak with an expert?", task: "Yes, I would like more information about ", }); } });
Last updated on