Reputation: 553
I been trying to add google analytics to my xamarin forms apps , but everything I see contains a lot of code, is there any easy way to get this working.It cant be this hard. I followed this https://github.com/KSemenenko/GoogleAnalyticsForXamarinForms , but when I added the init part it cant find the namespace. the nuget is already installed.
what other steps should I follow?
Upvotes: 0
Views: 2455
Reputation: 15796
To use ksemenenko.GoogleAnalytics, install ksemenenko.GoogleAnalytics package, and add the namespace using Plugin.GoogleAnalytics;
:
then you can use the api in your porject:
GoogleAnalytics.Current.Config.TrackingId = "UA-11111111-1";
GoogleAnalytics.Current.Config.AppId = "AppID";
GoogleAnalytics.Current.Config.AppName = "TEST";
GoogleAnalytics.Current.Config.AppVersion = "1.0.0.0";
//GoogleAnalytics.Current.Config.Debug = true;
//For tracking install and starts app, you can change default event properties:
//GoogleAnalytics.Current.Config.ServiceCategoryName = "App";
//GoogleAnalytics.Current.Config.InstallMessage = "Install";
//GoogleAnalytics.Current.Config.StartMessage = "Start";
//GoogleAnalytics.Current.Config.AppInstallerId = "someID"; // for custom installer id
GoogleAnalytics.Current.InitTracker();
//Track view
GoogleAnalytics.Current.Tracker.SendView("MainPage");
Upvotes: 1