Embedded Segment Management Links
This guide will walk you through embedding Census segment management into your own application.
These features are only available for Census Embedded customers. If you don’t see these options, please reach out to Customer Support.
Census offers drop-in UI components to help you build and maintain Census segments on behalf of your customers. Allow your customers to create and manage their segments directly in your application, with almost no developer effort needed.
An embedded component is an iframe
embedded in your application, pointing to a Census segment management link. To see a working example, check out our Embedded Demo application (source code).
This component allows end users to create and manage their Census segments from your application.
Initial Setup
The origin URL is the domain of the application you embed
the iframe
in. For instance, https://my-site.com
. Only approved URLs
are allowed to embed these components. Before you get started, you’ll
need to provide your Census account manager with your URL(s), or reach
out to us at support@getcensus.com.
Generate a Segment Management Link
You can create Segment Management Links via the Segment Management Link API.
Embed the Segment Management Link in an iframe
Note the use of a permissions policy that allows the iframe to read and write to clipboard. We recommend adding this so that the Census application can write content to your users’ clipboards.
Handle events from the iframe
The iframe
emits events using the postMessage API.
The following events are available to help you manage the iframe
lifecycle, via the data
property of the message:
Loaded
This event indicates the iframe
is ready to be shown to the user.
Exited
This event indicates the user has quit the segment management flow. If a segment was succesfully created or updated, the following payload will be returned:
otherwise the payload will indicate a segment was not created:
Was this page helpful?