Overview
When it comes to naming events, it's beneficial to follow some conventions to ensure consistency and clarity across your tracking implementation. Clear and intuitive event names help in effectively communicating the purpose of the event being tracked when working collaboratively or analyzing event data at a later stage. By using human-readable event names, you can ensure that the events are self-explanatory and do not require additional explanation or deciphering.
Best Practices
Here are some event naming conventions to consider:
- Use clear and descriptive names: Choose event names that accurately describe the user action being tracked. Make sure the name concisely communicates what happened, without being overly technical or ambiguous.
- Be consistent: Establish a set of naming conventions for events and stick to them throughout your tracking implementation.
- Use lowercase and underscores or dashes: Most operating systems are case-sensitive; always use lowercase for event names and separate multiple words with underscores (_) or dashes (-) for better readability. For example, "video_playback_started" or "checkout_completed".
- Use verbs for action-based events: Start event names with verbs to indicate actions. For example, "user_signed_in", "item_added_to_cart", or "form_submitted".
- Include relevant object or context information: If an event involves a specific object or context, include it in the event name. For example, "product_purchased" or "article_shared".
- Avoid using abbreviations or acronyms: While abbreviations might save characters, they can also introduce confusion. It's generally better to use complete words that are easily understood by all team members.
- Keep event names concise: Try to keep event names as short as possible while still maintaining clarity. Long event names can be unwieldy and difficult to work with.
You can adjust the above conventions to fit your specific needs and requirements. The key is to choose a convention that aligns with your team's understanding and enables easy interpretation of the event data.
Recommendations
-
We recommend naming an event with a minimum of 5 characters.
User/Event property values are limited to 512 characters in length. - Non-ASCII characters need to be escaped.
-
Do not start your user or event attributes with "moe". MoEngage may not track event names starting with "moe".
Example:- moe_addtocart
- addToCart
- AddToCart
- Add_to_cart
- Add-to-Cart
- Whenever possible, use the same names across your mobile apps and websites for consistency.
- Group similar events with a common prefix. For example, "booking_initiated", "booking-dates-selected", "BookingRoomSelected", and "Booking_completed".
- Use an underscore or a hyphen between the words instead of spaces. Space-filled attributes cannot be read and may cause your use case to fail.
- Creating every user action as an event will make it harder to find meaningful answers in a pool of events. Employ more general events rather than specific ones. For example, instead of three individual events such as "video_start", "video_pause", and "video_end", use a "video_watched" event with "Duration" as a property value.
- Do not capture screen loads or unloads, button clicks, or form submissions. Instead, record user actions that are in line with your business objectives.
- Do not capture page views as events, or page URLs as event properties. You can get better insights into how people use your product than by the pages they visit.
- For objects datatype attributes, please maintain a different name for the object attribute and the attributes or keys inside the object.
Prohibited Characters
Do not use any of the following special characters or symbols in your event names:
$ dollar sign | . dot | < left angle bracket | + plus sign |
$ dollar sign | . dot | < left angle bracket | + plus sign |
% percent | > right angle bracket | ! exclamation point | ` backtick |
& ampersand | * asterisk | # pound | | pipe |
{ left curly bracket | ? question mark | " double quotes | = equal sign |
} right curly bracket | / forward slash | : colon | emojis |
\ back slash | blank spaces | @ at sign | ' single quotes |
This list is meant to help you avoid common errors while naming events. If you have any questions, please reach out to the support team.
Reserved keywords
- MoEngage standard events are usually tracked as 'moe_eventname'. As mentioned earlier, avoid naming your events starting with moe.
- Refer to the list of standard/derived events tracked by MoEnage and avoid duplicacy in your custom events