Skip to content

Tracking analytics events during high CPU and Network load statest

If you try to track analytics events synchronously during high load states, you may easily misunderstand the order of events or get tracking anomalies. Follow the recommendations below to fix this problem.

Additionally, this approach may help you improve the User Experience during high-load states in general. For instance, it may avoid black screens, jagged sound effects, or unresponsive UI for weak networks or devices with weaker CPUs.

  • Utilize Coroutines (or similar systems for your engine - e.g. Async Tasks for Unreal Engine). We’ll use Unity as an example here.
  • Break Down the Process: Divide your CPU and network-intensive process into smaller, manageable steps.
  • Yield Control: Use yield return null; within your coroutine to relinquish control back to Unity's main thread. This allows the game to continue rendering, handling user input, and sending events while your process executes in the background.
  • Track Events at Key Steps: Inside your coroutine, track analytics events at specific points:
    • Start of Process: Log an "Event_Process_Started" event.
    • Key Milestones: Log events at significant stages within the process (e.g., "Event_Data_Fetched", "Event_Processing_Stage_1_Completed").
    • Completion: Log an "Event_Process_Completed" event.

Example for Unity Coroutine:

using UnityEngine;
using System.Collections;
public class MyScript : MonoBehaviour
{
IEnumerator LoadData() {
Analytics.CustomEvent("Event_Process_Started");
// Step 1: Fetch data from network
yield return StartCoroutine(FetchDataFromNetwork());
Analytics.CustomEvent("Event_Data_Fetched");
// Step 2: Process data (break down into smaller steps if needed)
for (int i = 0; i < 100; i++)
{
// Perform some CPU-intensive operation
yield return null; // Allow other tasks to run
}
Analytics.CustomEvent("Event_Processing_Stage_1_Completed");
// ... more steps …
Analytics.CustomEvent("Event_Process_Completed");
}
}

Copyright © 2025, FastSight.ai

Embrace the power of AI

Cut through the noise. Address only validated issues that impact your business.

Potential Gain (2)

Find friction points and opportunities invisible to traditional analysis.

Behavioral analysis

No hassle with data visualization.

No Hassle with Visualization