With our HTML blocks you can embed custom forms and buttons in your popups. When visitors interact with it, you want WisePops to consider the popup as converted. So the conditions such as "Stop showing after the visitor has signed up" will work properly. You can let WisePops know that a popup should be flagged as clicked with the help of our JS callbacks.

Retrieve the popup object with Before popup display event

First, you need to retrieve the object that will let you manipulate the popup later. This is done by creating a callback that listen for Before popup display.

The popup object is available through event.detail.popup. The method that you will want to call is event.detail.popup.trackClick().

Call the trackClick() method at the right time

Now that you have access to the method, you need to call it when the click action occurs. There are various ways to do so. Lets assume that we want to track the click when the following button in a HTML block is clicked:

<button class="my-custom-button" type="button">Click here</button>

In the same JS callback created previously, we can rely on a native click listener to perform the action we want.

var button = event.target.querySelector('.my-custom-button');
button.addEventListener('click', function () {
event.detail.popup.trackClick();
});

We now that event.target is our popup container for the event Before popup display.

Please let us know if you have any question.

Did this answer your question?