Understanding Custom Events

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

Parts to an Event

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

  1. eventCategory  - Required
  2. eventAction - Required
  3. eventLabel - Optional. 
  4. eventValue - Optional. Must be numeric value.

How to add an event.

Custom events can be added in three different ways:

  1. Via URL Parameters. (easiest)
  2. Via Javascript API 
  3. Via REST API 

Adding custom events via URL Parameters

To add a custom event via a URL call simply pass the following variables as GET variables: 

  • at_category - the event category
  • at_event_action - the event action
  • at_event_label - the event label (optional)
  • at_event_value - the event value (optional - must be numeric)

For instance you can pass an event by using this as a url:

https://yoursite.com/?at_category=video&at_action=tutorial&at_label=new-user

Note: If you are using spaces within the values be sure to encode them with %20. (Most browsers do this automatically).

Adding custom attributes via 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: eventCategory and eventAction are required fields while eventLabel and eventValue are optional. eventValue must be a numeric value.

<script>
  function _aimtellReady(){
_aimtellTrackEvent(eventCategory, eventAction, eventLabel, eventValue)	  
}

</script>

Below is an example of tracking a custom event.

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

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>

Adding custom events via REST API

To add a custom event via a REST call check out our documentation at   https://aimtell.readme.io/. Essentially you will just need to make an authenticated call and pass the custom event data like the example below. Read our API documentation for more information on responses and limitations.

curl -XPUT -H 'X-Authorization: AUTH_TOKEN' -H "Content-type: application/json" -d '{
    "idSite": "1",
    "owner_uid": "ia123d",
    "eventCategory": "watched video",
    "eventAction" : "tutorial",
    "eventLabel" : "welcome to aimtell"
}' 'https://api.aimtell.com/prod/subscriber/27c2f4e2-8d30-168d-cdcb-69886cb80b79'

Verifying Events

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