Documentation Center

Tracking Custom Events

Custom events allow users to add custom events to their subscribers to be used for segmentation and in turn targeted notifications.

Custom events allow users to add custom events to their subscribers to be used for segmentation and in turn targeted notifications.

All events can have up to 4 different pieces of information, while only 2 are required.

1.category - Required. (string or integer)
2.action - Required (string or integer)
3.label - Optional. (string or integer)
4.value - Optional. (integer)

Option 1) Tracking Custom Events With The Javascript API

Once you have added your website and integrated the tracking code into your site, you are able to start adding custom events. To do so simply call the following snippet on your page, and replace the variables within the parameters with the information you want to track.

Note: Category and Action are required fields while Label and Value are optional. Value must be a numeric value.

<script>
function _aimtellReady(){
_aimtellTrackEvent(category, action, label, value)
}
</script>

For instance, if you wanted to track whenever someone watched a video on your page, you could create the following event. Below is an example of tracking a custom event.

<script>
function _aimtellReady(){
_aimtellTrackEvent("watched video", "tutorial", "welcome to aimtell")
}
</script>

Tip: When testing in the browser console, do not include _aimtellReady part. Simply use the _aimtellTrackEvent portion. The _aimtellReady part is a callback that runs everything inside after the page has fully loaded Aimtell.

You may also tie an event to a link or button like this:

<button onclick='_aimtellTrackEvent("watched video", "tutorial", "welcome to aimtell")'>Watch Video Event</button>

Option 2) Tracking Custom Events With The REST API

To add the custom attributes via a REST call check out our documentation at https://developers.aimtell.com. Essentially you will just need to make an authenticated call and pass the custom data like the example below.

curl -XPOST -H 'X-Authorization: AUTH_TOKEN' -H "Content-type: application/json" -d '{
"idSite": "1",
"subscriber_uid": "5059b0a2-747d-0f74-73c4-24c8442de237",
"event": {
"category" : "video",
"action" : "watched"
}
}' 'https://api.aimtell.com/prod/subscriber/'

Verifying Events

To help in debugging event tracking, you can check out your logs under "Logs" -> "Event Logs" in your dashboard.