Skip to main content

Getting Started

AdMesh is a conversational advertising platform that enables platforms (like AI assistants, search engines, and chat applications) to monetize through contextually relevant product recommendations. AdMesh provides two SDKs for integration:
  • React SDK (admesh-ui-sdk): For frontend integration with tail format and product card layouts
  • AdMesh Weave Node SDK (admesh-weave-node): For backend Node.js integration with weave format
Choose Weave if:
  • Your platform supports rich media/cards
  • You want a visual, interactive experience
  • You have sufficient bandwidth
Choose Tail if:
  • Your platform is text-based
  • You want minimal UI changes
  • You want lightweight integration
Use React SDK if:
  • Your platform is built with React
  • You want tail or product card format
  • You want quick frontend integration
  • You need UI components for recommendations
Use AdMesh Weave Node SDK if:
  • You need weave format (inline product cards)
  • Your backend is built with Node.js
  • You want to embed recommendations in LLM responses
  • You need backend-side recommendation logic

React SDK Integration

Install via npm:
Or with yarn:
For detailed instructions, see Installation.
The React SDK supports:
  • Tail Format - Clickable links within conversational text
  • Product Card Layouts - Individual product recommendation cards
Not supported: Weave Format (use AdMesh Weave Node SDK instead)
Basic usage with AdMeshProvider:
Key points:
  • Wrap your app with <AdMeshProvider> and pass sessionId
  • Use <AdMeshRecommendations> to display recommendations
  • The SDK handles message deduplication and recommendation fetching automatically
For more examples, see Installation.
The sessionId parameter identifies a unique user session in AdMesh:
  • Purpose: Track recommendations across a conversation
  • Format: Any string (e.g., 'user-session-123')
  • Scope: Should be unique per user session
  • Lifetime: Persists for the duration of the conversation

Example:

Best Practices:

  • Generate a new sessionId for each user session
  • Store it in state or context
  • Pass the same sessionId throughout the conversation
  • Don’t change sessionId mid-conversation
Note: This is different from your platform’s chat ID. For example, in Perplexica:
  • chatId = Perplexica’s internal chat identifier
  • sessionId = AdMesh session identifier (passed to AdMeshProvider)
Use the theming API:
Yes! The React SDK is platform-agnostic and works with:
  • Tailwind CSS
  • Bootstrap
  • Material-UI
  • Chakra UI
  • Styled Components
  • Emotion
The SDK’s styles are isolated and won’t conflict with your framework.

Weave Format Integration

Weave format requires the AdMesh Weave Node SDK for backend Node.js integration:
  1. Install SDK: npm install admesh-weave-node
  2. Initialize SDK: Set up with your API key
  3. Call Recommendation API: Get recommendations for user query
  4. Embed in LLM Response: Integrate recommendations into your LLM response
  5. Track Interactions: Fire exposure, click, and conversion pixels
Note: Weave format is a backend integration for Node.js applications. It embeds product recommendations directly in LLM responses.
Backend (Node.js) Flow:
Key Point: Weave format integration happens on the backend (Node.js) using the AdMesh Weave Node SDK. The frontend receives the response with recommendations already embedded.
Backend (Node.js) generates the cards:The AdMesh Weave Node SDK returns product data that your backend embeds in the LLM response:
Backend responsibility:
  • Call AdMesh Weave Node SDK to get recommendations
  • Format recommendations as product cards
  • Embed cards in LLM response text
  • Return complete response to frontend
Frontend responsibility:
  • Display the LLM response with embedded cards
  • Fire exposure pixel when card is shown
  • Fire click pixel when user clicks
  • Handle card interactions
Frontend tracking (JavaScript):
Backend tracking (Node.js):The AdMesh Weave Node SDK handles backend-side tracking:
  • Exposure tracking when recommendations are generated
  • Click tracking via signed URLs
  • Conversion tracking via tracking pixels

Tail Format Integration

Tail format can be integrated via:
  1. React SDK (recommended for React apps)
  2. Direct API (for any platform)
Using React SDK:
Using Direct API: See Tail Format for API details.
Tail format displays recommendations as clickable links within conversational text:
Each link is tracked for clicks and conversions.
With React SDK:

API Integration

  1. Log in to your AdMesh Dashboard
  2. Go to SettingsAPI Keys
  3. Click Generate New Key
  4. Copy your API key (format: admesh_prod_xxx)
  5. Store securely (never commit to version control)
