// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var tracker = TrackerBuilder.BuildMobileTracker(DemoDataApplicationWebProplerty, Applicationname, ApplicationVersion, ApplicationId); services.AddSingleton(tracker); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }
public void Assert_BuildMobileTracker_Builds_MobileTracker() { var tracker = TrackerBuilder.BuildMobileTracker(WebPropertyId); Assert.Equal(tracker.Type, GaTrackerType.Mobile); Assert.NotNull(tracker.ApplicationName); Assert.NotNull(tracker.ClientId); Assert.Equal(tracker.TrackingId, WebPropertyId); }
static void Main(string[] args) { var serviceCollection = new ServiceCollection(); ConfigureServices(serviceCollection); var tracker = TrackerBuilder.BuildWebTracker(DemoDataWebApplicationWebProplerty); PageViewHItSender.Send(tracker); EventHitSender.Send(tracker); var trackerMobile = TrackerBuilder.BuildMobileTracker(DemoDataApplicationWebProplerty); ScreenViewHitSender.Send(trackerMobile); EventHitSender.Send(trackerMobile); Console.WriteLine("Hello World!"); }
public static async Task <int> Main(string[] args) { var start = DateTime.Now; Console.WriteLine("Hello Google Analatics SDK!"); var tracker = TrackerBuilder.BuildMobileTracker(DemoDataApplicationWebProplerty, Applicationname, ApplicationVersion, ApplicationId); if (!await ScreenViewHitHelper.SendAsync(tracker, "QuickStartMain")) { Console.WriteLine("Send Screen View Failed"); return(0); } if (!await EventHitHelper.SendAsync(tracker, Applicationname, "Start", "Main")) { Console.WriteLine("Send Event Hit Failed"); return(0); } if (!await ExceptionHitHelper.SendAsync(tracker, "Something Failed", true)) { Console.WriteLine("Send exception Hit Failed"); return(0); } if (!await SocialHitHelper.SendAsync(tracker, "Facebook", "like", "https://www.nuget.org/packages/Daimto.Google.Analytics.Tracker.SDK/")) { Console.WriteLine("Send social Hit Failed"); return(0); } var diff = DateTime.Now.Subtract(start).Milliseconds; if (!await TimingHitHelper.SendAsync(tracker, "TestSend", "lookup", diff)) { Console.WriteLine("Send social Hit Failed"); return(0); } Console.WriteLine("Hits Sent"); return(1); }
public void BuildMobileTracker_Null_WebProperty_ThrowArgumentNullException() { Assert.Throws <ArgumentNullException>(() => TrackerBuilder.BuildMobileTracker(null)); }