@@ -24,7 +24,7 @@ public static void TrackEvent(this TelemetryClient telemetryClient, string event
2424 properties = new Dictionary < string , string > ( ) ;
2525 }
2626
27- AddTargetingProperties ( properties , targetingContext ) ;
27+ properties [ "TargetingId" ] = targetingContext . UserId ;
2828
2929 telemetryClient . TrackEvent ( eventName , properties , metrics ) ;
3030 }
@@ -41,45 +41,11 @@ public static void TrackEvent(this TelemetryClient telemetryClient, EventTelemet
4141 telemetry = new EventTelemetry ( ) ;
4242 }
4343
44- AddTargetingProperties ( telemetry . Properties , targetingContext ) ;
44+ telemetry . Properties [ "TargetingId" ] = targetingContext . UserId ;
4545
4646 telemetryClient . TrackEvent ( telemetry ) ;
4747 }
4848
49- /// <summary>
50- /// Extension method to track a metric with <see cref="TargetingContext"/>.
51- /// </summary>
52- public static void TrackMetric ( this TelemetryClient telemetryClient , string name , double value , TargetingContext targetingContext , IDictionary < string , string > properties = null )
53- {
54- ValidateTargetingContext ( targetingContext ) ;
55-
56- if ( properties == null )
57- {
58- properties = new Dictionary < string , string > ( ) ;
59- }
60-
61- AddTargetingProperties ( properties , targetingContext ) ;
62-
63- telemetryClient . TrackMetric ( name , value , properties ) ;
64- }
65-
66- /// <summary>
67- /// Extension method to track a <see cref="MetricTelemetry"/> with <see cref="TargetingContext"/>.
68- /// </summary>
69- public static void TrackMetric ( this TelemetryClient telemetryClient , MetricTelemetry telemetry , TargetingContext targetingContext )
70- {
71- ValidateTargetingContext ( targetingContext ) ;
72-
73- if ( telemetry == null )
74- {
75- telemetry = new MetricTelemetry ( ) ;
76- }
77-
78- AddTargetingProperties ( telemetry . Properties , targetingContext ) ;
79-
80- telemetryClient . TrackMetric ( telemetry ) ;
81- }
82-
8349 private static void ValidateTargetingContext ( TargetingContext targetingContext )
8450 {
8551 if ( targetingContext == null )
@@ -90,7 +56,6 @@ private static void ValidateTargetingContext(TargetingContext targetingContext)
9056
9157 private static void AddTargetingProperties ( IDictionary < string , string > properties , TargetingContext targetingContext )
9258 {
93- properties [ "TargetingId" ] = targetingContext . UserId ;
9459 }
9560 }
9661}
0 commit comments