Add New Custom Event type into the system

New Generic/Custom event

This will work like any other event that is standard in our system. It only needs to respect a few conditions.

  1. You must provide a name for the event (event_name) and it can be used later in segmentation.

Event name will be:

  • lower-cased
  • all spaces replaced with _
  • all other characters but  A-Z a-z 0-9 _ will be removed

For example: “Click on img button” and “click on IMG_button” will both be converted into “click_on_img_button”.

<script>
window._vteq = window._vteq || [];
window._vteq.push({
  event: {
    event_name: "Event name", // required
    attribute : 123, //optional, any attributes of type: string, number, float
    another_attribute: "string value"
  }
});
</script>

Use: **|event.generic.event_name|** to display any event attribute in your templates.

For other events the generic object will be passed similar to:

<script>
window._vteq = window._vteq || [];
window._vteq.push({
  viewitem: { 
      itemId: '123',
      generic: {
        attribute : 123, 
        another_attribute: "string value"
      }
  }
});
</script>

Generic attributes object:

You can pass any number of attributes along with the generic event. Those will be moved under “generic” object. For all other event types, you must specific a generic object in order to be considered.

Some extra considerations for “generic” extra fields:

  • All other key / values inside the event Object will be saved under generic field.
  • Keys are normalized (attribute name) and all other characters but  A-Z a-z 0-9 _ will be removed. Letters case is preserved.

Related Articles