Basics
Setup
Events
How to Set Up Event Tracking in Monolytics
Oct 22, 2024
This guide demonstrates how to register events on your website. Events provide insights into what's happening on your site, such as user actions, system events, or errors.
Pls note that event names are case-sensitive, and recording two events with names differing only in case will result in two distinct events.
Before You Begin
Ensure that you have installed the Monolytics code on your site. Depending on your installation method, the way to track events will also differ. Choose the method that suits you:
1) Installing the event code directly in the site's code
2) Configuring events using Google Tag Manager
If you need help - write us at max@monolytics.com
Installing Event Code Directly in the Site’s Code
After you have set up Monolytics, you can start tracking events using the monolytics_send_conversion() method. Below is an example of the code for transmitting an 'add_to_cart' event."
We recommend using the snake_case format for event names, where each space is replaced with an underscore (_), and words are written in lowercase.
You can use any names for your events, but it's better to use names that are understandable not only to you but also to your colleagues. Here are several examples of event names and the situations in which they are used:
view_item - the user viewed a product card
add_to_cart - the user added an item to the cart
purchase - the user made a purchase on the site
sign_up - user registration on the site
sign_in - the user logged into their account on the site
form_submit - the user submitted a form
Setting Up Events with Google Tag Manager
If you use Google Tag Manager for handling marketing and analytical codes on your website, we also recommend using it for transmitting data to Monolytics.
In Google Tag Manager, you can set up the transmission of events in one of two ways:
1) By using events that are already being sent to the dataLayer
2) By configuring the data transmission yourself
—————————————————————————————————
Using Events Already Sent to DataLayer
If your website is already sending data to the dataLayer, you can quickly duplicate its transmission to Monolytics. To do this, you need to create a Custom HTML tag with settings similar to those you see in the screenshot below and connect it to the triggers of your custom events.
To do this, follow these steps:
Go to the 'Tags' tab and click the 'New' button:
In the window that opens, click on the pencil icon.
In the next step, select the 'Custom HTML' tag type:
In the window that opens, paste the following code:
Add a trigger to your tag.
To complete this step, you need to know the names of the events being sent to the dataLayer. Suppose we have an 'add_to_cart' event being sent. Then we would need a trigger with the following settings:
Don't forget to name your tag and save the settings.
—————————————————————————————————
Manually Setting Up Data Transmission
If your website does not utilize data transmission to the dataLayer, you can set up the data transmission to Monolytics by yourself. To transmit an event, you will need a Custom HTML tag and a corresponding trigger. An example of the setup can be seen in the screenshot below:
To do this, follow these steps:
Go to the 'Tags' tab and click the 'New' button:
In the window that opens, click on the pencil icon:
Next, choose the 'Custom HTML' tag type:
In the window that opens, insert the following code. Remember to replace 'YOUR_EVENT_NAME' with the name of the event you want to track:
Add a trigger to your tag. The trigger settings will be similar to those used when transmitting data to Google Analytics or Facebook Ads. For example, if you want to track an event when a user clicks a link leading to Facebook, you can use a 'Click - Just Links' trigger with the following settings.
Don't forget to name your tag and save the settings.
Monolytics displays information in real-time in its reports, so you'll be able to see the first events within a few minutes.
Enjoy using it ;)
If you need help - write us at max@monolytics.com