Skip to main content
Custom Events
Alexis Taylor avatar
Written by Alexis Taylor
Updated over a week ago

If you want to track custom conversions for your site, you can take advantage of Advanced Analytics custom events. You can enable Advanced Analytics in your Site Settings under General. This feature enables you to monitor actions on your website or any page or subdomain within your main domain.

For security reasons, you can only send events from the same domain, or a subdomain of your Umso website. If your website is on example.com, you can send events from example.com, www.example.com, app.example.com, campaign.example.com, .... However you can't send events from examplecorp.com or example.io

How to Set Up Event Tracking

Step 1: Add the Script to Your Header

You'll need to add a specific script to the Custom Site Code of your site settings (if you are using the new editor), or under Integrations (header code) if you are using the legacy editor.

Insert the following script tag:

<!-- The script url with a placeholder -->
<script src="https://[YOUR_DOMAIN_HERE]/s/interactive.js"></script>

If your domain is www.example.com, the script will look like this:

<!-- The script url if your domain was www.example.com --><script src="https://www.example.com/s/interactive.js"></script>

Be sure to replace "www.example.com" with your actual domain.

Step 2: Create a Custom Section

Create a custom section in your page to include the tracker handler:

<script>Umso.track('Your Event Name')</script>

This tracker will run as soon as the section gets loaded in your site. If you want to attach your tracker to a custom button. Please see the examples in the end of this article.

Built-in buttons already have tracking enabled without any code needed. Their event name is the text set to the button, for example, if you have a button "Get Started", that will be the event name.

Step 3: View Events on Analytics Page

You can see the tracked events in your analytics page under Conversion Rate by visiting Umso Analytics.

To easily find your new events, select 24 Hours in the top right picker.
โ€‹
โ€‹

Examples of Event Tracking

Here's how you can track different actions using HTML and JavaScript.

Custom Button

To attach a tracker to a custom button, you first need to attach an id to your button, and then add an event listener (event listener is needed as we block onclick for safety purposes).

<!-- track a button click -->
<button id="myButton" onclick="">Click Me</button>

<script>
document.getElementById('myButton').addEventListener('click', function() {
Umso.track('Your Event Name')
});
</script>

Form

To attach to a form, you can use the onsubmit to attach your tracker

<!-- track a form submission -->
<form onsubmit="Umso.track('form submitted')">
< input type="text">
</form>

Page Load

To track your page load, you can simply add:

<script>window.addEventListener('load', (event) => {
Umso.track('/page1 loaded')
});</script>

This article is about Umso Analytics. If you want to track events with a third-party software, you need to use custom code.

Did this answer your question?