Skip to main content
Official SDK for integrating chatbot ads into your React application.
Quick Integration: Get started in minutes with just a few lines of code. The SDK handles ad fetching, tracking, and display automatically.

Installation

1

Install the package

npm install @kovio/chatbot-ad
2

Import and use

import { ChatbotAd } from '@kovio/chatbot-ad'

<ChatbotAd
  publisherId="your-publisher-id"
  keyword="technology,ai"
  theme="dark"
  format="standard"
/>
That’s it! The SDK handles everything automatically: fetching relevant ads, tracking impressions & clicks, displaying ads beautifully, and supporting light & dark themes.

API Reference

ChatbotAd Component

publisherId
string
required
Your unique publisher ID from the Kovio dashboard.
keyword
string
required
Comma-separated keywords to match ads. The SDK will find the most relevant ad based on these keywords.Examples:
<ChatbotAd keyword="technology,ai" />
<ChatbotAd keyword="finance,startup,business" />
theme
'light' | 'dark'
default:"'dark'"
Display theme for the ad. Choose between light and dark themes to match your application’s design.
format
'standard' | 'small'
default:"'standard'"
Ad format type. Choose the format that best fits your layout.
<ChatbotAd format="standard" />  // Full ad
<ChatbotAd format="small" />     // Compact ad

Examples

import { ChatbotAd } from '@kovio/chatbot-ad'

function MyChatbot() {
  return (
    <div>
      <ChatbotAd
        publisherId="your-publisher-id"
        keyword="technology,ai"
        theme="dark"
        format="standard"
      />
    </div>
  )
}

Features

Ad Formats

The standard format includes:
  • Image (if available)
  • Title
  • Message/description
  • “Learn more” button
Best for prominent ad placements in your chatbot interface.
<ChatbotAd format="standard" />

Themes

Dark background with light text. Perfect for dark mode interfaces.
<ChatbotAd theme="dark" />

TypeScript Support

The SDK includes full TypeScript definitions:
import { ChatbotAd } from '@kovio/chatbot-ad'

// All props are fully typed
<ChatbotAd
  publisherId="string"      // required
  keyword="string"            // required
  theme?: "light" | "dark"   // optional
  format?: "standard" | "small" // optional
/>
TypeScript definitions are included automatically with the package. No additional @types package needed.

Advanced Usage

Custom Hooks

For advanced use cases, you can use the underlying hooks:

React Native

The SDK also works with React Native:

Error Handling

The SDK handles errors gracefully. If no ad is available, the component renders nothing. Network errors are logged to the console, and invalid props are validated with helpful error messages.

Best Practices

Match keywords to the conversation context. Use specific terms that relate to what the user is discussing.
Use standard for prominent placements, small for inline content. Consider your layout and user experience.
Use light or dark to match your app’s design. This ensures ads feel native to your application.
Change keywords based on user conversation context. This improves ad relevance and click-through rates.

Troubleshooting

  1. Check publisher ID - Verify your publisher ID is correct
  2. Check keywords - Ensure keywords are relevant and properly formatted
  3. Check console - Look for error messages in the browser console
  4. Verify network - Ensure your app can reach the Kovio API
Make sure you have TypeScript installed and the SDK types are being recognized. The SDK includes type definitions automatically.
  • Check that all required props are provided
  • Verify the component is imported correctly
  • Ensure React is properly installed and configured

Support

For more information, visit the main documentation or contact support.