error checking around GA

pull/771/head
TidusJar 8 years ago
parent b3a1548682
commit defc5a7a91

@ -49,42 +49,90 @@ namespace PlexRequests.Helpers.Analytics
public void TrackEvent(Category category, Action action, string label, string username, string clientId, int? value = null)
{
try
{
var cat = category.ToString();
var act = action.ToString();
Track(HitType.@event, username, cat, act, label, clientId, value);
}
catch (Exception ex)
{
Log.Error(ex);
}
}
public async void TrackEventAsync(Category category, Action action, string label, string username, string clientId, int? value = null)
{
try
{
var cat = category.ToString();
var act = action.ToString();
await TrackAsync(HitType.@event, username, cat, act, clientId, label, value);
}
catch (Exception ex)
{
Log.Error(ex);
}
}
public void TrackPageview(Category category, Action action, string label, string username, string clientId, int? value = null)
{
try
{
var cat = category.ToString();
var act = action.ToString();
Track(HitType.@pageview, username, cat, act, clientId, label, value);
}
catch (Exception ex)
{
Log.Error(ex);
}
}
public async Task TrackPageviewAsync(Category category, Action action, string label, string username, string clientId, int? value = null)
{
try
{
var cat = category.ToString();
var act = action.ToString();
await TrackAsync(HitType.@pageview, username, cat, act, clientId, label, value);
}
catch (Exception ex)
{
Log.Error(ex);
}
}
public void TrackException(string message, string username, string clientId, bool fatal)
{
try
{
var fatalInt = fatal ? 1 : 0;
Track(HitType.exception, message, fatalInt, username, clientId);
}
catch (Exception ex)
{
Log.Error(ex);
}
}
public async Task TrackExceptionAsync(string message, string username, string clientId, bool fatal)
{
try
{
var fatalInt = fatal ? 1 : 0;
await TrackAsync(HitType.exception, message, fatalInt, username, clientId);
}
catch (Exception ex)
{
Log.Error(ex);
}
}
private void Track(HitType type, string username, string category, string action, string clientId, string label, int? value = null)
{

Loading…
Cancel
Save