public async Task SubmitEvent(GoogleAnalyticsCategory category, GoogleAnalyticsAction action, string label, DimensionTuple[] dimensions) { try { var content = GoogleAnalyticsSetup(); content.Add(new KeyValuePair <string, string>("t", "event")); content.Add(new KeyValuePair <string, string>("ec", category.ToString())); content.Add(new KeyValuePair <string, string>("ea", action.ToString())); content.Add(new KeyValuePair <string, string>("el", label)); foreach (var dimension in dimensions) { content.Add(new KeyValuePair <string, string>(GetDimension(dimension.Dimension), dimension.Value)); } #if !DEBUG await Client.PostAsync($"{ApiHost}/collect", new FormUrlEncodedContent(content.ToArray())); #endif } catch (Exception) { /* I don't care if this fails..*/ } }
public async Task SubmitEvent(GoogleAnalyticsCategory category, GoogleAnalyticsAction action) { await SubmitEvent(category, action, string.Empty, new DimensionTuple[] { }); }