Skip to content

Commit

Permalink
Added support for all request types to GoogleAnalyticsRequestFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
Ion Sapoval committed Sep 14, 2016
1 parent d62551e commit 02fbf27
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 10 deletions.
40 changes: 36 additions & 4 deletions src/GoogleMeasurementProtocol/GoogleAnalyticsRequestFactory.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using GoogleMeasurementProtocol.Parameters;
using GoogleMeasurementProtocol.Parameters.General;
using GoogleMeasurementProtocol.Requests;
using System;
using System;
using System.Collections.Generic;
using System.Net;
using GoogleMeasurementProtocol.Parameters;
using GoogleMeasurementProtocol.Parameters.General;
using GoogleMeasurementProtocol.Requests;


namespace GoogleMeasurementProtocol
{
Expand Down Expand Up @@ -60,6 +61,37 @@ public IGoogleAnalyticsRequest CreateRequest(string hitType, IEnumerable<Paramet
request = new EventRequest(_useSsl, _proxy);
break;

case HitTypes.Exception:

request = new ExceptionTrackingRequest(_useSsl, _proxy);
break;

case HitTypes.Item:

request = new ItemRequest(_useSsl, _proxy);
break;

case HitTypes.ScreenView:

request = new ScreenTrackingRequest(_useSsl, _proxy);
break;

case HitTypes.Social:

request = new SocialInteractionsRequest(_useSsl, _proxy);
break;

case HitTypes.Timing:

request = new UserTimingTrackingRequest(_useSsl, _proxy);
break;

case HitTypes.Transaction:

request = new TransactionRequest(_useSsl, _proxy);
break;


default:
throw new ApplicationException("Unknown hitType: " + hitType);
}
Expand Down
11 changes: 5 additions & 6 deletions src/TestConsole/TestConsole.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="GoogleMeasurementProtocol, Version=1.3.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GoogleMeasurementProtocol.1.3.5\lib\GoogleMeasurementProtocol.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
Expand All @@ -47,12 +51,7 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GoogleMeasurementProtocol\GoogleAnalyticsMeasurementProtocol.csproj">
<Project>{5da1474f-fdf8-4014-8fc1-6f7303c0c027}</Project>
<Name>GoogleAnalyticsMeasurementProtocol</Name>
</ProjectReference>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
4 changes: 4 additions & 0 deletions src/TestConsole/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GoogleMeasurementProtocol" version="1.3.5" targetFramework="net451" />
</packages>

0 comments on commit 02fbf27

Please sign in to comment.