Widget Callback

Widget callback Listen for callbacks on your page from Gleam widget

The Gleam widget can send events which you can listen for on your page using the following JavaScript.

Callbacks can be turned on via the widget "Install Options" tab for accounts on our Business and Premium plans.

This is useful for:

  • Firing tracking or conversion scripts on your page
  • Adding a Coupon to the users cart
  • Updating content on the page
  • Unlocking something on the page based on which Action the user completes

Each entered event includes a unique ID for the action that has been completed:

<script>
  window.onGleamEvent = function(event) {
    console.log(event);
    /*
       Logs an object like this:

       {
         type: "entered",
         campaign: { key: "MqJxR", name: "My Newsletter Competition" },
         action: { id: 4242, title: "Sign up for our newsletter" }
       }

       OR

       {
         type: "loaded",
         campaign: { key: "MqJxR", name: "My Newsletter Competition" }
       }
     */
  };
</script>