How to Automatically Submit Email Address for Known Users

Say a visitor comes to your website and submits their email to sign up for a newsletter. Now you want to show them a second lightbox, but you don’t want to ask for their email again. By adding custom JavaScript to your lightboxes, Digioh will automatically submit the email address for known users who convert on a subsequent lightbox. This reduces friction in the signup process, improving the user experience and potentially leading to more conversions.

To automatically pass the email address of known users, add the JavaScript snippet below to your Box JS:

Box JS Before Submit

if(x.email) DIGIOH_COOKIE.set('digioh_latest_email', x.email);
var digioh_latest_email = DIGIOH_COOKIE.get('digioh_latest_email');
if (digioh_latest_email && !x.email) {
   x.email = digioh_latest_email 
}
return x; //must return the form data object to submit
On all form submissions, Digioh will store the visitor’s email used to subscribe. For forms without an email field, such as an SMS opt-in form or CTAs for additional newsletters, Digioh will automatically submit the stored email.

Note: you may need to coordinate the box rules to “know” that the user has already submitted. Create boxes with the rule Cookie Exists digioh_latest_email, and these boxes will not need an email form field.

If you need help setting your custom JavaScript up, just send us an email, and we can assist you.

Related Reading: