Skip to content

AnastasiaValishina/event-service-test-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Unity Event Tracking Service

Unity version: 2021.3.41f1

This Unity project contains an event tracking service designed to collect and send analytics events to a server. It is designed to ensure that critical data is not lost, even in the case of application crashes or unexpected shutdowns.

🚀 Features

  • Event Queuing: Events are queued and sent in batches to minimize server requests. The service employs a cooldown mechanism to gather events over a set period before sending them to the server in one request.
  • Guaranteed Delivery: Events are only removed from the queue after the server successfully processes them (HTTP 200 OK). If the server is unreachable, the events will remain in the queue and be resent when possible.
  • Persistent Storage: Events are stored locally using Unity's Application.persistentDataPath, ensuring that they are retained between sessions. This is especially important for WebGL, where detecting application closure is not always possible.
  • Simple Integration: Easily integrated into any Unity project by attaching the EventService MonoBehaviour to a GameObject.

🛠️ Usage

  1. Tracking Events: Use the TrackEvent method to queue events for tracking.

eventService.TrackEvent("levelStart", "level:3");
  1. Event Types: Customize the type and data fields to match the specific analytics events you need to track.
  2. Cooldown Mechanism: Configure the cooldown period (cooldownBeforeSend) to determine how often events are sent to the server.

🔧 Setup

  1. Add the EventService script to a GameObject in your scene.
  2. Configure the serverUrl and other settings directly in the Unity Inspector.
  3. The service will automatically start tracking and sending events as they occur.

About

Event Tracking Service

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages