Embed

API Reference

Complete reference for the Activoice embed configuration, for campaigns and petitions

Activoice.init(config)

Initializes one embed instance inside the target container.

If the container already contains an active embed (for example after a client-side navigation), it is destroyed and replaced with a fresh instance.

window.Activoice.init(config: ActivoiceEmbedConfig): void

ActivoiceEmbedConfig

The root configuration object passed to Activoice.init().

PropertyTypeRequiredDescription
containerstring✓CSS selector of the host element (e.g. '#av-embed-container'). Must match exactly one element in the DOM at the time init() is called.
campaignIdstring✓*Slug or identifier of the campaign to embed. Visible in your Activoice admin, in the campaign URL and in the campaign's Share step, Embed tab.
petitionIdstring✓*Slug or identifier of the petition to embed, found in the same place for a petition.
embedOptionsEmbedOptions—Optional display and behavior settings.
campaignOverridesCampaignOverrides—Optional overrides applied on top of the campaign configuration defined in your Activoice admin.

* Exactly one of campaignId and petitionId. Both, or neither, is an error reported in the browser console, and nothing is mounted.


EmbedOptions

All fields are optional. Omitting a field uses the default value.

PropertyTypeDefaultDescription
spinnerColorstring'#fed13a'CSS color of the loading spinner shown before the campaign is ready. Accepts any valid CSS color value (hex, rgb(), named colors, etc.).
initialPage'steps' | 'landing' | 'form' | 'full''steps' for a campaign, 'form' for a petitionControls which page is shown first. For a campaign, 'steps' opens directly on the action flow and 'landing' shows the landing page. For a petition, 'form' shows the counter and signature form alone and 'full' the whole petition page. A value meant for the other kind is ignored with a warning and the default applies.
displayMode'fixedHeight' | 'inline''fixedHeight''fixedHeight' uses internal scrolling and the height option. 'inline' continuously adjusts the iframe to its content and ignores height. Unknown modes, including the removed 'fullHeight', fall back to 'fixedHeight' with 'auto' height.
height'auto' | '100%' | '${number}px''auto'Applies only to 'fixedHeight'. 'auto' freezes the first screen's natural height at a minimum of 600 px. '100%' fills a container with a definite height. A positive pixel value (e.g. '700px') sets an exact height without sizing the container. Explicit heights have no 600 px minimum; unsupported height values use 'auto'.
withToolbarbooleanfalseRenders the public toolbar inside the embed where available (back button, step indicator and My information profile button). Disabled by default for a seamless embedded look.
withBackgroundbooleanfalsePaints the campaign's background color, or the color_background override, on the iframe body. When disabled, the background is transparent so the host page shows through. Text and UI elements automatically switch to a light color when the background color is dark.
withPaddingbooleanfalseAdds horizontal padding to the campaign content area.
bypassStateCheckbooleanfalseWhen true, a campaign or petition renders even if it is a draft, and a campaign even when ended. Intended for preview and testing purposes only — do not enable in production.
bypassCampaignStateCheckbooleanfalseDeprecated: former name of bypassStateCheck, still accepted with the same effect.
scrollIntoViewbooleantrueWhen a petition embed opens its follow-up campaign, scrolls the host page so the top of the container is visible. false disables the scroll. No effect on a campaign embed.

CampaignOverrides

Overrides applied on top of the campaign configuration defined in your Activoice admin.

interface CampaignOverrides {
  recipients?: Recipient[]        // Global recipient override for all interpellations
  interpellations?: Array<{
    id: string                    // UUID of the interpellation to override
    recipients?: Recipient[]      // Per-interpellation override (takes priority)
  }>
  color_background?: string       // #rrggbb, surface the embed sits on
  color_main?: string             // #rrggbb, brand color
  color_buttons?: string          // #rrggbb, call-to-action buttons
  custom_css?: string             // Replaces the organization's custom CSS, '' removes it
}

Every override applies to the pages shown in the frame. In a petition embed, the design fields style the petition and its follow-up campaign, and recipients and interpellations apply to the follow-up campaign once it opens.

Recipient resolution order

