setEventProperties and setEventNameProperties methods are used to send custom events to Zeotap along with specified event properties and name.
Syntax
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| eventName | String | Yes | The name of the event to track |
| eventProperties | Object | No | Key-value pairs of event properties |
| callback | Function | No | Callback function to handle response |
Usage Examples
Event Name Only
If you only need to track the event name without additional properties, usesetEventNameProperties:
Event name only in payload
Basic Event Tracking
Event with properties in payload
Event with Callback
Best Practices
Event Naming
- Use descriptive, snake_case names:
product_viewed,checkout_completed - Be consistent across your application
- Avoid special characters and spaces
Property Structure
Related Methods
- setInstantEventProperties - Send events immediately bypassing the queue
- setPageProperties - Set page/screen context
- setUserProperties - Set user attributes
Error Handling
Common issues and solutions:- Invalid event name: Ensure event names are strings and follow naming conventions
- Large payloads: Limit property object size to avoid network issues
- Network failures: Implement callback error handling for critical events
For more examples and advanced usage patterns, see our Examples Guide.