For advanced use cases, Pop Convert has made a few Javascript callback functions available to you. You can use these functions to trigger additional events, for example tracking popup click events with Google Analytics.

<aside> 🚨 It’s best to put custom functions inside of the Custom Javascript Field inside of your campaign. If you do not have the Custom Javascript Field visible yet, reach out to us on Live Chat so that we can enable it for you.

</aside>

FUNCTIONS EXAMPLE
onShow window.PopConvert.onShow(({ data }) => { data.campaign })
onClick window.PopConvert.onClick(({ data }) => { data.campaign })
onClose window.PopConvert.onClose(({ data }) => { data.campaign })
onSubmit ( sub ) window.PopConvert.onSubmit(({ data }) => {
data.type == 'subscriber' // true
data.campaign
data.form
})
onSubmit ( redirect ) window.PopConvert.onSubmit(({ data }) => {
data.type == 'redirect' // true
data.campaign
data.url
})

For more information please reach out to us via Live Chat.

Examples


Click Popup or Smart Bar to open URL

NOTE: This code is no longer necessary. You can add a URL directly to the image block (see here)

// Change to whatever URL you want
var url = '<https://www.google.com>';

window.PopConvert.onClick(({ data }) => {
  window.location.href = url;

  // Or if you want to open the URL in a new tab:
  // window.open(url, '_blank');
});

Remove the white space under the smart bar

Before:

Group 1319 (1).png

After: