Prefilling User Details

Sometimes you may want to prefill user details within the Gleam widget to prevent users from having to enter details twice. This may be if a user is already logged into your website, or if you're redirecting users to a Gleam widget after completing another form first.

Applications that support Prefilling:

Javascript API

The first way you can prefill data is by including some extra Javascript on your page. This should be included after your embed code.

        var Gleam = Gleam || [];
        Gleam.push(['name', 'John Doe']);
        Gleam.push(['email', '']);

The main things you can pass are:

  • Name
  • Email
  • DOB

It will also match up with any additional Custom Fields that you have setup.

URL Parameters

The second way you can prefill is to pass parameters to the URL. This will only work if you send users to the Gleam Hosted Landing Page or use the iFrame embed option.

You must also encode the parameters & parameter names.


You can see how this would work sending users to our demo competition with Prefilling active:

Again this method supports:

URL Parameters on Embedded Campaigns

This additional script will allow you grab parameters from your URL and pass it to Prefill the Gleam embedded widget.

(function() {
  var paramEmail =[?&]email=([^?&]+)/);
  var paramName =[?&]name=([^?&]+)/);
  window.Gleam = window.Gleam || [];
  if (paramEmail) {
    Gleam.push(['email', decodeURI(paramEmail[1])]);
  if (paramName) {
    Gleam.push(['name', decodeURI(paramName[1])]);