Custom Conversion Events

Custom conversion events (1).png

Custom event reporting with omEvents array provides a flexible and convenient way to track various user interactions and behaviors on a webpage. This documentation outlines the usage of the omEvents.push([...]) function along with its arguments and examples.


In this article, you'll learn about


Some examples of Custom Conversion Goals

  • Button clicks
  • Form submissions
  • Engagement with interactive elements like quizzes or calculators
  • Video plays
  • Sign ups or registration - if you have a SaaS website
  • etc.

If the standard tracking options (OptiMonk's default Conversion Goals) don't fit your needs or you want to track something special on your website, you can set up your own Custom Conversion Goal. This way, you can make your tracking more specific to what's important for your business, helping you better understand how well your online efforts are working.



Before using the omEvents.push([...]) function, ensure that the omEvents array is properly initialized. If not initialized, create an empty array using the following code:

var omEvents = window.omEvents || [];

Note: It's crucial to initialize the omEvents array during page load because we check its existence for half a minute after the page loads. If the array is not initialized during page load, it may lead to missed event reporting opportunities. Make sure to include the initialization code for omEvents at the earliest point possible during page load to ensure proper functionality.

This ensures compatibility and prevents any potential errors due to undefined variables.

Function: omEvents.push([...])

This function is used to push custom events into the omEvents array for tracking purposes.



  1. Event:
    • Type: String
    • Required: Yes
    • Description: Specifies the name of the event to be reported. The event name should consist of only letters, numbers, and underscores, with a maximum length of 64 characters.
  2. Properties:
    • Type: Object (single-level, name-value pairs)
    • Default: {}
    • Description: Additional properties associated with the event. Properties are represented as name-value pairs within an object. Property names should adhere to the same rules as the event name, with a maximum length of 128 characters. Property values should not exceed 256 characters.
  3. Immediate:
    • Type: Boolean
    • Default: false
    • Description: Specifies whether the event should be sent immediately. Set to true if the event requires immediate processing, such as when the user leaves the page.


Examples of Reporting

1. Basic event reporting:


2. Event reporting with properties:

omEvents.push(['sample_event', { sample_property: 7 }]);

3. Event reporting with multiple properties:

    sample_property_1: 7,
    sample_property_2: 10

4. Event reporting with immediate sending (e.g. in case of redirect buttons)

<a href="<>" class="redirect-button">This is a link</a>

	var omEvents = window.omEvents || [];

	    $('.redirect-button').on('click', function () {
	            clicked_button: "thisButton",
	            url: window.location.href


Create a conversion goal based on a custom event

1. Log in to your OptiMonk account

2. Navigate to the Settings / Conversion goals page and create a new goal

3. After you named it and selected the proper domain select the “Custom” type from the dropdown.

4. Add the name of the event you report to us and optionally filter to a specific event property if there are any

Please note, that right now you’re able to filter only for one event property per conversion goal.

Have more questions? Submit a request