Events & screen tracking
Track custom events, screen views and scene changes in your Unity game with the Grovs SDK.
Track custom events and screens, and identify the player. Installs, opens, time spent and reactivations are tracked by the native SDK with no code.
Tracking custom events
Track records an event with optional properties and tags:
using System.Collections.Generic;
using GrovsSDK;
Grovs.Track("level_complete",
new Dictionary<string, object> { { "level", 3 }, { "stars", 2 } },
new List<string> { "progress" });
Grovs.Track("tutorial_skipped");Property values must be JSON-serializable: strings, numbers, booleans, null, lists and string-keyed dictionaries of these. Anything else throws ArgumentException. A null name throws ArgumentNullException.
Event rules
Grovs logs a [Grovs] warning, and still sends the call, when an event breaks a native rule:
- The name is empty or reserved:
view,open,install,reinstall,app_open,time_spent,reactivation,user_referred,custom,screen_view,push_open,push_delivered,push_held,in_app_viewed,in_app_clicked,in_app_dismissed,in_app_answered,in_app_commented,in_app_held,journey_entered,journey_held,journey_path. - Properties are over 8192 bytes of JSON.
- More than 20 tags, or a tag over 255 characters.
What the native SDK then does with the event: iOS event name rules.
Global tags
Tags added to every event:
Grovs.SetGlobalTags(new List<string> { "beta" });
Grovs.SetGlobalTags(null); // clears themTracking screen views
Grovs.TrackScreenView("Shop");
Grovs.TrackScreenView("Shop", new Dictionary<string, object> { { "tab", "coins" } });Native automatic screen tracking is off in Unity games, so screens come only from TrackScreenView and scene tracking. Screen views can trigger in-app messages and are matched by excluded screens.
Tracking scenes
Turn on Track scenes in Project Settings → Grovs. Each active scene change is then sent as a screen view with the scene name, once per change. The first scene is reported at startup.
Screen name aliases
Rename screens for the dashboard:
Grovs.SetScreenAliases(new Dictionary<string, string> { { "MainMenu", "Home" } });Aliases apply to TrackScreenView and to scene tracking.
Identifying the player
Grovs.SetUserIdentifier("player-42"); // null clears it
Grovs.SetUserAttributes(new Dictionary<string, object> { { "plan", "pro" }, { "level", 12 } });Attribute values follow the same JSON rules as event properties.
Next steps
- Revenue: log purchases
- In-app messages: campaigns triggered by these events and screens
- Privacy & Consent: what's held while Grovs is disabled