Add a coupon to the clipboard after signup

Lisa Fockens Updated by Lisa Fockens

It is possible to add a coupon to the visitor's clipboard using our JS callbacks feature. In this article, we will show you how to automatically copy a coupon displayed on the "thank you" screen.

Step 1:

Create a signup block. In the "Button" section in the left-hand menu, select "Display a thank you message":

Step 2:

On your "thank you" screen, create a text block that contains the variable {{coupon}}. This variable will be automatically replaced by the actual coupon from a JS callback. It helps to have the coupon defined in only one place.

Step 3:

Create a new JS callback on the event Before popup display, with the following script:

window.wisepopsCoupon = 'WELCOME';
event.detail.wisepops('properties', {
coupon: window.wisepopsCoupon
});

Replace WELCOME  with your actual coupon code. This will be the unique place where your coupon is stored.

Step 4:

Create another JS callback on the event After form submit, with the following script:

var input = document.createElement('input');
input.value = window.wisepopsCoupon;
event.target.parentNode.appendChild(input);
input.select();
input.setSelectionRange(0, 99999);
document.execCommand("copy");
input.parentNode.removeChild(input);

Your coupon is now ready to be automatically added to the visitors' clipboards after signup.

Contact us via chat if you have any questions. We're here to help!

How did we do?

Create a Spin-the-Wheel Popup Without Collecting the User’s Email Address

Create a Micro-Commitment Popup

Contact