By default, OptiMonk measures a campaign by its submits. If you want to measure something else, you have two options:
A goal without code. Create it in the app in a few clicks. It works for a page visit, a purchase or an add-to-cart.
Your own JavaScript event (omEvents). Use it for anything the goal types don't cover, such as a button click or a video play.
Start with the first option. You only need omEvents if no goal type fits.
Create a custom conversion without code
Open Reports in the left menu. Goals belong to a domain, so make sure the right domain is selected in the workspace switcher.
At the top of the page, open the Goal: menu and click New goal at the bottom.
Fill in Goal name, for example Reached checkout.
Choose the Goal type and fill in its fields:
| Goal type | What it measures | Fields |
|---|---|---|
| Page visit | The visitor opens a page | Condition (is, is not, contains, does not contain, starts with, does not start with, ends with, does not end with) + URL |
| Purchase value | An order's value or size | Field: Order total or Item count + Condition (equals, greater than, less than, at least, at most, between) + Value |
| Add-to-cart value | Products added to the cart | Field: Product price, Quantity or Cart total + the same conditions + Value |
Then click Save.
Each goal has one condition. New or changed goals may take a few minutes to appear in the analytics selectors.
When the goal appears, pick it in the Goal: menu. The trend, the Campaign Performance table and every breakdown are then measured against it. To see, edit or delete your goals, click Manage goals at the bottom of the same menu.
Use the goal on one campaign
Open Campaigns and click the campaign.
On the Overview tab, pick the goal in the goal picker next to the date range.
OptiMonk saves it as this campaign's goal, so the campaign is measured against it the next time you open it.
Report your own events with omEvents (advanced)
If no goal type fits, you can report your own event from your site with the omEvents array, then build a goal on it. Some examples:
Button clicks
Form submissions
Engagement with quizzes or calculators
Video plays
Sign-ups or registrations on a SaaS site
Initialization
Before you use omEvents.push([...]), make sure the omEvents array exists. If it doesn't, create an empty array:
var omEvents = window.omEvents || [];Note: Initialize the array while the page loads. We check for it for half a minute after the page loads, so if it's created later, events may be missed. Put the code as early in the page as you can.
Arguments of omEvents.push([...])
Event (string, required): the name of the event. Use only letters, numbers and underscores, up to 64 characters.
Properties (object, default {}): extra name-value pairs, one level deep. Property names follow the same rules as the event name, up to 128 characters. Values can be up to 256 characters.
Immediate (boolean, default false): set it to true if the event must be sent right away, for example when the visitor is leaving the page.
Examples
Basic event:
omEvents.push(['sample_event']);Event with a property:
omEvents.push(['sample_event', { sample_property: 7 }]);Event with several properties:
omEvents.push([
'sample_event',
{
sample_property_1: 7,
sample_property_2: 10
}
]);Event sent immediately, for example on a redirect button:
<a href="https://www.optimonk.com/" class="redirect-button">This is a link</a>
<script>
var omEvents = window.omEvents || [];
$(document).ready(function () {
$('.redirect-button').on('click', function () {
omEvents.push([
'redirectSuccess',
{
clicked_button: "thisButton",
url: window.location.href
}, true
]);
});
});
</script>Build a goal on your event
Goals built on your own events are created in the classic OptiMonk admin.
Open the account menu in the top right and click Switch to classic OptiMonk. You stay signed in with the same account.
In the classic admin, go to Settings / Conversion goals and create a new goal.
Name it, select the domain, then select the Custom type.
Enter the event name, which is the first argument of your omEvents.push([...]) call. You can also filter on one event property.
Come back to this app and open Reports. After a few minutes, the goal appears in the Goal: menu.
Goals built in the classic admin
In Reports → Goal: → Manage goals, goals built in the classic admin show Custom rule under their name. The same applies to goals with more than one condition. You can rename or delete these goals here, but you can't edit their rule:
This goal's rule was built in the classic admin and can't be edited here — you can rename or delete it.
Rename: click the pencil icon, type the new Goal name, then save.
Delete: click the bin icon and confirm. Deleting a goal can't be undone.
Change the rule (for example, the event name): do it in the classic admin.