Custom events are a powerful and advanced feature in Smartlook. They'll give you the ability to track events that happen behind the scene and have them appear directly in the Smartlook recordings. You can then use custom events as filters, just like all the other events which are automatically recorded on Smartlook. With custom events, you can get creative and track pretty much everything you want to.

Smartlook settings

For you to be able to send custom events to Smartlook, you need to enable the API in the project settings. Select the project and toggle on the "Identify users via API" button. Please note that there's a separate setting for custom events triggered by visitors from within the EU, California, and Brazil, as additional laws, when it comes to personal information apply to those locations, so if you would like to receive custom events from all the visitors, toggle both of these settings.

Implementation

The code you need to insert into your website has the following format in JavaScript.

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

Please note that there is a slight delay between calling the API and sending any custom event to our servers, therefore it is not recommended calling the API right before page unload or a page navigation event.

Interact with pop-up windows

You can configure an event that will be triggered when your user sees certain pop-up windows, such as promotion alerts or upsell windows. Watch recordings to understand how your users are interacting with those pop-ups and get helpful insights to better engage your users.

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

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

Have a look at this example where the user reached the app preset limit.

<script>
smartlook('track', 'UserLimitReached');
</script>

You can find more information on custom events, interaction with pop-up windows, and much more in our documentation.

Did this answer your question?