While integrating with Duda you may want to upsell more features to your customers, such as publishing the website. Duda supports two scenarios for when you want to offer an upsell option to users:
- Customer is trying to publish a website for the first time.
- Customer is trying to use a feature that is locked.
During these scenarios, it is important to make sure that the customer has a smooth and uninterrupted experience while upgrading. Duda offers two methods for doing this:
- Open Lightbox/Iframe
- Redirect users to an external URL
For both options, Duda will append URL parameters that give you additional context about who the user is and what information to pass along.
Under White Label, select API Access and click Customize publish flow, then choose the option most appropriate for your workflow.
This option will allow you to open a dedicated upgrade page over the website builder that looks like the following:
<script async src="https://my.duda.co/_dm/s/common/scripts/publishOverlayAPI.js"></script>
If using the Redirect without publishing or iframe without publishing options, a site will need to be published via the API.
Additionally, you can call this function to tell Duda to refresh the editor. This will update the user with the current status of the website.
If you upgrade the site plan or permissions via the API while the user is interacting with the upgrade page, you need to call the upgradeDone() function call to grant the user access to the newest features you've enabled.
To close the overlay, you can call the publishOverlayAPI.closeOverlay() function to close the iframe and let the user continue to edit/build their website.
Instead of using an iframe, you can redirect users to an external URL that you host.
There are two options for redirecting to an outside URL:
- Publish and redirect: When this option is selected, the website publish process will continue and the user will be redirected to your external upgrade flow.
- Redirect without publishing (most common): Redirect the user to complete the upgrade/registration and do not publish the website. This will require you to offer the option to publish the website (via the API) for your customers.
Updated 4 months ago