Overview
Unity Analytics imposes certain limits on the size of events to maintain efficient data processing and system performance. This article provides a comprehensive overview of these limits and offers guidance on managing event sizes effectively.
Note: The event size limit in Unity Analytics is designed to be generous enough that most developers won’t need to worry about hitting it. However, if you are working with complex or data-heavy events and want to ensure your implementation stays within limits, this article can help you structure and optimize your event payloads.
Size Limitations
- Maximum Event Size: Each event sent to Unity Analytics must not exceed 5mb. This limit encompasses the combined size of the event name, parameter names, and parameter values.
- Maximum Parameter Size: Parameters do not have a maximum size, but of course, they must remain within the limits of the Event itself.
Note: If an event exceeds these limits, it will not be processed, and Unity Analytics will return appropriate error messaging.
When constructing events, consider the following:
- String Parameters: The size contribution of a string parameter includes the length of the parameter name and the length of its value.
- Numeric Parameters: Numeric values contribute a fixed size based on their data type (e.g., integers typically contribute 4 bytes).
-
Boolean Parameters: Boolean values contribute a minimal size, typically 1 byte, representing
true
orfalse
. -
Array Parameters: The size contribution of an array parameter depends on the number of elements and the size of each element's data type. The total size is calculated as
Number of Elements * Size of Each Element
. Example: afloat[]
array of size 10 would be 40 bytes (10 * 4
). - JSON Parameters: The size contribution of a JSON parameter is equal to the length of the entire JSON string after serialization. Reducing the size of JSON fields and values directly reduces the parameter's contribution.
Best Practices
- Optimize Parameter Usage: Limit the number of parameters and keep their names and values concise to stay within the size constraints.
- Monitor Event Sizes: Regularly review the size of events during development to prevent issues related to size limits.
For more information about how to manage parameter size, read Configuring String Parameter Lengths in Unity Analytics.
Feel free to reach out to the Unity Analytics support team for more information!