What Custom Events is and how to use it in Convead
In Convead, you can create your own events (access a certain page, click on a button, register, subscribe to a newsletter, etc.) and use them on a par with the system events, for example, sending mailings via them.
How to create a new event
Manage events in Convead in the “Settings” > “Custom events” section. When you go there for the first time, you will see instructions on how to create a new event:
To create an event, click the blue button in the upper right corner. This will open the following window:
Fill in these fields:
- Name – any name you want. This will be used when displaying the event in the visitor timeline, as well as in the forms of filters and segments.
- Key – unique identifier of the event (only Latin letters, numbers, and underscores). It should be passed by your site as an event parameter.
- CSS selector – an optional field-selector of the element you need in the HTML markup of your site, which you click on when the event should be triggered (more below).
- Description – any clear description of the event. It will be displayed in the event list for your convenience.
Click on the “Create” button. After the half-way mark is passed, the event appears in Convead. The created events fall into the “General” list and look like this:
The “Edit” and “Delete” buttons appear in the rows for each event.
How to trigger an event on your website
You can use custom events in Convead on a par with the system – to send mailings, segment visitors, etc. To do this, you need to transfer them to Convead from your site at the right time. There are two ways to do this:
1. Register the event code on your website
For example, if you want to receive events when a visitor clicks the subscribe button, you need to insert the following line into the code of the button handler:
Where event_key is the key of your event.
2. Use CSS selector (see above on the event creation form)
Most of the HTML code elements of your site are marked with one or more CSS selectors in order to apply the desired style from the CSS file to the desired element. For example, all the “Subscribe to blog” buttons on your site have the same appearance and are described by the same class in the CSS. This means that they have the same selector (or even several). You can tell Convead that when clicking on items with a specific selector, it should trigger your custom event.
In 99% of cases, you can use the attribute values of the class or the ID of the button or link you want to link to the event. Open the code of your site, find the button or link, and see if it has the specified attributes:
The underlined values are the attributes we need. You can insert one of them in the “CSS selector” field of the custom event creation form.
Note that the value is preceded by the # symbol. This is due to CSS syntax rules:
- The # defines an id attribute
- Point . – a sign of the class attribute
Therefore, if you use the value of the id attribute, put a # in front of it, and if you use the class attribute, put a point in front of it.
Before binding an attribute value to an event, consult your webmaster to ensure that the attribute you selected is not used by any other elements you do not need. Otherwise, your event will trigger when you click on all of these items. And that’s not what you need.
How to use events
To test and make sure that the events come to Convead correctly, find yourself in the contacts (the easiest way to do it is on the “Contacts” page – “Online”), take the desired action on the site and make sure that it appears in the timeline with the desired name. Here we can see that the visitor has subscribed to the blog.
After that, you can create a mailing and, in the “Conditions of sending”, specify that the mailing should be sent by this event:
You can build a segment for all visitors who have triggered the event. Go to “Contacts” > “Segments” and click “Add segment” at the bottom left. You will see a visual designer where you can create conditions for events. Moreover, you can specify not only whether the event occurred or not, but also how many times and over what period.