Include your API key in the Authorization header:
Or in your code:
The /recommend endpoint returns recommendations for a user query:
Response:
Tracking URLs are cryptographically signed URLs for tracking interactions:
  • exposure_pixel: Fire when recommendation is shown
  • click_url: Redirect when user clicks
All URLs include:
  • HMAC-SHA256 signature
  • TTL (time-to-live, default 300 seconds)
  • Nonce for idempotency
Conversions are tracked brand-side via localStorage and tracking pixels, not through pre-generated URLs.Never modify these URLs - they’re signed and will fail if altered.

Performance & Optimization

Minimum requirements:
  • API Response Time: < 500ms
  • Recommendation Latency: < 1 second
  • Pixel Firing: < 100ms
  • SDK Bundle Size: ~25KB gzipped
Recommended:
  • API Response Time: < 200ms
  • Recommendation Latency: < 500ms
  • Pixel Firing: < 50ms
Best practices:
  1. Cache Recommendations: Cache results for 5-10 minutes
  2. Lazy Load SDK: Load SDK only when needed
  3. Batch Requests: Combine multiple requests when possible
  4. Use CDN: Serve SDK from CDN for faster delivery
  5. Monitor Latency: Track API response times
Rate limits:
  • Free Tier: 100 requests/minute
  • Pro Tier: 1,000 requests/minute
  • Enterprise: Custom limits
If you exceed limits, you’ll receive a 429 (Too Many Requests) response.
Implement exponential backoff:

Contextual Relevance

Contextual relevance scoring measures how well a recommendation matches a user’s query. Scores range from 0-100:
  • 90-100: Highly relevant
  • 70-89: Relevant
  • 50-69: Somewhat relevant
  • < 50: Not relevant
Higher scores mean better recommendations.
Relevance is calculated using:
  1. Semantic Matching: Compare query embeddings with product embeddings
  2. Keyword Matching: Match query keywords with product keywords
  3. Category Matching: Match query intent with product categories
  4. User History: Consider user’s past interactions
For details, see Contextual Relevance Score.
To improve scores:
  1. Better Product Data: Provide detailed titles, descriptions, keywords
  2. Accurate Categories: Assign correct product categories
  3. Rich Metadata: Include price, brand, ratings, etc.
  4. Update Regularly: Keep product data current

Testing & Debugging

Testing steps:
  1. Test API Key: Verify API key is valid
  2. Test Endpoint: Call /recommend with test query
  3. Test Rendering: Verify recommendations display correctly
  4. Test Tracking: Verify pixels fire correctly
  5. Test Edge Cases: Test with no results, errors, etc.
Debugging tips:
  1. Check Console: Look for JavaScript errors
  2. Check Network: Verify API requests are successful
  3. Check Pixels: Verify tracking pixels are firing
  4. Check Logs: Review server logs for errors
  5. Enable Debug Mode: Add debug=true to API requests
Pre-launch checklist:
  • API key is valid and secure
  • Recommendations display correctly
  • Tracking pixels fire correctly
  • Error handling works
  • Performance meets requirements
  • Mobile responsiveness works
  • Accessibility is compliant
  • Security is verified
To report bugs:
  1. Email: mani@useadmesh.com
  2. Dashboard: Click HelpReport Bug
  3. GitHub: Open issue in AdMesh repository
Include:
  • Description of the issue
  • Steps to reproduce
  • Expected vs. actual behavior
  • Screenshots/logs if applicable

Common Issues

Check:
  1. API Key: Verify key is correct and not expired
  2. Authorization Header: Ensure header format is correct
  3. Endpoint URL: Verify you’re using correct endpoint
  4. Request Body: Validate JSON is properly formatted
  5. Network: Check internet connection
Troubleshoot:
  1. API Response: Verify API returns recommendations
  2. Rendering: Check if recommendations are being rendered
  3. Styling: Verify CSS isn’t hiding recommendations
  4. JavaScript: Check for JavaScript errors in console
  5. Permissions: Verify API key has correct permissions
Check:
  1. Pixel URL: Verify pixel URL is correct
  2. Network: Check if pixel request is being sent
  3. Ad Blockers: Disable ad blockers and test
  4. CORS: Verify CORS headers are correct
  5. Timing: Ensure pixel fires at correct time
Optimize:
  1. Cache Results: Cache recommendations for 5-10 minutes
  2. Lazy Load: Load SDK only when needed
  3. Compress: Enable gzip compression
  4. CDN: Use CDN for static assets
  5. Monitor: Track API response times

Additional Resources

React SDK

React SDK installation and setup

Weave Format

Weave format integration guide

Tail Format

Tail format integration guide