Getting Started with OptiPub Elements
Easily access data from OptiPub on your website
OptiPub allows for you to use custom elements on your websites to bring additional functionality with minimal configuration and coding.
When you host your website through OptiPub, we automatically add the JavaScript required on every page to work with these elements.
All of our elements use CSS classes found in Bootstrap 4, but we don't host or inject the CSS in order to avoid collisions with your existing layouts. Check out the Bootstrap 4 Introduction page to install it on your page.
Can't use Bootstrap?We don't force you to use Bootstrap, but changing all of the HTML classes takes additional configuration. For more information, check out our guides on overwriting each of the optipub-element templates.
Using OptiPub Elements Externally
You are able to use any of the OptiPub Elements on any website that has had its domain added and verified. See the Create Domain documentation for more specifics on how to do this.
After your domain has been configured in OptiPub, all you need to do is add the following script element on your page in the <body> element.
<script async src="https://your-optipub-instance.com/elements/js/elements.js" charset="utf-8"></script>optipub-post-conversion
optipub-post-conversionShows the survey and offer wall dialogs configured on a campaign funnel after a conversion.
The subscribe element mounts this automatically after a successful signup. Order receipts mount it too: before each upsell for the steps leading into it, and after checkout or the last upsell in a branch for any steps that follow with no further offer. You can mount it yourself when you already have an effort-id:
<optipub-post-conversion effort-id="2003" position="after"></optipub-post-conversion>| Property | Description |
|---|---|
effort-id | The effort that just converted. Used to find the campaign graph cell. |
publication-id | Fallback when no effort is available; uses the publication's default campaign. |
position | after (default) walks forward from the converted offer; before walks backward (receipt / upsell). |
port | With position="after", the branch taken out of the converted offer: true (accepted, default) or false (declined). |
identifier | Optional subscriber email MD5 from a checkout receipt. Surveys only show when a subscriber is known. Only honored together with order-id; otherwise the OptiPub tracking cookie is used. |
order-id | The receipt's order (transaction) id. It must be a purchase by that subscriber in the effort's campaign within the last 2 hours. |
When the dialog closes, or there is nothing to show, the element emits a post-conversion-done event you can listen for from the host page:
<script>
window.optipubElements.on('post-conversion-done', function (payload) {
// payload: { effortId, position, port }
});
</script>Add disable-post-conversion on optipub-subscribe if the host page should skip the automatic dialog.
Updated 6 days ago