Recipients are resolved per interpellation with the following priority:

  1. Per-interpellation override — interpellations[].recipients if provided for that entry
  2. Root-level override — top-level recipients applied to all interpellations that don't have their own override
  3. Admin configuration — original recipients preserved when no override applies
When interpellations is provided, only the listed interpellations are shown — any interpellation whose id is not included is hidden from the embed. Omit interpellations entirely to keep all interpellations visible.
The root-level recipients is a convenient shortcut when you want to set the same recipients across all interpellations without repeating them in each entry.

Design fields

Each design field replaces the campaign page's value from your Activoice admin (the campaign's own design when it has one, the organization's otherwise); an omitted field keeps it.

FieldTypeDescription
color_backgroundstring#rrggbb color of the surface the embed sits on. Drives the text color and derived surfaces; painted on the body only with embedOptions.withBackground.
color_mainstring#rrggbb brand color: landing gradient, toolbar, links, focus states.
color_buttonsstring#rrggbb color of the call-to-action buttons; the label color is picked for contrast.
custom_cssstringReplaces the campaign page's custom CSS; '' removes it. Written from the custom CSS template, see the Integration Guide. Checked before it is applied: no external URL, Google Fonts @import only, 50 000 characters at most.

A color that is not #rrggbb, null included, or a custom_css that is not a string is ignored with a warning in the browser console and the campaign page's value stays. A CSS that fails a check is dropped entirely, with a warning too.

Recipient

All fields are optional.

FieldTypeDescription
first_namestringFirst name of the recipient.
last_namestringLast name of the recipient.
gender'M' | 'F' | 'O'Gender: M (male), F (female), O (other / not specified). Used to personalize AI-generated messages.
display_titlestringTitle or role displayed to the user (e.g. 'Mayor of Lyon').
photo_urlstring | nullAbsolute URL of the recipient's photo.
emailstring | nullEmail address (used for email interpellation modes).
phone_numberstring | nullPhone number (used for call interpellation modes).
personal_linkstring | nullAbsolute URL to the recipient's personal or professional website.
facebook_pagestringAbsolute URL of the recipient's Facebook page.
twitter_handlestringTwitter/X handle, without the @ prefix.
instagram_handlestringInstagram handle, without the @ prefix.
linkedin_pagestringAbsolute URL of the recipient's LinkedIn profile.
tiktok_handlestringTikTok handle, without the @ prefix.
geo_typestring | nullType of geographic area (e.g. 'municipality', 'department'). Used for geospatial targeting when supporters search by location.
geo_idstring | nullIdentifier of the geographic area, matching the geo_type taxonomy.
party_namestring | nullFull name of the political party.
party_short_namestring | nullAbbreviated party name displayed in the UI.
custom_fieldsRecord<string, string>Arbitrary key-value pairs injected as extra variables into AI-generated message templates.

Events

Every analytics event the campaign or petition records is also posted to the host window as an ACTIVOICE_EVENT message, through postMessage, at the moment it happens. Listen for it to follow where visitors go and where they stop.

{
  "type": "ACTIVOICE_EVENT",
  "payload": {
    "event": "submit_questions",
    "campaignId": "a4e2b000-1234-4567-89ab-0123456789ab",
    "petitionId": null,
    "interpellationId": "7c1f3d2a-5b6e-4f8a-9c0d-1e2f3a4b5c6d",
    "sessionId": "3b9e8d7c-6f5a-4e3d-8c2b-1a0f9e8d7c6b",
    "medium": "email",
    "newsletterChoice": "subscribed",
    "customizationSkipped": false
  }
}
PropertyTypeDescription
eventstringName of the event, see the table below.
campaignIdstring | nullUUID of the campaign the event happened on, even if you initialized the embed with a slug or a petition; null on a petition.
petitionIdstring | nullUUID of the petition the event happened on; null on a campaign.
interpellationIdstring | nullUUID of the recipient group the event concerns, null before one is selected.
sessionIdstringIdentifier of the visitor's session, the same on every event of one journey, across the petition and its follow-up campaign. It rotates after thirty minutes of inactivity, or after a day.
mediumstring | nullChannel the event concerns, once the visitor has chosen one: email, twitter, facebook, instagram, linkedin, tiktok, form, review, or call.

