On top of what Will said, please use the setting TRACK_MAX_EVENT instead of hardcoding 8000. Also please log to the regular application log (not tracking) when the size of events is > than TRACK_MAX_EVENT. Something like "Truncated event: event_type={event_type}, size={size} (max={TRACK_MAX_EVENT}), page={page[:200]}" -- etc. Just so we can track in the logs when we're losing things.