HomeGuidesAPI ReferenceGraphQL
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Web modals and embeds

How to trigger custom scenarios for your web content using Optimizely Data Platform (ODP) Web SDK.

🚧

Web modals and embeds availability

Only customers onboarded prior to July 15, 2022 have access to the Campaigns and Web modals and embeds functionality. For more information, contact your customer success manager.

To manually display web content based on your own criteria, ODP provides an SDK method for your development team to utilize.

Web dialog boxes (modal)

You can trigger a dialog box in custom scenarios—such as when your customer adds an item to cart or logs in—by calling the dispatch() method.

zaius.dispatch(
'web', 
'showContent', {
  contentId: '<insert_content_id>', 
  target: {
    selector: '<insert css selector>', // empty string for modals 
    position: 'modal' // modal | before | after | inside | replace
  }
});

📘

Note

You must create and launch a campaign in ODP before this snippet will work. See The basics of campaign setup.

Web embeds

Web embeds are handled in the ODP application. See Manage web embeds.