Intentara / Docs
Dashboard

Getting Started

Integrate context-aware ads into your AI assistant in under 5 minutes.

Prerequisites You need an Intentara publisher key to get started. Keys starting with pub_ are public integration keys for your app or website. Contact us at hello@intentara.com to request access.

Quick Start with Auto-Fill

The fastest way to integrate Intentara — add the script, mark your ad slots, and let the SDK do the rest.

1

Add the script tag

Include the Intentara SDK in your HTML page:

html
<script src="__BASE_URL__/sdk/intentara.js"></script>
2

Initialize with your API key

This also creates an anonymous session for analytics — no cookies or localStorage involved.

javascript
intentara.init({ apiKey: 'pub_XXXX' });
3

Add ad slots to your HTML

Place slots wherever you want ads to appear. Optionally set a template per slot:

html
<!-- Card template (default) -->
<div data-intentara-slot></div>

<!-- Compact inline text link -->
<div data-intentara-slot data-intentara-template="native"></div>
4

Fetch and render with one call

process() finds all slots, fetches one ad, and renders it everywhere — one API call total. Trigger it as soon as the user sends a new message, using the existing chat history plus the current user input.

javascript
const context = [...chatHistory, currentUserInput].join('\n');

intentara.process({
  context,
  onFill: (ad) => console.log('Ad rendered:', ad.name),
  onNoFill: () => console.log('No matching ad found'),
});

That's it! Ads render inside Shadow DOM — fully isolated from your page styles. Customize them with CSS variables on the slot elements.


Manual Integration

For full control, use getAd() and render() separately. Request the ad when the user submits a message so you do not need to wait for the LLM response.

javascript
const context = [...chatHistory, currentUserInput].join('\n');
const ad = await intentara.getAd({ context });

if (ad) {
  intentara.render(ad, document.querySelector('#my-ad-slot'), {
    template: 'card',     // 'card' or 'native'
    position: 'inline',   // 'inline', 'suffix', or 'prefix'
  });
}

Quick Start with the API

Prefer to call the API directly? Here's how to get a contextual ad using a simple HTTPS request.

For production use, call the HTTPS platform origin: https://platform.intentara.com.

Using cURL

bash
curl -X POST https://platform.intentara.com/api/v1/public/creatives/by-context \
  -H "Content-Type: application/json" \
  -H "x-api-key: pub_XXXX" \
  -H "x-session-id: your-session-id" \
  -d '{"context": "I need a good pair of running shoes for a marathon"}'

Using fetch (JavaScript)

javascript
const response = await fetch(
  'https://platform.intentara.com/api/v1/public/creatives/by-context',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': 'pub_XXXX',
      'x-session-id': 'your-session-id',  // optional, for session analytics
    },
    body: JSON.stringify({
      context: 'I need a good pair of running shoes for a marathon',
    }),
  }
);

const ad = await response.json();
console.log(ad);

Response Structure

A successful response returns a single ad creative:

json
{
  "id": "abc123",
  "name": "Marathon Pro Shoes",
  "text": "Train harder, run faster — Marathon Pro X1 now available.",
  "imageUrl": "__BASE_URL__/api/v1/public/creatives/images/shoe.jpg",
  "impressionUrl": "__BASE_URL__/api/v1/public/creatives/beacon?requestId=req_xyz",
  "targetUrl": "__BASE_URL__/api/v1/public/creatives/target/abc123?requestId=req_xyz" 
}

Key fields:


Next Steps