@@ -461,6 +461,58 @@ public void GetTags()
461461 _log ( $ "Get all user tags " + dictionaryString . TrimEnd ( ',' , ' ' ) + "}" ) ;
462462 }
463463
464+ public void TrackEvent ( )
465+ {
466+ // Detect platform
467+ string platform =
468+ Application . platform == RuntimePlatform . Android ? "android"
469+ : Application . platform == RuntimePlatform . IPhonePlayer ? "ios"
470+ : "unknown" ;
471+
472+ // Track event without properties
473+ _log ( $ "Tracking an event <b>Unity-{ platform } -noprops</b> without properties") ;
474+ OneSignal . User . TrackEvent ( $ "Unity-{ platform } -noprops") ;
475+
476+ // Track event with comprehensive properties
477+ var properties = new Dictionary < string , object >
478+ {
479+ { "someNum" , 123 } ,
480+ { "someFloat" , 3.14159f } ,
481+ { "someString" , "abc" } ,
482+ { "someBool" , true } ,
483+ {
484+ "someObject" ,
485+ new Dictionary < string , object >
486+ {
487+ { "abc" , "123" } ,
488+ {
489+ "nested" ,
490+ new Dictionary < string , object > { { "def" , "456" } }
491+ } ,
492+ }
493+ } ,
494+ {
495+ "someArray" ,
496+ new List < object > { 1 , 2 }
497+ } ,
498+ {
499+ "someMixedArray" ,
500+ new List < object >
501+ {
502+ 1 ,
503+ "2" ,
504+ new Dictionary < string , object > { { "abc" , "123" } } ,
505+ }
506+ } ,
507+ { "someNull" , null } ,
508+ } ;
509+
510+ _log (
511+ $ "Tracking an event <b>Unity-{ platform } </b> with properties: { Json . Serialize ( properties ) } "
512+ ) ;
513+ OneSignal . User . TrackEvent ( $ "Unity-{ platform } ", properties ) ;
514+ }
515+
464516 /*
465517 * Outcomes
466518 */
0 commit comments