mirror of
https://github.com/bitwarden/mobile
synced 2025-12-22 19:23:58 +00:00
remove analytics
This commit is contained in:
@@ -1,74 +1,46 @@
|
||||
using System;
|
||||
using Bit.App.Abstractions;
|
||||
using Google.Analytics;
|
||||
using Plugin.Settings.Abstractions;
|
||||
|
||||
namespace Bit.iOS.Core.Services
|
||||
{
|
||||
public class GoogleAnalyticsService : IGoogleAnalyticsService
|
||||
{
|
||||
private readonly ITracker _tracker;
|
||||
|
||||
public GoogleAnalyticsService(
|
||||
IAppIdService appIdService,
|
||||
ISettings settings)
|
||||
{
|
||||
Gai.SharedInstance.DispatchInterval = 10;
|
||||
Gai.SharedInstance.TrackUncaughtExceptions = false;
|
||||
_tracker = Gai.SharedInstance.GetTracker("UA-81915606-1");
|
||||
_tracker.SetAllowIdfaCollection(true);
|
||||
_tracker.Set(GaiConstants.ClientId, appIdService.AnonymousAppId);
|
||||
|
||||
var gaOptOut = settings.GetValueOrDefault(App.Constants.SettingGaOptOut, false);
|
||||
SetAppOptOut(gaOptOut);
|
||||
}
|
||||
{}
|
||||
|
||||
public void TrackAppEvent(string eventName, string label = null)
|
||||
{
|
||||
TrackEvent("App", eventName, label);
|
||||
}
|
||||
|
||||
public void TrackExtensionEvent(string eventName, string label = null)
|
||||
{
|
||||
TrackEvent("Extension", eventName, label);
|
||||
}
|
||||
|
||||
public void TrackAutofillExtensionEvent(string eventName, string label = null)
|
||||
{
|
||||
TrackEvent("AutofillExtension", eventName, label);
|
||||
}
|
||||
|
||||
public void TrackEvent(string category, string eventName, string label = null)
|
||||
{
|
||||
var dict = DictionaryBuilder.CreateEvent(category, eventName, label, null).Build();
|
||||
_tracker.Send(dict);
|
||||
Gai.SharedInstance.Dispatch();
|
||||
}
|
||||
|
||||
public void TrackException(string message, bool fatal)
|
||||
{
|
||||
var dict = DictionaryBuilder.CreateException(message, fatal).Build();
|
||||
_tracker.Send(dict);
|
||||
}
|
||||
|
||||
public void TrackPage(string pageName)
|
||||
{
|
||||
_tracker.Set(GaiConstants.ScreenName, pageName);
|
||||
var dict = DictionaryBuilder.CreateScreenView().Build();
|
||||
_tracker.Send(dict);
|
||||
}
|
||||
|
||||
public void Dispatch(Action completionHandler = null)
|
||||
{
|
||||
Gai.SharedInstance.Dispatch((result) =>
|
||||
{
|
||||
completionHandler?.Invoke();
|
||||
});
|
||||
}
|
||||
|
||||
public void SetAppOptOut(bool optOut)
|
||||
{
|
||||
Gai.SharedInstance.OptOut = optOut;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,10 +82,5 @@
|
||||
<Name>App</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Google.iOS.Analytics">
|
||||
<Version>3.17.0.1</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user