Skip to main content
Banners are promotional or informational blocks that appear above your search results when a query matches a trigger term. If you call the Search API directly, your site is responsible for rendering them and tracking clicks on them. This guide covers both.

Prerequisites

  • A banner configured for your engine in MyCludo, with a test trigger term you can search for
  • A working Search API integration using SiteKey credentials

How banners work

Banners are configured in MyCludo, not in your code, and can also be managed through the banner endpoints. Each banner has trigger terms and a block of HTML. When a search matches a trigger term, the Search API returns that banner in the Banners array of the response. Your site only needs to take that HTML and place it on the page.
1

Search as usual

Your site sends the visitor’s query to the Search API, as it does today.
2

Read the Banners array

Read Banners from the same response. No extra request or parameter is needed.
3

Render the banner HTML

Insert each banner’s Banner value into a container above your results.
4

Track banner clicks

Send a click event when a visitor clicks a banner, so it is counted in your analytics. See Track banner clicks.
Banners are matched on the query, not on the results. A query can return zero documents and still return a banner.

Find banners in the response

Your existing search request does not change. The examples below use a test term as the query.
Response (trimmed):
The API reference example shows lowercase banner keys (id, name). The live response uses Id, Name and Banner. Read Banner for the HTML.
The Banner value is self-contained HTML with inline styles, so your site CSS does not need to change. This is a sample banner returned for a test term, not a recommended design:
See the Search API reference for all request and response fields.

Render banners on the page

Add a container where the banner should appear, above your results list, then pass it the response your search code already receives. The same approach works in any CMS or framework: put the container in the search results template and load your script through the CMS’s normal asset mechanism.
Each banner is wrapped in an element carrying its Id as data-banner-id. You need that ID to track clicks.
  • Clear it on each search. Setting innerHTML replaces the previous banner. If a new query returns no banners, the container empties, which is what you want.
  • Output as raw HTML. Use your framework’s raw HTML output (for example innerHTML, v-html or dangerouslySetInnerHTML). Escaping the value shows the markup as text, and some sanitizers strip inline styles and break the design.
Banner HTML is authored in MyCludo by your own team. Keep MyCludo access limited to people you trust.

Track banner clicks

A direct call to the Search endpoint does not record analytics, and banner clicks are not tracked automatically. If you skip this step, banner clicks will not appear in your reports. Send two kinds of event:
  • The search itself, with Track Search Query (querylog), so the search that triggered the banner is counted.
  • Each banner click, with Track Result Click (clicklog), using the banner-specific values below.
The tracking body uses flat key-value pairs. Do not wrap them in a values object. See the Analytics Guide for the full list of parameters, the Search-as-you-type rules and server-side IP forwarding.

Troubleshooting

For other API errors, see Troubleshooting.