Custom events

Smartlook automatically tracks a number of events. If there are events that you want to track that aren't being tracked automatically, you can create custom events.

Custom events capture events that are not automatically tracked, or track events that happen behind the scenes so you can view them in your sessions. Once you have created custom events, you can also use them as filters.

To create custom events, see Creating events.

Implementing the API

To implement the Identify API, you need to insert the following code into your project:

<script>
  smartlook('track', eventName, properties);
</script>

There is a slight delay between calling the API and sending custom events to Smartlook servers. Therefore, Smartlook doesn't recommend calling the API right before page unload or a page navigation event.

Interacting with pop-up windows

An example of a custom event is triggering an event when your users sees certain pop-up windows. These could be promotion alerts or upsell windows. You can then view the sessions and see how your users interact with these pop-ups.

To interact with pop-up windows:

<script>
  // full example with your defined variables
  var eventName = 'UserOpenUpsellWindow';
  var properties = {
    "type": "SmallDiscLimit"
  };
  smartlook('track', eventName, properties);
</script>

The properties parameter is a variable. In this example, you only need to display specific information about your user, so there's no need to use other parameters in your custom event.

For more information on custom events, see Event tracking and custom events.