POST/api/public/banner-events

Banner events

Send impression, click, or custom metric events. No authentication required. Use for analytics and A/B reporting in the dashboard.

Request

POST with Content-Type: application/json.

FieldRequiredDescription
bannerIdYesBanner UUID from the dashboard
eventYesOne of: impression, click, custom
campaignIdNoCampaign ID (e.g. bnrflx-xxxxxxxx). Attributes the event to that campaign for filtered analytics.
metricIdWhen event is customCustom metric UUID from the dashboard. Required for event: "custom". Use bnrflx-cta to record a CTA click (stored as click).

Response

JSON:

{ "ok": true }

400 for invalid body or missing required fields. 404 if banner not found or (for custom) metric not found or not linked to the banner.

Event types

  • impression — Banner was shown. Send once when the banner is displayed.
  • click — Primary CTA or link was clicked. Send when the user clicks the main action.
  • custom — Custom metric (e.g. "Newsletter signup"). Requires metricId from the dashboard. Create custom metrics in the banner settings to track additional actions.

Examples

Impression (when banner is shown):

await fetch('https://www.bannerflex.app/api/public/banner-events', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    bannerId: 'your-banner-uuid',
    event: 'impression',
    campaignId: 'bnrflx-your-campaign-id',
  }),
});

CTA click:

await fetch('https://www.bannerflex.app/api/public/banner-events', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    bannerId: 'your-banner-uuid',
    event: 'click',
    campaignId: 'bnrflx-your-campaign-id',
  }),
});

Custom metric:

await fetch('https://www.bannerflex.app/api/public/banner-events', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    bannerId: 'your-banner-uuid',
    event: 'custom',
    metricId: 'your-metric-uuid-from-dashboard',
    campaignId: 'bnrflx-your-campaign-id',
  }),
});