├── .gitignore ├── LICENSE ├── README.md ├── build └── nuget │ ├── UWP.SDKforGoogleAnalytics.Managed.nuspec │ ├── UWP.SDKforGoogleAnalytics.Native.nuspec │ ├── UWP.SDKforGoogleAnalytics.Native.targets │ ├── VERSION │ ├── build-nupkg-uwp-managed.cmd │ ├── build-nupkg-uwp-native.cmd │ └── download-nuget.cmd └── src ├── Managed ├── GoogleAnalytics.Core │ ├── Dimensions.cs │ ├── Ecommerce │ │ ├── Product.cs │ │ ├── ProductAction.cs │ │ └── Promotion.cs │ ├── GoogleAnalytics.Core.csproj │ ├── Hit.cs │ ├── HitBuilder.cs │ ├── IPlatformInfoProvider.cs │ ├── IServiceManager.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ServiceManager.cs │ ├── SimpleTracker.cs │ ├── TokenBucket.cs │ ├── Tracker.cs │ ├── TrackerManager.cs │ └── project.json ├── GoogleAnalytics.Sample │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets │ │ ├── LockScreenLogo.scale-200.png │ │ ├── SplashScreen.scale-200.png │ │ ├── Square150x150Logo.scale-200.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ │ ├── StoreLogo.png │ │ └── Wide310x150Logo.scale-200.png │ ├── GoogleAnalytics.Sample.Managed.csproj │ ├── GoogleAnalytics.Sample.Managed_TemporaryKey.pfx │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── Package.appxmanifest │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── Default.rd.xml │ └── project.json ├── GoogleAnalytics.UWP │ ├── AnalyticsManager.cs │ ├── GoogleAnalytics.UWP.Managed.csproj │ ├── PlatformInfoProvider.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── GoogleAnalytics.UWP.rd.xml │ └── project.json ├── GoogleAnalytics.UnitTests │ ├── Assets │ │ ├── LockScreenLogo.scale-200.png │ │ ├── SplashScreen.scale-200.png │ │ ├── Square150x150Logo.scale-200.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ │ ├── StoreLogo.png │ │ └── Wide310x150Logo.scale-200.png │ ├── DebugResponse.cs │ ├── Extensions.cs │ ├── GoogleAnalytics.UnitTests.csproj │ ├── GoogleAnalytics.UnitTests_TemporaryKey.pfx │ ├── IntegrationTests.cs │ ├── MockConfig.cs │ ├── MockPlatformInfoProvider.cs │ ├── MockServiceManager.cs │ ├── Package.appxmanifest │ ├── ParameterNames.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── UnitTestApp.rd.xml │ ├── UnitTestApp.xaml │ ├── UnitTestApp.xaml.cs │ ├── UnitTests.cs │ └── project.json └── GoogleAnalytics.sln └── Native ├── GoogleAnalytics.Sample.Javascript ├── GoogleAnalytics.Sample.Javascript.jsproj ├── GoogleAnalytics.Sample.Javascript.sln ├── GoogleAnalytics.Sample.Javascript_TemporaryKey.pfx ├── css │ └── default.css ├── images │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ └── Wide310x150Logo.scale-200.png ├── index.html ├── js │ └── main.js ├── package.appxmanifest └── packages.config ├── GoogleAnalytics.Sample.Native ├── App.xaml ├── App.xaml.cpp ├── App.xaml.h ├── Assets │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ └── Wide310x150Logo.scale-200.png ├── GoogleAnalytics.Sample.Native.vcxproj ├── GoogleAnalytics.Sample.Native.vcxproj.filters ├── GoogleAnalytics.Sample.Native_TemporaryKey.pfx ├── MainPage.xaml ├── MainPage.xaml.cpp ├── MainPage.xaml.h ├── Package.appxmanifest ├── pch.cpp └── pch.h ├── GoogleAnalytics.UWP ├── AnalyticsManager.cpp ├── AnalyticsManager.h ├── DateTimeHelper.cpp ├── DateTimeHelper.h ├── Dimensions.h ├── Ecommerce │ ├── Product.h │ ├── ProductAction.h │ └── Promotion.h ├── GoogleAnalytics.vcxproj ├── Hit.h ├── HitBuilder.cpp ├── HitBuilder.h ├── IPlatformInfoProvider.h ├── IServiceManager.h ├── PlatformInfoProvider.cpp ├── PlatformInfoProvider.h ├── TimeSpanHelper.cpp ├── TimeSpanHelper.h ├── TokenBucket.cpp ├── TokenBucket.h ├── Tracker.cpp ├── Tracker.h ├── pch.cpp └── pch.h ├── GoogleAnalytics.UnitTests_NativeSDK ├── Assets │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ └── Wide310x150Logo.scale-200.png ├── GoogleAnalytics.UnitTests_NativeSDK.csproj ├── GoogleAnalytics.UnitTests_NativeSDK_TemporaryKey.pfx ├── Package.appxmanifest ├── Properties │ ├── AssemblyInfo.cs │ └── UnitTestApp.rd.xml └── project.json └── GoogleAnalytics.sln /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | *.VC.VC.opendb 85 | 86 | # Visual Studio profiler 87 | *.psess 88 | *.vsp 89 | *.vspx 90 | *.sap 91 | 92 | # TFS 2012 Local Workspace 93 | $tf/ 94 | 95 | # Guidance Automation Toolkit 96 | *.gpState 97 | 98 | # ReSharper is a .NET coding add-in 99 | _ReSharper*/ 100 | *.[Rr]e[Ss]harper 101 | *.DotSettings.user 102 | 103 | # JustCode is a .NET coding add-in 104 | .JustCode 105 | 106 | # TeamCity is a build add-in 107 | _TeamCity* 108 | 109 | # DotCover is a Code Coverage Tool 110 | *.dotCover 111 | 112 | # NCrunch 113 | _NCrunch_* 114 | .*crunch*.local.xml 115 | nCrunchTemp_* 116 | 117 | # MightyMoose 118 | *.mm.* 119 | AutoTest.Net/ 120 | 121 | # Web workbench (sass) 122 | .sass-cache/ 123 | 124 | # Installshield output folder 125 | [Ee]xpress/ 126 | 127 | # DocProject is a documentation generator add-in 128 | DocProject/buildhelp/ 129 | DocProject/Help/*.HxT 130 | DocProject/Help/*.HxC 131 | DocProject/Help/*.hhc 132 | DocProject/Help/*.hhk 133 | DocProject/Help/*.hhp 134 | DocProject/Help/Html2 135 | DocProject/Help/html 136 | 137 | # Click-Once directory 138 | publish/ 139 | 140 | # Publish Web Output 141 | *.[Pp]ublish.xml 142 | *.azurePubxml 143 | # TODO: Comment the next line if you want to checkin your web deploy settings 144 | # but database connection strings (with potential passwords) will be unencrypted 145 | *.pubxml 146 | *.publishproj 147 | 148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 149 | # checkin your Azure Web App publish settings, but sensitive information contained 150 | # in these scripts will be unencrypted 151 | PublishScripts/ 152 | 153 | # NuGet Packages 154 | *.nupkg 155 | # The packages folder can be ignored because of Package Restore 156 | **/packages/* 157 | # except build/, which is used as an MSBuild target. 158 | !**/packages/build/ 159 | # Uncomment if necessary however generally it will be regenerated when needed 160 | #!**/packages/repositories.config 161 | # NuGet v3's project.json files produces more ignoreable files 162 | *.nuget.props 163 | *.nuget.targets 164 | 165 | # Nuget Executables (that should be downloaded) 166 | nuget.exe 167 | 168 | # Microsoft Azure Build Output 169 | csx/ 170 | *.build.csdef 171 | 172 | # Microsoft Azure Emulator 173 | ecf/ 174 | rcf/ 175 | 176 | # Windows Store app package directories and files 177 | AppPackages/ 178 | BundleArtifacts/ 179 | Package.StoreAssociation.xml 180 | _pkginfo.txt 181 | 182 | # Visual Studio cache files 183 | # files ending in .cache can be ignored 184 | *.[Cc]ache 185 | # but keep track of directories ending in .cache 186 | !*.[Cc]ache/ 187 | 188 | # Others 189 | ClientBin/ 190 | ~$* 191 | *~ 192 | *.dbmdl 193 | *.dbproj.schemaview 194 | *.pfx 195 | *.publishsettings 196 | node_modules/ 197 | orleans.codegen.cs 198 | 199 | # Since there are multiple workflows, uncomment next line to ignore bower_components 200 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 201 | #bower_components/ 202 | 203 | # RIA/Silverlight projects 204 | Generated_Code/ 205 | 206 | # Backup & report files from converting an old project file 207 | # to a newer Visual Studio version. Backup files are not needed, 208 | # because we have git ;-) 209 | _UpgradeReport_Files/ 210 | Backup*/ 211 | UpgradeLog*.XML 212 | UpgradeLog*.htm 213 | 214 | # SQL Server files 215 | *.mdf 216 | *.ldf 217 | 218 | # Business Intelligence projects 219 | *.rdl.data 220 | *.bim.layout 221 | *.bim_*.settings 222 | 223 | # Microsoft Fakes 224 | FakesAssemblies/ 225 | 226 | # GhostDoc plugin setting file 227 | *.GhostDoc.xml 228 | 229 | # Node.js Tools for Visual Studio 230 | .ntvs_analysis.dat 231 | 232 | # Visual Studio 6 build log 233 | *.plg 234 | 235 | # Visual Studio 6 workspace options file 236 | *.opt 237 | 238 | #Visual C++ XAML generated 239 | Generated Files/ 240 | 241 | 242 | # Visual Studio LightSwitch build output 243 | **/*.HTMLClient/GeneratedArtifacts 244 | **/*.DesktopClient/GeneratedArtifacts 245 | **/*.DesktopClient/ModelManifest.xml 246 | **/*.Server/GeneratedArtifacts 247 | **/*.Server/ModelManifest.xml 248 | _Pvt_Extensions 249 | 250 | # Paket dependency manager 251 | .paket/paket.exe 252 | paket-files/ 253 | 254 | # FAKE - F# Make 255 | .fake/ 256 | 257 | # JetBrains Rider 258 | .idea/ 259 | *.sln.iml 260 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 .NET Foundation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Windows SDK for Google Analytics™ 2 | 3 | This repo is archived. A .NET Standard-based version is maintained by [@LindaLawton](https://github.com/LindaLawton) [here](https://github.com/LindaLawton/google-analytics-dotnet-sdk). 4 | 5 | The Windows SDK for Google Analytics makes it easy to connect your Universal Windows Apps to Google Analytics Mobile App accounts. 6 | 7 | The SDK uses Google's [measurement protocol](https://developers.google.com/analytics/devguides/collection/protocol/) to send HTTP requests with user interaction data to Google's [Universal Analytics](https://support.google.com/analytics/answer/2790010) Services. The SDK also supports the [debug](https://developers.google.com/analytics/devguides/collection/protocol/v1/validating-hits) endpoint which will allows developers to test and validate their hits. 8 | 9 | The SDK supports tracking for the following interaction ([Hit](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#t)) types: 10 | 11 | - Screen Views 12 | - Actions (aka [Events](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#events)) 13 | - [Social Interactions](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#social) 14 | - [Exceptions](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#exception) 15 | - [Enhanced commerce](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#enhanced-ecomm) 16 | - [User Timings](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#timing) 17 | - [Custom Dimensions & Metrics](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#customs) 18 | 19 | The implementation supports: 20 | 21 | - [Session Management](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#sc) 22 | - [Cache Busting](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#z) 23 | - [Dispatching (periodic and manual)](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#qt) 24 | 25 | 26 | ## Getting Started 27 | Please read our [Getting Started ](https://github.com/dotnet/windows-sdk-for-google-analytics/wiki/Getting-Started) page for detailed information on pre-requisites, samples, and getting the nuget packages for the SDK. 28 | 29 | 30 | ## Release notes/Update history: 31 | **v1.5.0.0. Feb 2017**. This is our initial release, though our SDK is an iteration on this prior project on [codeplex](http://googleanalyticssdk.codeplex.com/). 32 | - Please see supported features above. 33 | - Converged the APIs so that the C# and WinRT SDKs would be seamless. In the convergence, we deprecated a few features from old SDK (in codeplex), so look at our FAQ, for porting your code from older SDK to this one. 34 | - We tweaked the APIs so they mapped closer to the Google Analytics Android SDK. This way folks familiar with the API on other platform could more easily reuse their knowledge with our SDK. 35 | 36 | ## Useful links 37 | - [SDK Documentation](https://github.com/dotnet/windows-sdk-for-google-analytics/wiki/Documentation) 38 | - [Future roadmap page](https://github.com/dotnet/windows-sdk-for-google-analytics/wiki/Roadmap) 39 | - [FAQs](https://github.com/dotnet/windows-sdk-for-google-analytics/wiki/FAQ) 40 | - [Learn about Google Analytics](https://developers.google.com/analytics/) 41 | 42 | ## About this SDK 43 | This SDK is intended to have feature parity as well as API similarity (adjusted for .NET and WinRT conventions) with the official Google Analytics SDK for Android. 44 | 45 | ### Feedback and Requests 46 | Please use the [issues](https://github.com/dotnet/windows-sdk-for-google-analytics/issues) page to submit any bugs, comments or questions, and feature requests. 47 | 48 | ### Contributing 49 | We accept contributions to code, samples, and docs. Please submit pull requests. 50 | 51 | ### .NET foundation 52 | This project is supported by the [.NET Foundation](https://dotnetfoundation.org/) 53 | -------------------------------------------------------------------------------- /build/nuget/UWP.SDKforGoogleAnalytics.Managed.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UWP.SDKforGoogleAnalytics.Managed 5 | 0.0.0-SpecifyVersionOnCommandline 6 | Windows SDK for Google Analytics -Windows 10 UWP(C#) 7 | .NET Foundation 8 | .NET Foundation 9 | http://github.com/dotnet/windows-sdk-for-google-analytics/blob/master/LICENSE 10 | http://github.com/dotnet/windows-sdk-for-google-analytics 11 | false 12 | C#, Windows 10 SDK for Google Analytics implementing the Google Universal Analytics Measurement Protocol 13 | Copyright 2016 14 | google analtyics universal analytics measurement protocol Win10 UWP Universal C# Managed 15 | More info at http://github.com/dotnet/windows-sdk-for-google-analytics 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /build/nuget/UWP.SDKforGoogleAnalytics.Native.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UWP.SDKforGoogleAnalytics.Native 6 | 0.0.0-SpecifyVersionOnCommandline 7 | Windows SDK for Google Analytics -Windows 10 UWP WinRT (for C++, Javascript) 8 | .NET Foundation 9 | .NET Foundation 10 | http://github.com/dotnet/windows-sdk-for-google-analytics/blob/master/LICENSE 11 | http://github.com/dotnet/windows-sdk-for-google-analytics 12 | false 13 | C#, Windows 10 SDK for Google Analytics implementing the Google Universal Analytics Measurement Protocol 14 | Copyright 2016 15 | google analtyics universal analytics measurement protocol Win10 UWP Universal C++ native Javascript 16 | More info at http://github.com/dotnet/windows-sdk-for-google-analytics 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /build/nuget/UWP.SDKforGoogleAnalytics.Native.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | win10 6 | win10 7 | x86 8 | $(Platform) 9 | $(MSBuildThisFileDirectory)..\..\runtimes\ 10 | $(MSBuildThisFileDirectory)..\..\ref\uap10.0\ 11 | 12 | 13 | 14 | 15 | GoogleAnalytics.dll 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | GoogleAnalytics.dll 24 | true 25 | True 26 | False 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /build/nuget/VERSION: -------------------------------------------------------------------------------- 1 | 1.5.1 2 | -------------------------------------------------------------------------------- /build/nuget/build-nupkg-uwp-managed.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | REM 3 | REM Version is read from the VERSION file. 4 | REM 5 | REM Say VERSION contains "0.0.3" then: 6 | REM 7 | REM build-nupkg <-- generates package with version 0.0.3 8 | REM 9 | 10 | SETLOCAL 11 | 12 | PUSHD "%~dp0" 13 | 14 | WHERE /Q nuget >NUL 15 | IF %ERRORLEVEL% NEQ 0 ( 16 | ECHO ERROR: nuget not found. 17 | ECHO. 18 | ECHO Run "%~pd0download-nuget.cmd" to download the latest version, or update PATH as appropriate. 19 | GOTO END 20 | ) 21 | 22 | 23 | SET PACKAGENAME=UWP.SDKforGoogleAnalytics.Managed 24 | SET /p VERSION=NUL 15 | IF %ERRORLEVEL% NEQ 0 ( 16 | ECHO ERROR: nuget not found. 17 | ECHO. 18 | ECHO Run "%~pd0download-nuget.cmd" to download the latest version, or update PATH as appropriate. 19 | GOTO END 20 | ) 21 | 22 | SET PACKAGENAME=UWP.SDKforGoogleAnalytics.Native 23 | 24 | SET /p VERSION= 10 | /// Dimensions in pixels. 11 | /// 12 | public struct Dimensions 13 | { 14 | /// 15 | /// Creates a new object to store dimensions. 16 | /// 17 | /// The width in pixels. 18 | /// The height in pixels. 19 | public Dimensions(int width, int height) 20 | { 21 | Width = width; 22 | Height = height; 23 | } 24 | 25 | /// 26 | /// Gets the width in pixels. 27 | /// 28 | public int Width { get; private set; } 29 | 30 | /// 31 | /// Gets the height in pixels. 32 | /// 33 | public int Height { get; private set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Core/Ecommerce/Product.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace GoogleAnalytics.Ecommerce 4 | { 5 | /// 6 | /// Class to construct product related information for a Google Analytics hit. Use this class to report information about products sold by merchants or impressions of products seen by users. Instances of this class can be associated with both s via addProduct(Product) and Product Impressions via addImpression(Product, String). 7 | /// 8 | public sealed class Product 9 | { 10 | /// 11 | /// Creates a new instance of the class. 12 | /// 13 | public Product() 14 | { 15 | CustomDimensions = new Dictionary(); 16 | CustomMetrics = new Dictionary(); 17 | } 18 | 19 | /// 20 | /// Gets or sets the brand associated with the product in GA reports. 21 | /// 22 | public string Brand { get; set; } 23 | 24 | /// 25 | /// Gets or sets the category associated with the product in GA reports. 26 | /// 27 | public string Category { get; set; } 28 | 29 | /// 30 | /// Gets or sets the coupon code associated with the product. 31 | /// 32 | public string CouponCode { get; set; } 33 | 34 | /// 35 | /// Gets or sets the custom dimensions associated with the product. 36 | /// 37 | public IDictionary CustomDimensions { get; private set; } 38 | 39 | /// 40 | /// Gets or sets the custom metrics associated with the product. 41 | /// 42 | public IDictionary CustomMetrics { get; private set; } 43 | 44 | /// 45 | /// Gets or sets the id that is used to identify a product in GA reports. 46 | /// 47 | public string Id { get; set; } 48 | 49 | /// 50 | /// Gets or sets the name that is used to identify the product in GA reports. 51 | /// 52 | public string Name { get; set; } 53 | 54 | /// 55 | /// Gets or sets the position of the product on the page/product impression list etc. 56 | /// 57 | public int? Position { get; set; } 58 | 59 | /// 60 | /// Gets or sets the price of the product. 61 | /// 62 | public double? Price { get; set; } 63 | 64 | /// 65 | /// Gets or sets the quantity of the product. 66 | /// 67 | public int? Quantity { get; set; } 68 | 69 | /// 70 | /// Gets or sets the variant of the product. 71 | /// 72 | public string Variant { get; set; } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Core/Ecommerce/ProductAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GoogleAnalytics.Ecommerce 4 | { 5 | /// 6 | /// Class to construct transaction/checkout or other product interaction related information for a Google Analytics hit. Use this class to report information about products sold, viewed or refunded. This class is intended to be used with . Instances of this class can be associated with . 7 | /// 8 | public sealed class ProductAction 9 | { 10 | /// 11 | /// Creates a new instance of with the product action for all the products included in the hit. Valid values include "detail", "click", "add", "remove", "checkout", "checkout_option", "purchase" and "refund". All these values are also defined in this class for ease of use. You also also send additional values with the hit for some specific actions. See the action documentation for details. 12 | /// 13 | /// The action type to send. 14 | public ProductAction(ActionEnum action) 15 | { 16 | Action = GetAction(action); 17 | } 18 | 19 | internal static string GetAction(ActionEnum action) 20 | { 21 | switch (action) 22 | { 23 | case ActionEnum.Add: 24 | return "add"; 25 | case ActionEnum.Checkout: 26 | return "checkout"; 27 | case ActionEnum.CheckoutOption: 28 | return "checkout_option"; 29 | case ActionEnum.Click: 30 | return "click"; 31 | case ActionEnum.Detail: 32 | return "detail"; 33 | case ActionEnum.Purchase: 34 | return "purchase"; 35 | case ActionEnum.Refund: 36 | return "refund"; 37 | case ActionEnum.Remove: 38 | return "remove"; 39 | default: 40 | throw new NotImplementedException(); 41 | } 42 | } 43 | 44 | /// 45 | /// Gets or sets the product action for all the products included in the hit. 46 | /// 47 | public string Action { get; private set; } 48 | 49 | /// 50 | /// Gets or sets the label associated with the checkout. This value is used for and actions. 51 | /// 52 | public string CheckoutOptions { get; set; } 53 | 54 | /// 55 | /// Gets or sets the checkout processes's progress. This value is used for and actions. 56 | /// 57 | public int? CheckoutStep { get; set; } 58 | 59 | /// 60 | /// Gets or sets the list name associated with the products in the analytics hit. This value is used for and actions. 61 | /// 62 | public string ProductActionList { get; set; } 63 | 64 | /// 65 | /// Gets or sets the list source name associated with the products in the analytics hit. This value is used for and actions. 66 | /// 67 | public string ProductListSource { get; set; } 68 | 69 | /// 70 | /// Gets or sets the transaction's affiliation value. This value is used for and actions. 71 | /// 72 | public string TransactionAffiliation { get; set; } 73 | 74 | /// 75 | /// Gets or sets the coupon code used in a transaction. This value is used for and actions. 76 | /// 77 | public string TransactionCouponCode { get; set; } 78 | 79 | /// 80 | /// The unique id associated with the transaction. This value is used for and actions. 81 | /// 82 | public string TransactionId { get; set; } 83 | 84 | /// 85 | /// Gets or sets the transaction's total revenue. This value is used for and actions. 86 | /// 87 | public double? TransactionRevenue { get; set; } 88 | 89 | /// 90 | /// Gets or sets the transaction's shipping costs. This value is used for and actions. 91 | /// 92 | public double? TransactionShipping { get; set; } 93 | 94 | /// 95 | /// Gets or sets the transaction's total tax. This value is used for and actions. 96 | /// 97 | public double? TransactionTax { get; set; } 98 | } 99 | 100 | /// 101 | /// The product action for all the products included in the hit. 102 | /// 103 | public enum ActionEnum 104 | { 105 | /// 106 | /// Action to use when a product is added to the cart. 107 | /// 108 | Add, 109 | /// 110 | /// Action to use for hits with checkout data. 111 | /// 112 | Checkout, 113 | /// 114 | /// Action to be used for supplemental checkout data that needs to be provided after a checkout hit. 115 | /// 116 | CheckoutOption, 117 | /// 118 | /// Action to use when the user clicks on a set of products. 119 | /// 120 | Click, 121 | /// 122 | /// Action to use when the user views detailed descriptions of products. 123 | /// 124 | Detail, 125 | /// 126 | /// Action that is used to report all the transaction data to GA. 127 | /// 128 | Purchase, 129 | /// 130 | /// Action to use while reporting refunded transactions to GA. 131 | /// 132 | Refund, 133 | /// 134 | /// Action to use when a product is removed from the cart. 135 | /// 136 | Remove 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Core/Ecommerce/Promotion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GoogleAnalytics.Ecommerce 4 | { 5 | /// 6 | /// Class to construct promotion related fields for Google Analytics hits. The fields from this class can be used to represent internal promotions that run within an app, such as banners, banner ads etc. 7 | /// 8 | public sealed class Promotion 9 | { 10 | /// 11 | /// Gets or sets the name of the creative associated with the promotion. 12 | /// 13 | public string Creative { get; set; } 14 | 15 | /// 16 | /// Gets or sets the id that is used to identify a promotion in GA reports. 17 | /// 18 | public string Id { get; set; } 19 | 20 | /// 21 | /// Gets or sets the name that is used to identify the promotion in GA reports. 22 | /// 23 | public string Name { get; set; } 24 | 25 | /// 26 | /// Gets or sets the position of the promotion. 27 | /// 28 | public string Position { get; set; } 29 | 30 | internal static string GetAction(PromotionAction action) 31 | { 32 | switch (action) 33 | { 34 | case PromotionAction.Click: 35 | return "click"; 36 | case PromotionAction.View: 37 | return "view"; 38 | default: 39 | throw new NotImplementedException(); 40 | } 41 | } 42 | } 43 | 44 | /// 45 | /// The product action for all the products included in the hit. 46 | /// 47 | public enum PromotionAction 48 | { 49 | /// 50 | /// Action to use when the user clicks/taps on a promotion. 51 | /// 52 | Click, 53 | /// 54 | /// Action to use when the user views a promotion. 55 | /// 56 | View 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Core/GoogleAnalytics.Core.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 14.0 6 | Debug 7 | AnyCPU 8 | {A6BE52D4-4652-4680-8E0D-9D1D1EB3AD1F} 9 | Library 10 | Properties 11 | GoogleAnalytics 12 | GoogleAnalytics.Core 13 | en-US 14 | 512 15 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 16 | 17 | 18 | v5.0 19 | 20 | 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | bin\Debug\GoogleAnalytics.Core.xml 29 | 30 | 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | bin\Release\GoogleAnalytics.Core.xml 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 67 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Core/Hit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace GoogleAnalytics 5 | { 6 | /// 7 | /// Represents a single event to track. 8 | /// 9 | public sealed class Hit 10 | { 11 | internal Hit(IDictionary data) 12 | { 13 | Data = data; 14 | TimeStamp = DateTimeOffset.UtcNow; 15 | } 16 | 17 | /// 18 | /// Gets the key value pairs to send to Google Analytics. 19 | /// 20 | public IDictionary Data { get; private set; } 21 | 22 | /// 23 | /// Gets the timestamp that the event was created. 24 | /// 25 | public DateTimeOffset TimeStamp { get; private set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Core/IPlatformInfoProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GoogleAnalytics 4 | { 5 | /// 6 | /// Interface to offer a way to provide all environment and platform level information required by Google Analytics. 7 | /// 8 | public interface IPlatformInfoProvider 9 | { 10 | /// 11 | /// Gets the value that anonymously identifies a particular user, device, or browser instance. For the web, this is generally stored as a first-party cookie with a two-year expiration. For mobile apps, this is randomly generated for each particular instance of an application install. The value of this field should be a random UUID (version 4) as described in . 12 | /// 13 | string AnonymousClientId { get; } 14 | 15 | /// 16 | /// Callback that indicates something is about to be logged. 17 | /// 18 | /// This allows lazy loading of values that might not be available immediately. 19 | void OnTracking(); 20 | 21 | /// 22 | /// Gets the screen color depth. 23 | /// 24 | int? ScreenColors { get; } 25 | 26 | /// 27 | /// Gets the screen resolution. 28 | /// 29 | Dimensions? ScreenResolution { get; } 30 | 31 | /// 32 | /// Gets the language (e.g. 'en-us'). 33 | /// 34 | string UserLanguage { get; } 35 | 36 | /// 37 | /// Gets the Viewport Resolution. 38 | /// 39 | Dimensions? ViewPortResolution { get; } 40 | 41 | /// 42 | /// Gets the User Agent of the browser. This is what Google uses to identify the operating system and device used. 43 | /// 44 | string UserAgent { get; } 45 | 46 | /// 47 | /// Raised to indicate that the has changed. 48 | /// 49 | event EventHandler ViewPortResolutionChanged; 50 | 51 | /// 52 | /// Raised to indicate that the has changed. 53 | /// 54 | event EventHandler ScreenResolutionChanged; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Core/IServiceManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace GoogleAnalytics 4 | { 5 | /// 6 | /// Interface for a service manager used to send hits to Google Analytics. 7 | /// 8 | public interface IServiceManager 9 | { 10 | /// 11 | /// Enqueues the hit so it is sent at the next opportunity. 12 | /// 13 | /// Dictionary of hit data to send. 14 | void EnqueueHit(IDictionary @params); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Resources; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Google Analytics Core")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Google Analytics SDK")] 14 | [assembly: AssemblyCopyright("Copyright © 2016")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: NeutralResourcesLanguage("en")] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Core/TokenBucket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GoogleAnalytics 4 | { 5 | internal class TokenBucket 6 | { 7 | readonly object locker = new object(); 8 | 9 | double capacity = 0; 10 | double tokens = 0; 11 | double fillRate = 0; 12 | DateTime timeStamp; 13 | 14 | public TokenBucket(double tokens, double fillRate) 15 | { 16 | this.capacity = tokens; 17 | this.tokens = tokens; 18 | this.fillRate = fillRate; 19 | this.timeStamp = DateTime.UtcNow; 20 | } 21 | 22 | public bool Consume(double tokens = 1.0) 23 | { 24 | lock (locker) // make thread safe 25 | { 26 | if (GetTokens() - tokens > 0) 27 | { 28 | this.tokens -= tokens; 29 | return true; 30 | } 31 | else 32 | { 33 | return false; 34 | } 35 | } 36 | } 37 | 38 | double GetTokens() 39 | { 40 | var now = DateTime.UtcNow; 41 | if (tokens < capacity) 42 | { 43 | var delta = fillRate * (now - timeStamp).TotalSeconds; 44 | tokens = Math.Min(capacity, tokens + delta); 45 | timeStamp = now; 46 | } 47 | return tokens; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Core/Tracker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GoogleAnalytics 4 | { 5 | /// 6 | /// Represents an object capable of tracking events for a single Google Analytics property. 7 | /// 8 | public sealed class Tracker : SimpleTracker 9 | { 10 | readonly IPlatformInfoProvider platformInfoProvider; 11 | 12 | /// 13 | /// Instantiates a new instance of . 14 | /// 15 | /// the property ID to track to. 16 | /// An object capable of providing platform and environment specific information. 17 | /// The object used to send s to the service. 18 | public Tracker(string propertyId, IPlatformInfoProvider platformInfoProvider, IServiceManager serviceManager) 19 | :base(propertyId, serviceManager) 20 | { 21 | this.platformInfoProvider = platformInfoProvider; 22 | if (platformInfoProvider != null) 23 | { 24 | ClientId = platformInfoProvider.AnonymousClientId; 25 | ScreenColors = platformInfoProvider.ScreenColors; 26 | ScreenResolution = platformInfoProvider.ScreenResolution; 27 | Language = platformInfoProvider.UserLanguage; 28 | ViewportSize = platformInfoProvider.ViewPortResolution; 29 | platformInfoProvider.ViewPortResolutionChanged += platformTrackingInfo_ViewPortResolutionChanged; 30 | platformInfoProvider.ScreenResolutionChanged += platformTrackingInfo_ScreenResolutionChanged; 31 | } 32 | } 33 | 34 | void platformTrackingInfo_ViewPortResolutionChanged(object sender, EventArgs args) 35 | { 36 | ViewportSize = platformInfoProvider.ViewPortResolution; 37 | } 38 | 39 | void platformTrackingInfo_ScreenResolutionChanged(object sender, EventArgs args) 40 | { 41 | ScreenResolution = platformInfoProvider.ScreenResolution; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Core/TrackerManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | namespace GoogleAnalytics 5 | { 6 | /// 7 | /// Provides a way to manage multiple instances. 8 | /// 9 | public class TrackerManager : ServiceManager 10 | { 11 | readonly IPlatformInfoProvider platformInfoProvider; 12 | readonly Dictionary trackers; 13 | 14 | /// 15 | /// Instantiates a new instance of . 16 | /// 17 | /// An object capable of providing platform and environment specific information. 18 | public TrackerManager(IPlatformInfoProvider platformInfoProvider) 19 | { 20 | trackers = new Dictionary(); 21 | this.platformInfoProvider = platformInfoProvider; 22 | UserAgent = platformInfoProvider.UserAgent; 23 | } 24 | 25 | /// 26 | /// Gets the collection of instances. 27 | /// 28 | protected ICollection Trackers 29 | { 30 | get { return trackers.Values; } 31 | } 32 | 33 | /// 34 | /// Gets or sets the default tracker instance for easy access. 35 | /// 36 | /// This always returns the last tracker instance created. 37 | public Tracker DefaultTracker { get; set; } 38 | 39 | /// 40 | /// Gets or sets whether the app should log information to Google Analtyics. 41 | /// 42 | /// See Google Analytics usage guidelines for more information. 43 | public virtual bool AppOptOut { get; set; } 44 | 45 | /// 46 | /// Gets a using a given property ID. Will creates a new instance if one does not exist yet. 47 | /// 48 | /// The property ID that the should log to. 49 | /// The new or existing instance keyed on the property ID. 50 | public virtual Tracker CreateTracker(string propertyId) 51 | { 52 | propertyId = propertyId ?? string.Empty; 53 | if (!trackers.ContainsKey(propertyId)) 54 | { 55 | var tracker = new Tracker(propertyId, platformInfoProvider, this); 56 | trackers.Add(propertyId, tracker); 57 | if (DefaultTracker == null) 58 | { 59 | DefaultTracker = tracker; 60 | } 61 | return tracker; 62 | } 63 | else 64 | { 65 | return trackers[propertyId]; 66 | } 67 | } 68 | 69 | /// 70 | /// Removes and cleans up a given . 71 | /// 72 | /// The instance to remove and clean up. 73 | public void CloseTracker(Tracker tracker) 74 | { 75 | trackers.Remove(tracker.PropertyId); 76 | if (DefaultTracker == tracker) 77 | { 78 | DefaultTracker = null; 79 | } 80 | } 81 | 82 | /// 83 | /// Gets the instance of used by all instances. 84 | /// 85 | public IPlatformInfoProvider PlatformTrackingInfo 86 | { 87 | get { return platformInfoProvider; } 88 | } 89 | 90 | /// 91 | public override void EnqueueHit(IDictionary @params) 92 | { 93 | if (!AppOptOut) 94 | { 95 | base.EnqueueHit(@params); 96 | } 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Core/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "supports": {}, 3 | "dependencies": { 4 | "Microsoft.NETCore.Portable.Compatibility": "1.0.1", 5 | "NETStandard.Library": { 6 | "version": "1.6.0", 7 | "suppressParent": "all" 8 | } 9 | }, 10 | "frameworks": { 11 | "netstandard1.2": {} 12 | } 13 | } -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Sample/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Sample/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Windows.ApplicationModel; 3 | using Windows.ApplicationModel.Activation; 4 | using Windows.UI.Xaml; 5 | using Windows.UI.Xaml.Controls; 6 | using Windows.UI.Xaml.Navigation; 7 | 8 | namespace GoogleAnalytics.Sample 9 | { 10 | /// 11 | /// Provides application-specific behavior to supplement the default Application class. 12 | /// 13 | sealed partial class App : Application 14 | { 15 | public static Tracker Tracker { get; private set; } 16 | 17 | /// 18 | /// Initializes the singleton application object. This is the first line of authored code 19 | /// executed, and as such is the logical equivalent of main() or WinMain(). 20 | /// 21 | public App() 22 | { 23 | this.InitializeComponent(); 24 | this.Suspending += OnSuspending; 25 | 26 | // This is for sample purposes only to prevent the app from crashing since we purposely throw an unhandled exception. Do NOT do this in your own code. 27 | UnhandledException += (sender, e) => 28 | { 29 | e.Handled = true; 30 | }; 31 | } 32 | 33 | /// 34 | /// Invoked when the application is launched normally by the end user. Other entry points 35 | /// will be used such as when the application is launched to open a specific file. 36 | /// 37 | /// Details about the launch request and process. 38 | protected override void OnLaunched(LaunchActivatedEventArgs e) 39 | { 40 | #if DEBUG 41 | if (System.Diagnostics.Debugger.IsAttached) 42 | { 43 | this.DebugSettings.EnableFrameRateCounter = true; 44 | } 45 | #endif 46 | Frame rootFrame = Window.Current.Content as Frame; 47 | 48 | // Do not repeat app initialization when the Window already has content, 49 | // just ensure that the window is active 50 | if (rootFrame == null) 51 | { 52 | // Create a Frame to act as the navigation context and navigate to the first page 53 | rootFrame = new Frame(); 54 | 55 | rootFrame.NavigationFailed += OnNavigationFailed; 56 | 57 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 58 | { 59 | //TODO: Load state from previously suspended application 60 | } 61 | 62 | // Place the frame in the current Window 63 | Window.Current.Content = rootFrame; 64 | } 65 | 66 | if (e.PrelaunchActivated == false) 67 | { 68 | if (rootFrame.Content == null) 69 | { 70 | 71 | Tracker = AnalyticsManager.Current.CreateTracker("UA-39959863-1"); 72 | AnalyticsManager.Current.ReportUncaughtExceptions = true; 73 | AnalyticsManager.Current.AutoAppLifetimeMonitoring = true; 74 | 75 | // When set to true, the debug api of GA is hit 76 | // Note: Debug api of GA does not log to the GA console. 77 | // Set it to false to log the activity. 78 | AnalyticsManager.Current.IsDebug = true; 79 | 80 | // When the navigation stack isn't restored navigate to the first page, 81 | // configuring the new page by passing required information as a navigation 82 | // parameter 83 | rootFrame.Navigate(typeof(MainPage), e.Arguments); 84 | } 85 | // Ensure the current window is active 86 | Window.Current.Activate(); 87 | } 88 | } 89 | 90 | /// 91 | /// Invoked when Navigation to a certain page fails 92 | /// 93 | /// The Frame which failed navigation 94 | /// Details about the navigation failure 95 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e) 96 | { 97 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName); 98 | } 99 | 100 | /// 101 | /// Invoked when application execution is being suspended. Application state is saved 102 | /// without knowing whether the application will be terminated or resumed with the contents 103 | /// of memory still intact. 104 | /// 105 | /// The source of the suspend request. 106 | /// Details about the suspend request. 107 | private void OnSuspending(object sender, SuspendingEventArgs e) 108 | { 109 | var deferral = e.SuspendingOperation.GetDeferral(); 110 | //TODO: Save application state and stop any background activity 111 | deferral.Complete(); 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Sample/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/windows-sdk-for-google-analytics/81878f1bb6df95bfd9793224af96592b67995d66/src/Managed/GoogleAnalytics.Sample/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Sample/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/windows-sdk-for-google-analytics/81878f1bb6df95bfd9793224af96592b67995d66/src/Managed/GoogleAnalytics.Sample/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Sample/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/windows-sdk-for-google-analytics/81878f1bb6df95bfd9793224af96592b67995d66/src/Managed/GoogleAnalytics.Sample/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Sample/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/windows-sdk-for-google-analytics/81878f1bb6df95bfd9793224af96592b67995d66/src/Managed/GoogleAnalytics.Sample/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Sample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/windows-sdk-for-google-analytics/81878f1bb6df95bfd9793224af96592b67995d66/src/Managed/GoogleAnalytics.Sample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Sample/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/windows-sdk-for-google-analytics/81878f1bb6df95bfd9793224af96592b67995d66/src/Managed/GoogleAnalytics.Sample/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Sample/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/windows-sdk-for-google-analytics/81878f1bb6df95bfd9793224af96592b67995d66/src/Managed/GoogleAnalytics.Sample/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Sample/GoogleAnalytics.Sample.Managed.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x86 7 | {82A33996-59A5-4CA8-BED7-7EDC914B42EF} 8 | AppContainerExe 9 | Properties 10 | GoogleAnalytics.Sample 11 | GoogleAnalytics.Sample 12 | en-US 13 | UAP 14 | 10.0.10240.0 15 | 10.0.10240.0 16 | 14 17 | 512 18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 19 | GoogleAnalytics.Sample.Managed_TemporaryKey.pfx 20 | 21 | 22 | true 23 | bin\x86\Debug\ 24 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 25 | ;2008 26 | full 27 | x86 28 | false 29 | prompt 30 | true 31 | 32 | 33 | bin\x86\Release\ 34 | TRACE;NETFX_CORE;WINDOWS_UWP 35 | true 36 | ;2008 37 | pdbonly 38 | x86 39 | false 40 | prompt 41 | true 42 | true 43 | 44 | 45 | true 46 | bin\ARM\Debug\ 47 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 48 | ;2008 49 | full 50 | ARM 51 | false 52 | prompt 53 | true 54 | 55 | 56 | bin\ARM\Release\ 57 | TRACE;NETFX_CORE;WINDOWS_UWP 58 | true 59 | ;2008 60 | pdbonly 61 | ARM 62 | false 63 | prompt 64 | true 65 | true 66 | 67 | 68 | true 69 | bin\x64\Debug\ 70 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 71 | ;2008 72 | full 73 | x64 74 | false 75 | prompt 76 | true 77 | 78 | 79 | bin\x64\Release\ 80 | TRACE;NETFX_CORE;WINDOWS_UWP 81 | true 82 | ;2008 83 | pdbonly 84 | x64 85 | false 86 | prompt 87 | true 88 | true 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | App.xaml 97 | 98 | 99 | MainPage.xaml 100 | 101 | 102 | 103 | 104 | 105 | Designer 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | MSBuild:Compile 122 | Designer 123 | 124 | 125 | MSBuild:Compile 126 | Designer 127 | 128 | 129 | 130 | 131 | {a6be52d4-4652-4680-8e0d-9d1d1eb3ad1f} 132 | GoogleAnalytics.Core 133 | 134 | 135 | {ef2863f0-036b-48f1-a402-77570a1a2823} 136 | GoogleAnalytics.UWP.Managed 137 | 138 | 139 | 140 | 14.0 141 | 142 | 143 | 150 | -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Sample/GoogleAnalytics.Sample.Managed_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/windows-sdk-for-google-analytics/81878f1bb6df95bfd9793224af96592b67995d66/src/Managed/GoogleAnalytics.Sample/GoogleAnalytics.Sample.Managed_TemporaryKey.pfx -------------------------------------------------------------------------------- /src/Managed/GoogleAnalytics.Sample/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 |