Quick Start
Get started with AdMesh in 3 simple steps:1
Install the Package
2
Wrap Your App with AdMeshProvider
3
Choose Your Integration Format
Select the format that matches your use case:Citation & Product Format - Separate recommendations panelWeave Ad Format - Embedded links in LLM responses
Core Concepts
Session Management
AdMesh uses sessions to track user interactions across multiple messages:- Session ID: Unique identifier for a user’s conversation session
- Message ID: Unique identifier for each individual message/query
Your application is responsible for generating and managing session and message IDs. The SDK accepts these IDs but does not generate them.
Available Formats
AdMesh supports three recommendation formats:| Format | Use Case | Component |
|---|---|---|
| Citation | Inline citations with product links | AdMeshRecommendations |
| Product | Product cards with details | AdMeshRecommendations |
| Weave | Embedded links in LLM responses | WeaveAdFormatContainer |
Core Components
AdMeshProvider
Context provider that initializes the SDK and manages session state. Required - wrap your entire app with this component.AdMeshRecommendations
Displays recommendations in a separate panel. Use for Citation or Product format.Citation & Product Format Guide
Complete integration guide for Citation & Product Format
WeaveAdFormatContainer
Wraps LLM response content and detects embedded AdMesh links. Use for Weave Ad Format.Weave Ad Format Guide
Complete integration guide for Weave Ad Format with event-driven architecture
Streaming Event Utilities
For Weave Ad Format only - dispatch events to coordinate link detection with streaming responses.These utilities are only needed for Weave Ad Format. See the Weave Ad Format guide for complete integration details.
Installation Methods
npm (recommended)
npm (recommended)
Yarn
Yarn
pnpm
pnpm
Requirements
React 16.8+
Requires React with Hooks support
API Key
Get your API key from the AdMesh dashboard
TypeScript
Full TypeScript support included
Modern Browser
Supports all modern browsers (Chrome, Firefox, Safari, Edge)
TypeScript Support
The SDK is written in TypeScript and includes full type definitions:Troubleshooting
Recommendations not showing
Recommendations not showing
Check:
- API key is valid and provided to
AdMeshProvider sessionIdis provided toAdMeshProvider- Component is wrapped inside
AdMeshProvider - Messages array is not empty (for
AdMeshRecommendations) - Network requests are not blocked by CORS or ad blockers
TypeScript errors
TypeScript errors
Solution:
- Ensure you’re using TypeScript 4.0 or higher
- Import types explicitly:
import type { Message } from 'admesh-ui-sdk' - Check that your
tsconfig.jsonincludes"moduleResolution": "node"
Weave Ad Format not detecting links
Weave Ad Format not detecting links
Check:
- You’re dispatching
streamingStartandstreamingCompleteevents - Events use the assistant message ID (from backend), not user message ID
- Links are in the correct format (AdMesh tracking URLs)
- See the Weave Ad Format troubleshooting guide
Tracking not working
Tracking not working
Note: Tracking is fully automatic. Do NOT:
- Manually fire tracking pixels
- Modify tracking URLs
- Implement custom tracking logic
Styling & Customization
The AdMesh UI SDK includes a simple, framework-agnostic styling system that ensures your components look clean and consistent—no matter where they’re embedded (Next.js, React, Vite, or custom platforms).Key Features
Style Isolation
Prevents CSS conflicts with host frameworks like Tailwind or Bootstrap.
Consistent Look
Same visual quality across all environments.
Custom Themes
Easily adjust colors, borders, and typography.
Light & Dark Modes
Built-in theme switching with simple configuration.
Default Styling
By default, the SDK injects its own scoped styles automatically. No CSS import is needed.Custom Theming
You can customize the appearance by passing a theme to theAdMeshProvider:
Theme Options
| Property | Type | Default | Description |
|---|---|---|---|
mode | 'light' | 'dark' | 'light' | Color scheme mode |
primaryColor | string | '#3b82f6' | Primary brand color |
accentColor | string | '#8b5cf6' | Accent color for highlights |
backgroundColor | string | '#ffffff' | Background color |
textColor | string | '#1f2937' | Primary text color |
borderRadius | string | '0.5rem' | Border radius for components |
fontFamily | string | 'system-ui' | Font family |
shadowMd | string | '0 4px 12px rgba(0,0,0,0.08)' | Medium shadow |
CSS Variables
You can also override AdMesh styling with standard CSS variables:Example Themes
Dark Theme
Dark Theme
Brand Theme
Brand Theme
Minimal Theme
Minimal Theme
Framework Integration
Next.js + Tailwind
AdMesh styles are isolated from Tailwind classes, so you can safely use both:React + Bootstrap
Styling Best Practices
✅ DO:- Use the
themeprop onAdMeshProviderfor global styling - Leverage CSS variables for fine-grained control
- Test your theme in both light and dark modes
- Keep styles consistent with your brand
- Directly modify AdMesh component classes (they may change)
- Override internal styles with
!important(use theme API instead) - Mix multiple theming approaches (choose one method)
Next Steps
Choose your integration format and follow the detailed guide:Citation & Product Format
Display recommendations in a separate panelBest for: Separate recommendations UI, simple integrationSetup time: 5-10 minutes
Weave Ad Format
Embed recommendations directly in LLM responsesBest for: Natural integration, conversational adsSetup time: 15-20 minutes