Client-SideUnity SDKEvent Tracking

Custom Events

Track any custom event with arbitrary properties

Version:

Track any custom event with arbitrary properties.

Basic Usage

// Simple event
AudiencelabSDK.SendCustomEvent("level_completed");

// Event with properties
AudiencelabSDK.SendCustomEvent("level_completed", new {
    level = 5,
    score = 12500,
    time_seconds = 120,
    stars = 3
});

// Event with deduplication key
AudiencelabSDK.SendCustomEvent("achievement_unlocked", 
    new { achievement_id = "first_win" },
    dedupeKey: "achievement_first_win_user123"
);

Parameters

Prop

Type

Examples

Track Level Completion

AudiencelabSDK.SendCustomEvent("level_completed", new {
    level = 5,
    score = 12500,
    difficulty = "hard",
    stars = 3
});

Track Tutorial Progress

AudiencelabSDK.SendCustomEvent("tutorial_step", new {
    step = "inventory_opened",
    step_number = 3,
    total_steps = 10
});

Track with Deduplication

For events that might be sent multiple times, use the dedupeKey:

AudiencelabSDK.SendCustomEvent("achievement_unlocked", 
    new { achievement_id = "first_win" },
    dedupeKey: $"achievement_first_win_{userId}"
);

Best Practices

  • Send custom events at the moment the action occurs
  • Use consistent event names across your codebase
  • Include relevant context in properties for better analytics