diff --git a/src/Plugins/Nop.Plugin.Widgets.GoogleAnalytics/Api/GoogleRequest.cs b/src/Plugins/Nop.Plugin.Widgets.GoogleAnalytics/Api/GoogleRequest.cs
index 65feb501a71..cea0471b63d 100644
--- a/src/Plugins/Nop.Plugin.Widgets.GoogleAnalytics/Api/GoogleRequest.cs
+++ b/src/Plugins/Nop.Plugin.Widgets.GoogleAnalytics/Api/GoogleRequest.cs
@@ -1,7 +1,7 @@
//Contributor: https://www.codeproject.com/Articles/493455/Server-side-Google-Analytics-Transactions
using System;
-using System.Net;
+using System.Net.Http;
using Nop.Core;
namespace Nop.Plugin.Widgets.GoogleAnalytics.Api
@@ -28,37 +28,23 @@ public class GoogleRequest
#region Utilities
- private void FireRequest(string url)
+ private async void FireRequest(string url)
{
if (_requestCount < 500)
{
_requestCount++;
- var gaRequest = WebRequest.Create(url);
-
+ var httpClient = new HttpClient();
try
{
// we don't need the response so this is the end of the request
- var response = gaRequest.GetResponse();
+ var response = (await httpClient.GetAsync(url)).EnsureSuccessStatusCode();
}
catch (Exception exc)
{
//eat the error
}
- //TODO comment the code above and uncomment the code below when the issue with multiple products is fixed
- //gaRequest.BeginGetResponse(r =>
- // {
- // try
- // {
- // // we don't need the response so this is the end of the request
- // var response = gaRequest.EndGetResponse(r);
- // }
- // catch
- // {
- // //eat the error
- // }
- // }, null);
}
}
diff --git a/src/Plugins/Nop.Plugin.Widgets.GoogleAnalytics/Nop.Plugin.Widgets.GoogleAnalytics.csproj b/src/Plugins/Nop.Plugin.Widgets.GoogleAnalytics/Nop.Plugin.Widgets.GoogleAnalytics.csproj
index 08d471f969d..bc239cc9fcc 100644
--- a/src/Plugins/Nop.Plugin.Widgets.GoogleAnalytics/Nop.Plugin.Widgets.GoogleAnalytics.csproj
+++ b/src/Plugins/Nop.Plugin.Widgets.GoogleAnalytics/Nop.Plugin.Widgets.GoogleAnalytics.csproj
@@ -5,7 +5,7 @@
Copyright © Nop Solutions, Ltd
Nop Solutions, Ltd
Nop Solutions, Ltd
- 1.31
+ 1.34
This plugin integrates with Google Analytics. It keeps track of statistics about the visitors and ecommerce conversion on your website
http://www.nopcommerce.com/