Every other property of an event is listed below. The order depends on the campaign: a geolocated campaign selects the recipient before its group, a single-channel campaign selects the channel automatically. The list grows with the product: ignore the events and properties you do not know.

eventOther propertiesWhen
session_starthasUserInfo, hasUserEmail, utmSource, utmMedium, utmCampaign...The visitor's session on the campaign or petition opens, or rotates after inactivity.
follow_referralreferrerCodeThe visitor arrived through a link another visitor shared. referrerCode designates who shared it.
select_interpellationautomaticA recipient group is selected.
search_addressrecipientsFound (number), exactMatch (boolean)A geolocated campaign searched the recipients of an address.
select_recipientautomatic, recipientKind (geolocation, list or business)A recipient, or the business to review or call, is selected.
select_mediumautomaticA channel is selected.
submit_questionscustomizationSkipped (boolean), newsletterChoiceThe questions step is left, by either of its buttons.
generate_messageA message is generated.
send_messageThe visitor opens the mail client, X composer, Facebook, Instagram, LinkedIn, TikTok, an external link/form, or Google Maps for a review, or reports the call done. Opening a channel does not verify that the message was sent; confirm_sent records the visitor's confirmation.
confirm_sentThe visitor confirms they completed the action, including a call. Sent before navigating to the success page.
share_campaignshareTypeThe visitor shares the campaign.
sign_petitionThe visitor signs the petition.
share_petitionshareType, sharedPageIdThe visitor shares a petition. On a campaign's success page, the event is the campaign's and sharedPageId names the petition.
show_donation_askThe donation ask is shown on the success page.
start_donationamount (minor units), frequency (one_time or monthly)The visitor chose an amount and opened the payment form.
complete_donationamount, frequencyThe payment completed in the page. A payment that left the page for a bank authentication is not reported, though the donation counts.
decline_donationThe visitor continued without donating.

automatic is true when the campaign made the selection on the visitor's behalf: a single recipient group, a single channel, a channel preset by the page. A selection is only reported when its value changes.

submit_questions is posted by the Generate button only when the form is valid, and by Do not use customization always, since that button validates nothing. newsletterChoice is the answer to the "keep me informed" checkbox:

newsletterChoiceMeaningAs a boolean
subscribedThe box was checked, with a first name, last name and valid email.true
declinedThe box was pre-checked and the visitor unchecked it.false
not_subscribedThe box was shown unchecked and left so.false
already_subscribedThe box was hidden because the visitor had already consented.null
nullThe question was not asked (no CRM on the campaign), or the box was checked without a usable identity.null

The value records the choice submitted in the questions step, not a confirmed subscription: it is reported whether or not the CRM synchronization succeeds. A consent remembered from a previous campaign, petition, action, accepted CRM subscriber identity, or the My information dialog hides the box and reports already_subscribed; entering a different email address shows the box again.

confirm_sent records the visitor's confirmation, not verified delivery to the recipient. Reporting an issue, or answering that the action was not completed, does not post it. Loading the success page directly does not post it either.

Check both the source iframe and its origin before using a message. Register your listener before calling Activoice.init():

window.addEventListener('message', (event) => {
  const iframe = document.querySelector('#av-embed-container iframe')
  if (
    iframe &&
    event.source === iframe.contentWindow &&
    event.origin === new URL(iframe.src).origin &&
    event.data?.type === 'ACTIVOICE_EVENT'
  ) {
    const { event: name, campaignId, petitionId, sessionId, medium } =
      event.data.payload
    // Forward these values to your analytics integration.
    console.log({ name, campaignId, petitionId, sessionId, medium })
  }
})

TypeScript types

Download the type definitions file and reference it in your project for full IDE autocompletion: activoice-embed.d.ts

This file is not versioned or distributed automatically. As the API evolves, you will need to re-download it and update your local copy manually.

Then point your tsconfig.json to it:

tsconfig.json
{
  "include": ["./activoice-embed.d.ts", "src/**/*"]
}
Copyright © 2026